Hey everyone,
I can't seem to figure out how to duplicate a sprite in AS3. Thanks to various tutorials online, I got so far as to take the constructor of the sprite I want to duplicate and instantiate a new one.

           var targetClass:Class = (stamp as Object).constructor;
           mStamp = new targetClass() as Sprite;

This works in normal situations. However, the sprite I'm getting are SWF's loaded at runtime. If I trace a normal asset's constructor it will trace as [Object myasset], but no matter what I do, my externally loaded SWF's constructors all trace as [Object MovieClip] or [Object AVM1Movie]. So of course creating a new instance of the constructor will result in a blank, fresh-made movieclip. Basically my external SWFs are just some graphics on stage in one frame. I've tried setting the document class, and publishing as Flash 8, 9, Actionscript 2, Actionscript 3, and nothing changes. I'm not using Flash CS3 yet, just the AS3 Alpha for making assets and then compiling with Flex 2 SDK.

Anyone?
Thanks!
ben
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to