Menu

Problem with Array Scaling

Help
alex
2006-01-31
2013-04-01
  • alex

    alex - 2006-01-31

    I tried to copy one of your examples, this one in particular:

    var target:Line = new Line(500,0,500,98.5);
    target.draw();
               
    var squares:Array = new Array();
    for (var i:Number = 0; i<50; i++) {
    var x:Number = Math.random() 300;
    var w:Number = Math.random() 300;
                   
    var myRectangle:Rectangle = new Rectangle(0, i2, 100, 1);   
            myRectangle.setRegistrationPoint({x:0, y:0});
        myRectangle.lineStyle();
        myRectangle.draw();   
        myRectangle.movieclip._xscale = w;
        squares[i] = myRectangle.movieclip;
    }
               
    var myScale:Scale = new Scale(squares);
    myScale.setOptimizationMode(true);
    myScale.animationStyle(6000,Bounce.easeOut);
    myScale.run(500,squares[0]._yscale);

    But it reports a syntax error with these lines:
    var x:Number = Math.random() 300;
    var w:Number = Math.random() 300;

    I corrected the error by doing this:
    var x:Number = Math.random(300);
    var w:Number = Math.random(300);

    But now only one line is animated, not the 50 so lines.

    What obvious problem am I missing :)

    Thanks for the help

     
    • Alex Uhlmann

      Alex Uhlmann - 2006-02-01

      Hey Alex,

      your assumed correction is wrong. It's

      var x:Number = Math.random() * 300;
      var w:Number = Math.random() * 300;

      My documentation tool did not output the mulitplication character. (I should have encoded it, but didn't)

      Best,
      Alex

       
    • alex

      alex - 2006-02-01

      Excellent thanks alot :)
      Works perfectly.

      Alex

       

Log in to post a comment.