PDA

View Full Version : [MX] how to pick up a variable



reverendflash
January 27th, 2003, 02:36 PM
Again, I know how to do this in Generator, but I am trying to learn MX syntax.

I have a button in _level15 setting a variable (panel). I have a button loading a jpg, through loadmove, into a target. The variable is the name of that target.

If I don't use the variable, here is the code I use:

on (release) {
loadMovie("../dodge/aarp1.jpg", _root._level40.panel1);
}

what I want to do, is replace panel1 with the variable named "panel" .

how do I write the syntax?

Thanks in advance for your help...

Revhttp://www.aulman.com/rev.gif

h88
January 27th, 2003, 09:09 PM
I think this thread is what you need Rev, if not, please describe more.

http://www.kirupaforum.com/showthread.php?s=&threadid=12082

reverendflash
January 27th, 2003, 09:38 PM
h88:

It very well could be, but I'm not understanding it. Lost tried to help last nite, but I wasn't following him at all either...

I have several buttons which will each set a diff value for the variable "panel"...

then, when loading a jpg from a menu, that variable will "tell" the loadmovie which target to load into.

I have got it to work without the variable in the code (if I hard code the target), but I don't know how to get the variable which was set by another swf, and use that as the target...

thanks,

Revhttp://www.aulman.com/rev.gif

h88
January 27th, 2003, 10:07 PM
Originally posted by reverendflash
but I don't know how to get the variable which was set by another swf, and use that as the target...[/IMG]


So your trying to use a variable that's created in for example _level5 as your target, and your also trying to load the value of that variable in _root?

If so, try the following:

==Insert this into the other swf actions====
Rev = eval("this");// change 'this' into the specified target in the other swf
==Then just load that swf, and use levels to reference Rev for example===

loadMovie("swfFile.swf", _level5.Rev);

Tell me how it goes.

h88
January 27th, 2003, 10:25 PM
I made this attachment, with some code modification, and i got it working. :beam:

Rev1 is the main movie
Rev2 is _level2 (where you assign the variable rev)
Rev3 is the movie where you want it to target _level2.somemovie

I added some delay functions, you know, your trying to load a movie into _level2 when _level2 is still not created!

ahmed
January 27th, 2003, 10:46 PM
Originally posted by reverendflash
If I don't use the variable, here is the code I use:

on (release) {
loadMovie("../dodge/aarp1.jpg", _root._level40.panel1);
}

what I want to do, is replace panel1 with the variable named "panel" .

how do I write the syntax?

Thanks in advance for your help...

Revhttp://www.aulman.com/rev.gif

well.. from what i understand i think you need to replace the


loadMovie("../dodge/aarp1.jpg", _root._level40.panel1);

with


loadMovie("../dodge/aarp1.jpg", _level40[panel]);
...

do i make sense?? or.. am i totally misunderstanding you? :)

reverendflash
January 27th, 2003, 11:24 PM
Ahmed:

Thanks... that's the ticket...

Revhttp://www.aulman.com/rev.gif

h88
January 27th, 2003, 11:28 PM
Originally posted by reverendflash
Ahmed:

Thanks... that's the ticket...

Revhttp://www.aulman.com/rev.gif

Oh ok, i was confused in the beginning and i didn't understand you though.

Edit: actually my solution assigned the variable Rev to what ahmed posted above but in a different way! eval("myMovie") is actually the same as _level40["myMovie"]......

ahmed
January 28th, 2003, 12:44 AM
hehe.. glad its solved now...
i think your way is correct too, but the _level#[variable] is a kinda used more.. i guess.. or atleast among those who i knows.. :)
eval is deprecated