Isometric Box

Actionscript:
  1. stage.frameRate = 30;
  2.  
  3. for (var i:int = 0; i<100; i++){
  4.     makeBoxSegment(200, 200 - i, i * 2);
  5. }
  6.  
  7. function makeBoxSegment(xp:Number, yp:Number, col:uint):Sprite {
  8.     var isoBox:Sprite = Sprite(addChild(new Sprite()));
  9.     with (isoBox) scaleY = .5, y = yp, x = xp;
  10.     var box:Shape = Shape(isoBox.addChild(new Shape()));
  11.     box.rotation = 45;
  12.     with (box.graphics) beginFill(col), drawRect(-50,-50,100,100);
  13.     isoBox.addEventListener(Event.ENTER_FRAME, onRotate);
  14.     return isoBox;
  15. }
  16.  
  17. function onRotate(evt:Event):void {
  18.     evt.currentTarget.getChildAt(0).rotation = mouseX;
  19. }

An isometric box that rotates with the mouseX.

This entry was posted in DisplayObject, Graphics and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Posted September 1, 2009 at 4:21 am | Permalink

    why there is no “DRAWING”

  2. Posted September 1, 2009 at 4:35 am | Permalink

    your just supposed to copy and paste it on the timeline…. but I put this one on wonderfl:

    http://wonderfl.net/code/b523b65bbe414a991ce5ed97caf2aa78e2fcd012

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*