Skip to main content
Participant
March 25, 2015
Question

Can't access the arrays in object

  • March 25, 2015
  • 1 reply
  • 292 views

Hey I realise probably it's silly question, but I can't manage to access these arrays for example `__motion_Door_8.addPropertyArray("x", [0]);`. I want to access them so I could reverse the array and have my animation playing reversed, but I simply couldn't access them

__motion_Door_8.x
__motion_Door_8["x"]

none of the ways worked and it returned me an error that such a properties do not exist.

public function rotationDoor(instName:DisplayObject, times:int, reversed:Boolean):void{

       var __motion_Door_8:MotionBase;

       if(__motion_Door_8 == null) {

            __motion_Door_8 = new MotionBase();

           __motion_Door_8.duration = 37;

            // __motion_Door_8.overrideTargetTransform();

            __motion_Door_8.addPropertyArray("x", [0]);

            __motion_Door_8.addPropertyArray("y", [0]);

            __motion_Door_8.addPropertyArray("scaleX", [1.000000]);

            __motion_Door_8.addPropertyArray("scaleY", [1.000000]);

            __motion_Door_8.addPropertyArray("skewX", [0]);

            __motion_Door_8.addPropertyArray("skewY", [0]);

            __motion_Door_8.addPropertyArray("z", [0]);

            __motion_Door_8.addPropertyArray("rotationX", [0]);

            __motion_Door_8.addPropertyArray("rotationY",             [0,1.11111,2.22222,3.33333,4.44444,5.55556,6.66667,7.77778,8.88889,10,11.1111,12.2222,13.3333,14.4444,15.5556,16.6667,17.7778,18.8889,20,21.1111,22.2222,23.3333,24.4444,25.5556,26.6667,27.7778,28.8889,30,31.1111,32.2222,33.3333,34.4444,35.5556,36.6667,37.7778,38.8889,40]);

            __motion_Door_8.addPropertyArray("rotationZ", [0]);

            __motion_Door_8.addPropertyArray("blendMode", ["normal"]);

            __motion_Door_8.addPropertyArray("cacheAsBitmap", [false]);

            __motion_Door_8.addPropertyArray("opaqueBackground", [null]);

            __motion_Door_8.addPropertyArray("visible", [true]);

            __animFactory_Door_8 = new AnimatorFactory3D(__motion_Door_8);

            __animFactory_Door_8.addTarget(instName, times);

       }

  }

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 25, 2015

__motion_Door_8 is a MotionBase instance:  use the MotionBase setValue method.

DriglouAuthor
Participant
March 25, 2015

hm, I found that there are setValue and getValue, but that works just for single frame value and what i want to do is reverse the values in this array, so it would start at 40 and finish to 0

__motion_Door_8.addPropertyArray("rotationY", [0,1.11111,2.22222,3.33333,4.44444,5.55556,6.66667,7.77778,8.88889,10,11.1111,12.2222,13.3333,14.4444,15.5556,16.6667,17.7778,18.8889,20,21.1111,22.2222,23.3333,24.4444,25.5556,26.6667,27.7778,28.8889,30,31.1111,32.2222,33.3333,34.4444,35.5556,36.6667,37.7778,38.8889,40]); 

kglad
Community Expert
Community Expert
March 25, 2015

i don't think you can change the start value, but:

var reverseA:Array = [0,1.11111,2.22222,3.33333,4.44444,5.55556,6.66667,7.77778,8.88889,10,11.1111,12.2222,13.3333,14.4444,15.5556,16.6667,17.7778,18.8889,20,21.1111,22.2222,23.3333,24.4444,25.5556,26.6667,27.7778,28.8889,30,31.1111,32.2222,33.3333,34.4444,35.5556,36.6667,37.7778,38.8889,40].reverse();


for(var i:int=1;i<reverseA.length;i++){

yourmotion.setValue(i,'rotationY',reverseA);

}