flash on 2012-9-22
/**
* Copyright TmskSt ( http://wonderfl.net/user/TmskSt )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/jRuh
*/
package {
import flash.display.Sprite;
import flash.events.Event;
import net.hires.debug.Stats;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.tweens.ITween;
public class FlashTest extends Sprite {
private var note:Note;
private var note2:Note;
private var dy:Number;
private var dp:Number;
private var stats:Stats;
public function FlashTest() {
// write as3 code here..
if (stage) added(null);
else addEventListener(Event.ADDED_TO_STAGE, added);
}
private function added(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, added);
//F6.063450701242349
//0.8285710971428571
stage.frameRate = 60;
dy = 6.063450701242349;
dp = 0.016;
stats = new Stats();
addChild(stats);
note = new Note();
note.x = 100;
addChild(note);
note2 = new Note();
note2.x = 150;
addChild(note2);
var t:ITween = BetweenAS3.tween(note2, { y : 314 }, { y : 0 }, 0.8285710971428571);
t.stopOnComplete = false;
t.play();
stage.addEventListener(Event.ENTER_FRAME, enterFrame);
}
private function enterFrame(e:Event):void {
note.y += dy;
if (note.y > 314) note.y = 0;
}
}
}
import flash.display.Shape;
class Note extends Shape {
public function Note() {
this.graphics.beginFill(0xFF0000);
this.graphics.drawRect(0, 0, 20, 6);
this.graphics.endFill();
x = 0;
y = 0;
pos = 0;
}
public var pos:Number;
}