forked from: Chapter 6 Example 1
forked from Chapter 6 Example 1 (diff: 86)
let's see this example which contains some code from bigfish's flash on 2010-3-23 (to allow trace() to work) and code from the ActionScript 3.0 Tween class example code in the API for the Tween class which I altered somewhat for this example.
ActionScript3 source code
/**
* Copyright monkeyscantcry ( http://wonderfl.net/user/monkeyscantcry )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/kO73
*/
package {
import flash.display.Sprite;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.*;
import flash.text.*;
import flash.ui.*;
public class Output extends Sprite {
public var dot_a:Sprite = new Sprite();
public var dot_b:Sprite = new Sprite();
public var dot_c:Sprite = new Sprite();
public var dot_d:Sprite = new Sprite();
public var quest:Sprite = new Sprite();
public var questNeg:Sprite = new Sprite();
public function Output() {
dot_a.graphics.beginFill(0x000000);
dot_a.graphics.drawCircle(50, 200, 15);
dot_a.graphics.endFill();
addChild(dot_a);
var tweenFa:Tween = new Tween(dot_a, "alpha", None.easeNone, 0, 1, 1, true);
tweenFa.addEventListener(TweenEvent.MOTION_FINISH, secondDot);
}
public function secondDot(e:TweenEvent):void {
dot_b.graphics.beginFill(0x000000);
dot_b.graphics.drawCircle(50, 200, 15);
dot_b.graphics.endFill();
addChild(dot_b);
var tweenFb:Tween = new Tween(dot_b, "alpha", None.easeNone, 0, 1, 0.5, true);
var tween_b:Tween = new Tween(dot_b, "x", None.easeNone, 0, 50, 1, true);
tween_b.addEventListener(TweenEvent.MOTION_FINISH, thirdDot);
}
public function thirdDot(e:TweenEvent):void {
dot_c.graphics.beginFill(0x000000);
dot_c.graphics.drawCircle(50, 200, 15);
dot_c.graphics.endFill();
addChild(dot_c);
var tweenFc:Tween = new Tween(dot_c, "alpha", None.easeNone, 0, 1, 0.5, true);
var tween_c:Tween = new Tween(dot_c, "x", None.easeNone, 50, 100, 1, true);
var stall:Tween = new Tween(dot_b, "x", None.easeNone, 50, 50, 2.5, true);
stall.addEventListener(TweenEvent.MOTION_FINISH, fourthDot);
}
public function fourthDot(e:TweenEvent):void {
dot_d.graphics.beginFill(0x000000);
dot_d.graphics.drawCircle(50, 200, 15);
dot_d.graphics.endFill();
addChild(dot_d);
var tweenFd:Tween = new Tween(dot_d, "alpha", None.easeNone, 0, 1, 0.1, true);
var tween_d:Tween = new Tween(dot_d, "x", None.easeNone, 100, 150, 0.25, true);
tween_d.addEventListener(TweenEvent.MOTION_FINISH, nextPart);
}
public function nextPart(e:TweenEvent):void {
quest.graphics.beginFill(0x000000);
quest.graphics.drawCircle(200, 105, 45);
quest.graphics.endFill();
quest.graphics.beginFill(0x000000);
quest.graphics.drawRect(190, 140, 20, 25);
quest.graphics.endFill();
questNeg.graphics.beginFill(0xFFFFFF);
questNeg.graphics.drawCircle(200, 110, 25);
questNeg.graphics.endFill();
questNeg.graphics.beginFill(0xFFFFFF);
questNeg.graphics.drawRect(150, 105, 40, 50);
questNeg.graphics.drawRect(190, 110, 5, 25);
addChild(quest);
addChild(questNeg);
var questFade:Tween = new Tween(quest, "alpha", None.easeNone, 0, 1, 0.1, true);
}
}
}