*blog... kind of... *rss
DuplicateMovieClip with AS3 (not Senocular's way)
8 comments written so far...I've been trying to use Senocular's duplicateDisplayObject() for a while and I've experienced a lot of crashes of specific versions of Flash player and also unsuccessful results when used within an AIR application. After playing around quite a bit with all this, the best way I've found is to avoid duplicating the instance but duplicate the element on the domain/library instead.
I'm pasting here a snippet of how it works:
mc is now a clean duplication (as far as I know) of the original class. In my setup I expect the element that I want to be duplicated be named with the exact name as its container's filename (.swf), which is perfect for FlexSDK compiled stuff, but need some teaching for Flash IDE.
This is, of course, compatible with any kind of Object (not only MovieClips/Sprites/DisplayObjects)...
I'm pasting here a snippet of how it works:
/* * node.@src example: file:///home/[username]/Desktop/[project]/files/assets/home/ball.swf * Cache.get() its basically a Dictionary where I store all the externally loaded files using the url as keys */ var mc : DisplayObject = Cache.get( node.@src ); var pathArray : Array = String( node.@src ).split( "/" ); var filename : String = String( pathArray[ pathArray.length - 1 ] ).split( "." )[0]; if ( mc.loaderInfo.applicationDomain.hasDefinition( filename )) mc = new ( mc.loaderInfo.applicationDomain.getDefinition( filename ))();
mc is now a clean duplication (as far as I know) of the original class. In my setup I expect the element that I want to be duplicated be named with the exact name as its container's filename (.swf), which is perfect for FlexSDK compiled stuff, but need some teaching for Flash IDE.
This is, of course, compatible with any kind of Object (not only MovieClips/Sprites/DisplayObjects)...
This doesn't really make that much sense to me. What if the movieClip is not in a separate file? Like if it's a Library item, or it was created from code?
January 5th 2009, Sixer
Then you would use Senocular's way. But if your MovieClip is in a separate file, or you have it accessible on your local library, you can use this way.
I have written an indepth article on how to do it in this method.
http://darylteo.com/blog/2007/11/16/abstracting-assets-from-actionscript-in-as30-asset-libraries/
Hope that helps.
Cheers
Daryl
http://darylteo.com/blog/2007/11/16/abstracting-assets-from-actionscript-in-as30-asset-libraries/
Hope that helps.
Cheers
Daryl
I've been experiencing similar issues while using Senocular's method in AIR as well, Mr. Doob. For exampl,e with a movieclip, a new instance from it's base constructor results in "0" total frames.
I will try your method, but I'm using BulkLoader so I may have to hack some stuff up.
I will try your method, but I'm using BulkLoader so I may have to hack some stuff up.
hi!!
please can u upload a tutorial on these topics..
1.drag and duplicate what was dragged.
2.capturing sound microphone and video thru camera
it would be really helpful.
thanx a lot!
please can u upload a tutorial on these topics..
1.drag and duplicate what was dragged.
2.capturing sound microphone and video thru camera
it would be really helpful.
thanx a lot!
I'm afraid I don't do tutorials on request :P
someone?
I have been a onlooker here for sometime now. I didnt want to post until I was able to give back just as I have recieved from here. During the hard time
of the economy today I felt obligated to share with you how I have made it the past 6 months. Now I know this really has nothing to do with this site but as we all know
we each need tomake money and survive ourselves. Furthermore I wanted to share a site with you that can easily help you as it has helped me. In the past 6 months
I have been learning Internet Marketing techniques from using Blackhat and WhiteHat stratigies.
With these techniques I have been able to quit my job and focus just my time to internet marketing and now am making arounf $400 a day. My goal in the next 2 months is to beable to make $1k a day.
If it wasnt for this site http://www.InternetMarketersforum.com None of this would have happened. If your down and out and needing to make some online I suggest you check out this site.
If you join the site then you will ba able to see many more private methods to making anything from $100 a day all the way up to $1000's daily. It just takes a little work on your part but in the end these methods truly work
of the economy today I felt obligated to share with you how I have made it the past 6 months. Now I know this really has nothing to do with this site but as we all know
we each need tomake money and survive ourselves. Furthermore I wanted to share a site with you that can easily help you as it has helped me. In the past 6 months
I have been learning Internet Marketing techniques from using Blackhat and WhiteHat stratigies.
With these techniques I have been able to quit my job and focus just my time to internet marketing and now am making arounf $400 a day. My goal in the next 2 months is to beable to make $1k a day.
If it wasnt for this site http://www.InternetMarketersforum.com None of this would have happened. If your down and out and needing to make some online I suggest you check out this site.
If you join the site then you will ba able to see many more private methods to making anything from $100 a day all the way up to $1000's daily. It just takes a little work on your part but in the end these methods truly work
Have your say!
*profile

traditional id: Ricardo Cabello Miguel
based in: London, UK
more: github, twitter, twitpic, soundcloud and flattr
*post nav
Wonderfl: coding + compiling Actionscript inside the browser
Google's Native Client
Yet another webcam effect: LSD
Let the Mass Migration Begin!
HTML5 <video> test
DuplicateMovieClip with AS3 (not Senocular's way)
Sunrise
Showcase is back, now in Javascript
Zeh's Fnk
Lupen III (Italian Opening) VS Captain Tsubasa (Spanish Opening)
Duuuuude!
*latest comments
Merry Xmas
Multiuser Sketchpad
Multiuser Sketchpad
Or so they say... (javascript demo)
Multiuser Sketchpad
Or so they say... (javascript demo)
Or so they say... (javascript demo)
Or so they say... (javascript demo)
Or so they say... (javascript demo)
Harmony