View Full Version : assigning property to a class?

10-24-2003, 03:41 AM

I wounder if it's posible to add properties to a class long time after it has been created? I don't want to add the properties to the object of that class but to the class itselfe!

Is it posble and if so, how can I do it?

10-24-2003, 05:38 AM
do u mean at runtime? in that case flash is not explicit about interface definitions and just assigning a property to the call and giving it a value would suffice.
if u mean at designtime, just go and alter the code :D

seriously now. any object value in flash can be assigned a property at runtime without any problems.

10-24-2003, 09:09 AM
Thanks, but I didn't want to edit the property of the object, I wanted to edit the property of a class.

And I wanted to do it at runtime.

I solved it with a static Object and I then assigned the property to it and then it was assigned to all the objects. =)

10-24-2003, 10:30 AM
define the class to be "dynamic" and you will be able to add methods or properties during runtime.

dynamic class className { ...etc

Alternatively, you could also use associative array syntax which wont cause a compiler error

classInstance["newThing"] = anything;

10-24-2003, 10:34 AM
so it is only 4 the compiler indeed.

10-24-2003, 10:36 AM
indeed :D

10-24-2003, 10:38 AM
kinda defeats he point of the new "tighter" compiler though. but then again it was a pain in the b**t

10-24-2003, 10:44 AM
Yeah it helps though only through restricting you from doing what you're use to doing.... even though in the process it doesn't stick to its guns enough to make you have much faith in its ability to do just that - the [] example showing this

10-24-2003, 10:58 AM
and the fact that you can hack it by simply going this. seems that the guys are still writing pretty inane compilers...