Insert new properties or variables on objects

Software: Away3D 4.x

maricate, Jr. Member
Posted: 31 May 2013 12:11 AM   Total Posts: 36

Sorry if someone already posted, but not found.
Is there any way to insert new properties / variables in Mesh, ObjectContainer3D, Cameras, Views, Scenes ...?
For example, I would like to save the last position of an object within itself.
Similarly to what is possible with MovieClips.

Example:
anyObjectContainer3D.lastPositionX=0.2;

Tks!

   

aeki, Member
Posted: 31 May 2013 01:09 PM   Total Posts: 73   [ # 1 ]

Away3D is an FOOS projet, you can add any feature you’d like to the library!

   

maricate, Jr. Member
Posted: 31 May 2013 05:39 PM   Total Posts: 36   [ # 2 ]

Sorry but do not understand what you meant.
I know I could correlate the object name with an index of an array, but rather would like to know if there is any way to store variables within objects.

   

maricate, Jr. Member
Posted: 04 June 2013 09:58 PM   Total Posts: 36   [ # 3 ]

There is no how to do?

   

Kyriakos, Newbie
Posted: 04 June 2013 10:45 PM   Total Posts: 4   [ # 4 ]

You can overload the class of the object you want to create and add additional properties like any other OO language. Am I wrong?

   

maricate, Jr. Member
Posted: 04 June 2013 11:02 PM   Total Posts: 36   [ # 5 ]
Kyriakos - 04 June 2013 10:45 PM

You can overload the class of the object you want to create and add additional properties like any other OO language. Am I wrong?

How?
I dont want to modify AWAY originals files (this is the last option).
I know how to correlate the name with a array… and in this array I push properties.
But if I can put variables directly on objects, this will more easy.

   

Kyriakos, Newbie
Posted: 04 June 2013 11:45 PM   Total Posts: 4   [ # 6 ]

You dont modify any files. Read about the “extends” directive in Action Script 3 and you ll see how to put additional properties on an object by extending/overloading that object’s class.

   

maricate, Jr. Member
Posted: 05 June 2013 05:45 PM   Total Posts: 36   [ # 7 ]
Kyriakos - 04 June 2013 11:45 PM

You dont modify any files. Read about the “extends” directive in Action Script 3 and you ll see how to put additional properties on an object by extending/overloading that object’s class.

Tks Kyriakos, I will try!

   

Pierce, Jr. Member
Posted: 07 June 2013 06:20 PM   Total Posts: 40   [ # 8 ]

You can also use prototype objects to add functionality without creating a new class, but if the class of the object whose prototype object you are accessing is not dynamic, then you must be sure to disable strict mode on your compiler. It’s ~technically~ not best practice, but it can save you a bit of the grunt work associated with creating a new class. It’s just an alternative route to the same goal, really. If you’re unfamiliar with prototyping just read from the documentation for the Object class, here:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Object.html

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X