flash on 2010-9-23
Spriteクラスのwidthを勘違いしていた
♥0 |
Line 39 |
Modified 2010-09-23 12:00:22 |
MIT License
archived:2017-03-20 05:37:09
ActionScript3 source code
/**
* Copyright enecre ( http://wonderfl.net/user/enecre )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6R59
*/
// Spriteクラスのwidthを勘違いしていた
package {
import flash.text.TextField;
import flash.display.Sprite;
import caurina.transitions.Tweener;
public class FlashTest extends Sprite {
private var tf:TextField;
public function FlashTest() {
// write as3 code here..
tf = new TextField();
tf.width = 465;
tf.height = 465;
addChild(tf);
var sp:Sprite = new Sprite();
sp.x = 200;
addChild(sp);
tr(sp.width);
var rect1:Rect = new Rect(100, 200, 0xaaffaa);
var rect2:Rect = new Rect(40, 200, 0xaaaaff);
sp.addChild(rect1);
sp.addChild(rect2);
tr(sp.width);
//Tweener.addTween(sp, {width: 80, time: 1.0});
sp.removeChild(rect1);
tr(sp.width);
}
private function tr(...o):void{
tf.appendText(o + "\n");
tf.scrollV = tf.maxScrollV;
}
}
}
import flash.display.Graphics;
import flash.display.Shape;
class Rect extends Shape{
function Rect(w:int, h:int, color:int):void{
var g:Graphics = graphics;
g.beginFill(color);
g.drawRect(0,0,w,h);
g.endFill();
}
}