A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Attach sprites using TweenLite

Hybrid View

  1. #1
    the Programmer
    Join Date
    Sep 2009
    Location
    Australia
    Posts
    2

    Lightbulb Attach sprites using TweenLite

    I'm creating visual effects using TweenLite, which currently only manages the tweens for me, can I also attach a sprite at a specific time? (using "delay")

    Basically I want to use TweenLite to attach/remove sprites apart from just tweening existing objects.

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    If you simply want to add a child after a certain amount of time, use a Timer object.
    Actionscript Code:
    public var delay:int = 3000; // 3 seconds
    public var repeats:int = 1; // run one time
    public var myTimer:Timer = new Timer(delay, repeats);
    myTimer.addEventListener(TimerEvent.TIMER, onTimer);
    public function onTimer(e:TimerEvent):void{
      // do something
    }
    myTimer.start();

    If you need to respond to a tween finishing, use TweenLite's onComplete object prop.

    Actionscript Code:
    TweenLite.to(myClip, 1, {x:20, y:20, onComplete:myCompleteFunction});
    public function myCompleteFunction():void{
      // do something
    }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center