Share Posted September 5, 2011 Hi again. I am trying to create several independent movieclips from loaded SWF content. In other words im trying to duplicate those SWF's. Now im trying something like this: var movie:MovieClip = LoaderMax.getLoader("movie").rawContent; var MovieClass:Class = (movie as Object).constructor as Class; var newMovie:MovieClip = new MovieClass() as MovieClip; But when i try adding newMovie to stage, nothing happens. When i do this: var movie:MovieClip = LoaderMax.getLoade("movie").rawContent addChld(movie) it works perfectly. But of course i am not able to use this content again with another movieclip. Any ideas? Link to comment Share on other sites More sharing options...
Share Posted September 5, 2011 I'm 99% certain that you can not duplicate instances of loaded swfs this is a limitation of Flash Player and not LoaderMax. http://www.actionscript.org/forums/show ... 3?t=151062 If you google "ActionScript 3 duplicate loaded swf" you will see some fairly cryptic guesses and suggestions but nothing that seems as rock-solid as having multiple loaders for the same asset. also to note, once you load the file once, it should be cached by the browser and not take any time to download multiple times. Link to comment Share on other sites More sharing options...
Author Share Posted September 6, 2011 One sleepless night and i did it So, there one external loaded swf with some movieclip inside. Let's say it is a spaceship. I want to duplicate this ship, so I go like this: var mc:MovieClip = MovieClip(LoaderMax.getLoader("ship").rawContent); var movie:MovieClip = mc.getChildAt(0) as MovieClip; var MovieClass:Class = (movie as Object).constructor as Class; var newMovie:MovieClip = new MovieClass() as MovieClip; I address the raw content at first, then I target my movieclip inside that swf and voila, i create a new class, using that movieclip as an object. Now i can create several MovieClass objects and use as much copies of my ship as I like. note: you have to check "export for actionscript" box in the properties of movieclip in your Flash CSx 1 Link to comment Share on other sites More sharing options...
Share Posted September 6, 2011 thank you for posting your results. I realize i mis-understood your question as you wanting to duplicate the swf you loaded, and not gain access to symbols inside it. still I wouldn't have had the solution for you. I'm glad you got it to work. there seems to be a bit more info out there on using assets in the libraries of external swfs: http://www.ultrashock.com/forum/viewthread/92007/ Link to comment Share on other sites More sharing options...
Share Posted October 1, 2013 One sleepless night and i did it Respect! With this code I can point not just to mc inside loaded swf, but to the whole thing. Great! Thank You! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now