Created
September 7, 2013 00:10
-
-
Save prettymuchbryce/6471566 to your computer and use it in GitHub Desktop.
Haxe bug (HTML5/Javascript target)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import flash.display.BitmapData; | |
import flash.display.Bitmap; | |
import flash.display.Sprite; | |
import flash.events.Event; | |
class Main extends Sprite { | |
private var _bitmaps:Array<Dynamic>; | |
public function new () { | |
super (); | |
_bitmaps = new Array<Dynamic>(); | |
for (i in 0...100) { | |
var bitmapData:BitmapData = new BitmapData(40, 40, false, Std.int (Math.random () * 0xFFFFFF)); | |
var bitmap:Bitmap = new Bitmap(bitmapData); | |
bitmap.x = Math.random()*640; | |
bitmap.y = Math.random()*480; | |
addChild(bitmap); | |
_bitmaps.push(bitmap); | |
} | |
stage.addEventListener(Event.ENTER_FRAME, onEnterframe); | |
trace(_bitmaps[0]); | |
} | |
private function onEnterframe(event:Event):Void { | |
for (i in 0..._bitmaps.length) { | |
cast(_bitmaps[i], Bitmap).x++; | |
_bitmaps[i].nmeY++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment