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

2009-01-26 Thread Alexander Farber
Thanks Dave, I've read up on it and understand this now. Too bad Flash docs do not mention which class is dynamic Regards Alex On Sat, Jan 24, 2009 at 6:14 PM, Dave Watts dwa...@figleaf.com wrote: is it actually possible to add a new property to an AS3-component, like button? In AS3,

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

2009-01-26 Thread Ian Thomas
On Mon, Jan 26, 2009 at 9:00 AM, Alexander Farber alexander.far...@gmail.com wrote: Thanks Dave, I've read up on it and understand this now. Too bad Flash docs do not mention which class is dynamic At the top of the documentation page:

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

2009-01-25 Thread jonathan howe
Seems like Cor's Array solution would make it through the compiler but would still throw a runtime error, right? I would much more strongly recommend the extending solution that Dave suggests. On Sat, Jan 24, 2009 at 12:14 PM, Dave Watts dwa...@figleaf.com wrote: is it actually possible to add

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

2009-01-25 Thread Cor
Of jonathan howe Sent: zondag 25 januari 2009 14:33 To: Flash Coders List Subject: Re: [Flashcoders] Adding a property to an AS3-component Seems like Cor's Array solution would make it through the compiler but would still throw a runtime error, right? I would much more strongly recommend the extending

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

2009-01-25 Thread Cor
Here is the example: 1. create an new movieclip and put a rectangle in as background 2. on top (or higher layer) put a dynamic textfield, give it an instance name of tf 3. give the movieclip in the library a linkage MyButton 4. paste this code in the first and only frame on the Main timeline!:

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

2009-01-25 Thread Cor
I forgot to mention what to do when testing: Mouse over 2 or 3 buttons and then click one of them. Notice in the trace the new custom property of every button is stored in the array. Kind regards, Cor ___ Flashcoders mailing list

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

2009-01-25 Thread Paul Andrews
...@chello.nl To: 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Sunday, January 25, 2009 1:44 PM Subject: RE: [Flashcoders] Adding a property to an AS3-component About the array, that works fine!! When you are into classes, that is preferable! If you want an example of how I do

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

2009-01-25 Thread Cor
...@chattyfig.figleaf.com] On Behalf Of Paul Andrews Sent: zondag 25 januari 2009 15:54 To: Flash Coders List Subject: Re: [Flashcoders] Adding a property to an AS3-component The array is just handling objects, so you lose the protection that having known classes gives you. There are occassions when having

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

2009-01-25 Thread Paul Andrews
- From: Cor c...@chello.nl To: 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Sunday, January 25, 2009 3:15 PM Subject: RE: [Flashcoders] Adding a property to an AS3-component As said before: I completely agree and you should use classes. But I thought the questioner

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

2009-01-25 Thread Cor
- Original Message - From: Cor c...@chello.nl To: 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Sunday, January 25, 2009 3:15 PM Subject: RE: [Flashcoders] Adding a property to an AS3-component As said before: I completely agree and you should use classes. But I thought

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

2009-01-25 Thread Muzak
To: 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Sunday, January 25, 2009 3:11 PM Subject: RE: [Flashcoders] Adding a property to an AS3-component Here is the example: 1. create an new movieclip and put a rectangle in as background 2. on top (or higher layer) put a dynamic textfield, give

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

2009-01-25 Thread Cor
M OK, my bad. Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Muzak Sent: zondag 25 januari 2009 19:36 To: Flash Coders List Subject: Re: [Flashcoders] Adding a property to an AS3-component

[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/