-
Actionscript2 load an external .swf using a variable instead of url
Hello,
in my movie I can load another .swf by using the url:
loadMovie('htpp://www.example.com/example.swf', 1);
I would like to replace the url with a string variable
loadMovie('example-variable', 1);
but am not having much luck.
Thanks in advance for any solutions.
-
Prid - Outing
Having quotes around your variable makes Flash interpret is as just another string, so omit those quotes to make Flash recognize it as a variable. Also, a variable cannot have a dash/minus sign in its name, as dash/minus sign is interpreted as a Mathematical sign used to subtract values. Replace it with an underscore. Fixed code:
Actionscript Code:
loadMovie(example_variable, 1);
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Thank you Nig,
I tried your way earlier today and again just now, it doesn't work for me.
I have finally solved it using:
var url:String = example_variable;
var movieClip:MovieClip = createEmptyMovieClip("movieClip", 0);
movieClip.loadMovie(url);
-
Prid - Outing
I just pointed out the error made in the particular code you posted, and would've understood your problem in greater depth if you had posted your full contextual code, but I'm glad you've sorted it out
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|