1 Reply Latest reply: Sep 15, 2009 1:08 PM by Ned Murphy RSS

    Putting objects(Instance Names) Into an Array in Flash CS4

    Me2LoveIt2 Community Member

      I worked again on a new Project and stumbled while trying Arrays.

       


      I have two cubes(cube_mc, cube2_mc) in my scene.

       

      My code:

       

      Code:
      var gy:Number = 0;
      var gravity:Number = .2 
      var moving:Array = new Array(cube_mc, cube2_mc);
      
      this.addEventListener(Event.ENTER_FRAME, gravityFUNC);
      function gravityFUNC(event:Event):void{
           gy+=gravity; 
           moving.y+=gy;
      };

       

      I was trying to put both cubes into the array,

       

      and then affecting the whole Array with gravity.

       


      When I test it nothing happens, and it shows no errors.

       

      Does anyone know what I am doing wrong?

       

      -Thanks in advance