FORUMS: list search recent posts

Flash Variable Syntax Question

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
digitalcracker
Flash Variable Syntax Question
on Dec 29, 2005 at 9:05:53 pm

I'm trying to use a variable in place of a MovieClip name.
Example: variable.gotoAndPlay(2);

Flash is looking for a MC with the name "variable" when I use it in this situation. What is the proper syntax? Is it possible to use it this way?

Thank you!

DigitalCracker


Return to posts index

Nu_Nog
Re: Flash Variable Syntax Question
on Dec 30, 2005 at 1:49:38 am

If you assign a MovieClip to the variable before hand it would work.
variable = some_mc;
variable.gotoAndPlay(2);



Return to posts index

Richard
Re: Flash Variable Syntax Question
on Dec 30, 2005 at 11:44:39 am

It should work, but it is bad form.

-Richard


Return to posts index


digitalcracker
Re: Flash Variable Syntax Question
on Dec 30, 2005 at 5:49:25 pm

What would be a better form? The enduser can click 9 possible buttons in the clips. If it is the wrong button, I need to reset whichever button they clicked. Thats why I made the clip a variable. It still doesn't work.


Thanks



Return to posts index

Richard
Re: Flash Variable Syntax Question
on Jan 1, 2006 at 6:38:28 pm

Using words like "variable", or "function", or "date" is bad form because it may conflict with common keywords, and will surely get you into trouble. You end up with bugs in your code that you can't seem to track down.

Instead, using words like "myMovieClip" or "myVar" or even "someMovie" are much better.. (notice the use of Hungarian form too).

-Richard


Return to posts index

digitalcracker
Re: Flash Variable Syntax Question
on Dec 31, 2005 at 2:17:55 am

Well thanks for the input. But I got it figured out myself.
If anyone else is interested in the solution, here it is:

eval(variable).gotoAndPlay(2);

Cheers

DigitalCracker


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]