[Flashcoders] Adding a property to an AS3-component

2009-01-24 Thread Alexander Farber
Hello, is it actually possible to add a new property to an AS3-component, like button? I try: import fl.controls.Button; var button:Button = new Button(); button['old_item'] = 42; //button.old_item = 42; addChild(button); but get the run-time error: ReferenceError: Error #1056:

RE: [Flashcoders] Adding a property to an AS3-component

2009-01-24 Thread Cor
You can edit the components class. But I always put my objects in arrays. So you can do this: var arrButtons:Array = []; var button:Button = new Button(); arrButtons.push(button); arrButtons[0].old_item = 42; addChild(button); HTH Cor ___

Re: [Flashcoders] Adding a property to an AS3-component

2009-01-24 Thread Dave Watts
is it actually possible to add a new property to an AS3-component, like button? In AS3, classes will only allow this if they're dynamic classes, and most classes aren't dynamic. You could, however, write a new class to extend Button. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/