On 9/6/07, Mendelsohn, Michael <[EMAIL PROTECTED]> wrote:
> Just as I suspected, Julian.  Thanks for your reply.  Doesn't this
> feature exist in AS3?  (I have no experience with it yet.)

As I recall, duplication in AS2 wasn't really duplication--just
instantiation of the same symbol and its associated class. In AS3 you
can do the same thing a bit differently:

import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;

function duplicateDisplayObject(original:DisplayObject,
parent:DisplayObjectContainer, name:String):DisplayObject {
    var originalClass:Class =
getDefinitionByName(getQualifiedClassName(original));
    var duplicate:DisplayObject = new originalClass() as DisplayObject;
    duplicate.name = name;
    parent.addChild(duplicate);
    return duplicate;
}

NOTE: I haven't tested this.
-- 
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
--
The Dinosauricon: http://dino.lm.com
Parry & Carney: http://parryandcarney.com
ISPN Forum: http://www.phylonames.org/forum/
_______________________________________________
[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