flash actionscript:
Hello... what I'm trying to do is use the loadClip method (via the MovieClipLoader class) to load in an external .swf file. Once the file is loaded, I want to be able to take the externally loaded .swf and reposition it inside the main .swf file. Here's my code: buttonName.onRelease = function ( ) { mcLoader.loadClip("movieOne.swf", 15) _level15._x = 300; _level15._y = 350 } The external .swf file loads just fine. However, no matter what I do, the only place the external .swf will load is in the upper left corner of the stage. I can't get it to position itself anywhere else on the page. Personally, I would rather just load movies into empty movie clips, however, I'm teaching this to students who want to know how to work with levels. Maybe it isn't possible to reposition levels? Or do anything else for that matter... ie: I also tried _level15._alpha = 20; and that didn't work either. If you know the proper code to get the positioning to work, I would sure appreciate your feedback! Thanks!! Brenda Version: MX 2004 Pro
Don't you have to wait for _level15 to load moveOne.swf before you try changing any of those properties? Try this: myListener = new Object(); myListener.onLoadComplete = function() { _level15._x = 300; _level15._y = 350 } mcLoader.addListener(myListener); // buttonName.onRelease = function ( ) { mcLoader.loadClip("movieOne.swf", 15); }
Thank you so much for your reply. The code didn't work, even though it seems like it should. I'm almost convinced at this point that levels cannot be positioned. I think the only way to make this work is to 1) make sure the external .swf file has the same stage size as the file you're loading it into. Then 2) position your objects/elements in the external .swf file in a place where you want them to appear in the .swf file it'll be loaded into. Brenda
Try this: myListener.onLoadComplete = function() { trace(level15); _level15._x = 300; _level15._y = 350 }
Use: myListener.onLoadInit = function() { instead of:
You rock!! It works perfectly!!!! Thank you NSurveyor!!! myListener.onLoadInit = function() { _level15._x = 300; _level15._y = 350
Hey, I was searching for topics about _level and came across this...I'm trying to load a .swf and reposition it like the original poster, but the code just isn't working, and I don't know why, is there something I'm missing? When I test the code, I get these errors: **Error** Scene=Scene 1, layer=actions, frame=1:Line 6: The property being referenced does not have the static attribute. MovieClipLoader.addListener(myListener); **Error** Scene=Scene 1, layer=actions, frame=1:Line 9: The property being referenced does not have the static attribute. MovieClipLoader.loadClip ("start_test.swf", 15); Total ActionScript Errors: 2 Reported Errors: 2 Here's the code, any help is appreciated: myListener = new Object(); myListener.onLoadInit = function() { _level15._x = 300; _level15._y = 350 } MovieClipLoader.addListener (myListener); my_btn.onRelease = function () { MovieClipLoader.loadClip ("start_test.swf", 15); }
Use: mcLoader = new MovieClipLoader(); myListener = new Object(); myListener.onLoadInit = function() { _level15._x = 300; _level15._y = 350 } mcLoader.addListener (myListener); my_btn.onRelease = function () { mcLoader.loadClip ("start_test.swf", 15); }
Don't see what you're looking for? Try a search.
|