In my application framework, we are trying to update a dynamic class
instantiation method created using backward compatible AS1 conventions and
implemented in ActionScript 2. Our architecture is being upgraded to
ActionScript3 and we'd like to keep this custom method if we can. We
originally used the prototype convention and __proto__ system to handle
this. This is what the original code looks like:

this.__proto__ = UIObject.prototype;

private var _availDepth:Number = 0;

public function attachUIObject(n:String, c:Function, p:Object):UIObject {
       var s:String = (c != undefined) ? c.symbolName : UIObject.symbolName
;
       var u = this.attachMovie(s, n, _availDepth++);
       return u;
   }

n is the instance name of the object, c is the Class name (defined as a
function) and p is an array of custom properties (like x,y,height, width,
etc). This works very well in that we can just drop a number of these in a
class and get objects created and pass properties to them simply and
elegantly.

Now, in ActionScript 3, the prototype convention is deprecated and not
implemented the same way and the __proto__ keyword is gone. I've looked at
making a wrapper for the addChild() method of DisplayObjectContainer as a
way to accomplish this, but so far I'm seeing a way to define a symbol name
for my objects when instantiating. Since attachMovie isn't an option
anymore, I'm trying to see a way to make this happen. I don't see any easy
way to dynamically name an instance and pass it as a child nor access Anyone
run into a similar problem and have a potential solution?

-Jeff


--
Jeff Fox
[EMAIL PROTECTED]
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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