Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using variables with gotoandplay cmd

Status
Not open for further replies.

MukeshMak

Technical User
Aug 6, 2002
19
CH
Hi all,

I was wondering if it was possible to use variables with the gotoandplay command in Flash 5?

I have loaded an array with frame labels. Elements of the array are chosen and passed to a local variable before being put into the goto command:

sampleArray = new array("one", "two");

.
.
.

localVar = new String( sampleArray[0] );

( OR localVar = sampleArray[0]; )

.
.
.

gotoAndPlay( localVar );

If the above is not possible then how would I go about doing the same thing...?

Any help appreciated.

Thanks.
 
If you had tried it... You would have found out right?

on(press){
gotoAndStop(sampleArray[1]);
}

local_var = sampleArray[1];
...
on(press){
gotoAndStop(local_var);
}

Both work fine! Regards,

oldman3.gif
 
Hi,

Thanks. I tested the code before posting but it didn't seem to work...

The only way I could get it to work was if i did the following:

gotoAndPlay( 'frameNames[Number(sceneCounter)]' );

where frameNames is an array and the sceneCounter is a variable that determines the current scene.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top