Some help with ActionScript 3.0

  • brittagyrl
  • Novice
  • Novice
  • User avatar
  • Posts: 32
  • Loc: Ogden, Utah

Post 3+ Months Ago

Hi There,

Back again with more questions that probably seem pretty simple to you guys, but I need some help. I just barely got started using Actionscripts and I'm using Flash CS5, so I'm by default in the 3.0 version. If this would be easier using 2.0 please let me know. I'm creating a FLA file where two Images are going to pan across the screen, one after another and also have text over the top of it.

My first transition is working great, but I have no idea how to make the second one pan in after the first image has transition. How do I get it to start AFTER the first one? I used to just use the Timeline and Tweens, but the Motion Tween was far too shakey, so I switched to ActionScripts and now I'm confused.

This is the Code I'm using to make the Image (Instance name School_mc) to move Horizontally Across the Stage:


import fl.transitions.Tween;
import fl.transitions.easing.*;

//1.
var myTween:Tween = new Tween(School_mc, "x", Regular.easeOut, -200, 0, 20, true);

import fl.transitions.*;
import fl.transitions.easing.*;

TransitionManager.start(School_mc, {type:Fade, direction:Transition<dot>IN, duration:9, easing:Strong.easeOut});



Is there a way to tell it to start at a certain frame and end at a certain frame and then get the second pic to start where the first one ends?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

uhmmm, i`m amazed no one answered to this question and also that you don't read the help for the Tween class.
Anyway, this is a simple to implement multi tween which start one after another. No comment offered, hope you understand what i did there.
Code: [ Select ]
var myTween:Tween;
var step:int = 0;
tweenFinish(null);

function tweenFinish(evt:TweenEvent)
{
    if (myTween != null)
        myTween.removeEventListener(TweenEvent.MOTION_FINISH, tweenFinish);

    switch (step)
    {
        case 0:
            myTween = new Tween(mc1, "x", Regular.easeOut, -2, 120, 4, true);
            break;
        case 1:
            myTween = new Tween(mc1, "alpha", Regular.easeOut, 1, 0, 2, true);
            break;
        case 2:
            myTween = new Tween(mc2, "x", Regular.easeIn, 10, 150, 4, true);
            break;
        case 3:
            myTween = new Tween(mc2, "alpha", Regular.easeIn, 1, 0, 2, true);
            break;            
    }
    if (step < 3)
        myTween.addEventListener(TweenEvent.MOTION_FINISH, tweenFinish);
    step++;
}
  1. var myTween:Tween;
  2. var step:int = 0;
  3. tweenFinish(null);
  4. function tweenFinish(evt:TweenEvent)
  5. {
  6.     if (myTween != null)
  7.         myTween.removeEventListener(TweenEvent.MOTION_FINISH, tweenFinish);
  8.     switch (step)
  9.     {
  10.         case 0:
  11.             myTween = new Tween(mc1, "x", Regular.easeOut, -2, 120, 4, true);
  12.             break;
  13.         case 1:
  14.             myTween = new Tween(mc1, "alpha", Regular.easeOut, 1, 0, 2, true);
  15.             break;
  16.         case 2:
  17.             myTween = new Tween(mc2, "x", Regular.easeIn, 10, 150, 4, true);
  18.             break;
  19.         case 3:
  20.             myTween = new Tween(mc2, "alpha", Regular.easeIn, 1, 0, 2, true);
  21.             break;            
  22.     }
  23.     if (step < 3)
  24.         myTween.addEventListener(TweenEvent.MOTION_FINISH, tweenFinish);
  25.     step++;
  26. }

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 15 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.