Salve ragazzi
ho una piccola domanda
io ho questo codice abbastanza semplice in as3
sto tentando in tutti i modi di trasformarlo in codice as2 ma con scarsi risultati...codice:stop(); const COLORS:Array = [0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFFFFFF00, 0xFF00FFFF] const SIDE:uint = 20 var data:BitmapData = new BitmapData(SIDE, SIDE) function start() { for (var i:uint = 0; i < SIDE; i++) { for (var j:uint = 0; j < SIDE; j++) { data.setPixel(i, j, COLORS[int(Math.random() * COLORS.length)]) trace(data) } } txtBest.text = String(Math.min(int(txtBest.text), int(txtScore.text)) || "999") txtScore.text = "0" } stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey) function onKey(e) { data.floodFill(0, 0, (COLORS[e.keyCode - ((e.keyCode < 96) ? 49 : 97)])) txtScore.text = String(int(txtScore.text) + 1) if ((new BitmapData(SIDE, SIDE, false, data.getPixel(0, 0))).threshold(data, data.rect, new Point(0,0), "==", data.getPixel(0, 0), 0, 0x00ffffff, true) == 400) start() } container.addChild(new Bitmap(data)) start()
mi potreste aiutare?
grazie

Rispondi quotando