flash on 2009-12-15
/**
* Copyright akisute ( http://wonderfl.net/user/akisute )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/xDXZ
*/
package {
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.display.Sprite;
public class FlashTest extends Sprite {
private var rows:uint = 8;
private var columns:uint = 12;
private var d:Number = 5.0;
private var w:Number = (stage.stageWidth-d)/rows-d;
private var h:Number = (stage.stageHeight-d)/columns-d;
public function FlashTest() {
for (var i:uint=0; i<columns; i++) {
for (var j:uint=0; j<rows; j++) {
var sprite:Sprite = new Sprite();
var fillColor:uint = 0xFFFFFF * Math.random();
sprite.graphics.beginFill(fillColor);
sprite.graphics.drawRect(0,0,w,h);
sprite.graphics.endFill();
sprite.x = d+(w+d)*j;
sprite.y = d+(h+d)*i;
sprite.addEventListener(MouseEvent.MOUSE_OVER, this.pulseRectangle);
this.addChild(sprite);
}
}
trace("abesix");
//var text:TextField = new TextField();
//text.text = 'StageWidth/Height = ' + stage.stageWidth + ' / ' + stage.stageHeight;
//text.width = 600;
//this.addChild(text);
//var text2:TextField = new TextField();
//text2.text = w.toString() + ' / ' + h.toString();
//text2.width = 600;
//text2.y = 20;
//this.addChild(text2);
}
private function pulseRectangle(event:MouseEvent):void {
var sprite:Sprite = event.target as Sprite;
var twScaleX:Tween = new Tween(sprite, "scaleX", Elastic.easeOut, 0.8, 1, 1, true);
var twScaleY:Tween = new Tween(sprite, "scaleY", Elastic.easeOut, 0.8, 1, 1, true);
}
}
}