Passing Variables to Flash

Hey Everybody,

I’m new here, but I’ve used the site many times for flash research, so I thought I’d do the right thing and join up.

I’ve been having an issue using the Passing Variables to Flash tutorial inside a single frame flash document. The document itself contains a MC that works using the [url=“http://www.kirupa.com/developer/mx/preloader_transition.htm”]Preloader & Transition of Dynamic Files tutorial. I have used the _x and _y properties to movie an image Inside each of the preloaded movies.

The code for the first frame of the document I am trying to pass the variable to, is as follows:

if (movie=="" or movie==1) {
_root.section = “image1.swf”;
}
if (movie==2) {
_root.section = “image2.swf”;
}
if (movie==3) {
_root.section = “image3.swf”;
}
else {
_root.section = “image3.swf”;
}

However, when the movie is run, the code will always go to the else, no matter what the parameter specified in the URL is. I can only assume this has something to do with the fact that it is looping on the first frame.

Thanks in advance,

dreeft.

Hi

Your code looks ok to me,

if (movie==“” or movie==1) {
_root.section = “image1.swf”;
}else if (movie==2) {
_root.section = “image2.swf”;
}else if (movie==3) {
_root.section = “image3.swf”;
} else {
_root.section = “image3.swf”;
}

try else if…i know this is not the smartest answer… :scream:
but u have to debug what value is their in variable movie. By looking at ur code it seems u might have written the script inside MC. If my guess is right
then check varible movie. Is it declared on stage or in MC.


aShIsH

I tried it with the else if’s, didn’t make any difference.

The script is inside the first frame of the scene (the stage). The variable movie is not returning anything, as far as I can see. I tried outputting the variable to a text box, and it gave me nothing.

Any ideas?

if movie is a variable name, try this


if (_root.movie=="" or _root.movie==1) {
_root.section = "image1.swf";
}
if (_root.movie==2) {
_root.section = "image2.swf";
}
if (_root.movie==3) {
_root.section = "image3.swf";
}
else {
_root.section = "image3.swf";
}

or check the value of movie by,
trace(movie);

I’m getting “undefined” from the trace, inside flash. But that’ll be because it’s not passing anything to it when it runs. Can I add command line arguments inside flash? (It’s also not giving me the option of running as HTML, which I thought was weird).

The code didn’t make any difference :confused:

Hm… can I bump this? :smiley: