View Full Version : Roaming game ending scene help

11-29-2007, 12:11 PM
Hi first of all i hope you can help me, no one else could :(
I made an adventure game, where you colloct letters, you can move freely through all the scenes, and look for letters. Each letter is a Movie Clip, which contains the following code:

keyListener = new Object();

keyListener.onKeyDown = function() {
var keyCode = Key.getCode();

if (keyCode == 71) {
i = i + 1;


I want to load a scene when all the letters are collected (ending scene)
so i made a variable which is what the line: "testi();" refers to.
In my timeline i have tried to create a global variable with a function:

var (i = 0);

function (testi) {
if (i > 6)

There are 7 letters so far, which i why i want the "gotoAndPlay(256)" to load if i>6
But it doesent seem to work, is this a way to do it?
If this is not enough info, please tell me and i'll try to explain...

Thank you very much

11-29-2007, 04:41 PM
You function is (or should be) in the top timeline. And form the movie clip you should call _root.testi().
Same thing for i. If you put code in the main timeline, you have to do _root.

If you're still lost, search google for actionscript+scope, and you should find a decent tutorial on scope.