Lynda.com - AS3 - Using a loop to generate instances of a class


/ Published in: ActionScript 3
Save to your folder(s)

Used to place instances of symbols onto stage with AS


Copy this code and paste it in your HTML
  1. var boarder:mcBoarder;
  2. var boarderX:Number = 127;
  3. var boarderY:Number = 271;
  4. var boarderR:Number = 0;
  5.  
  6. for(var i:Number = 0; i < 6; i++)
  7. {
  8. boarder = new mcBoarder();
  9. addChild(boarder);
  10. boarder.x = i * 75;
  11. boarder.x = boarderX;
  12. boarder.y = boarderY;
  13. boarderY -= 75;
  14. boarderX += 75;
  15. boarderR -= 45;
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.