Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can I reverse a tween created with the GUI ...with actionscript?

Contributor ,
Sep 28, 2013 Sep 28, 2013

Hi All,

I'm newer to Flash so don't take much for granted. I have big gaps in my understanding.

I've created a motion tween (by right clickingon a movieClip on the timeline and choosing 'create motion tween'). Now I want to reverse it (using the 'yoyo' term) when the sound file is done playing. I know how to do this with a tween (using tween class) that was created with actionscript in the first place. How can I cause it to reverse if the tween isn't already (named and included) my actionscript?

Thanks

TOPICS
ActionScript
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Sep 28, 2013 Sep 28, 2013

If you tween is in a MovieClip you can effectively play the MovieClip backwards like this:

addEventListener(Event.ENTER_FRAME, enterFrame);

function enterFrame(e:Event):void {

      prevFrame();

}

I do this all the time.

-Aaron

Translate
Engaged ,
Sep 28, 2013 Sep 28, 2013

If you tween is in a MovieClip you can effectively play the MovieClip backwards like this:

addEventListener(Event.ENTER_FRAME, enterFrame);

function enterFrame(e:Event):void {

      prevFrame();

}

I do this all the time.

-Aaron

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 28, 2013 Sep 28, 2013

Thanks for your reply, Aaron.

How do I use that? (IOW: Where do I put that script?, How do I indicate the name of the movie clip it's controlling?)

So, for example: I'm starting the tween in my movie clip by making it visible (its an image that fades up because it's alpha state is tweened) : "myMovieClip.visible = true"

When that  image completely fades up, the image stays visible (100% of alpha state) for an indetermined amount of time then, I want a soundtrack cue to cause it to fade back down (tween back to 0% alpha).

This just happens once (not repeatedly).

Any help is appreciated.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 29, 2013 Sep 29, 2013

Ok I realized that I put that in the frame script.

Thanks Aaron.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 29, 2013 Sep 29, 2013

Now I just need to play that movie clip backwards when the sound file reaches a certain point. (I have already used a cuePoint in the sound file to make that movie clip to play forward).

IOW:

The script you sent:

addEventListener(Event.ENTER_FRAME, enterFrame);
function enterFrame(e:Event):void {
      prevFrame();
}

..is in the frame script of the movie clip and it causes the movie to reverse as soon as it played forward to the end. How do I get it to only go in reverse upon cue?

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 30, 2013 Sep 30, 2013

What I would probably do is put that play-backwards in a function, something like this:

function playBackwards():void {

     addEventListener(Event.ENTER_FRAME, enterFrame);

}

Then you can give the MovieClip an instance name and call the playBackwards function from the parent:

myMovieClip.playBackwards();

- Aaron

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 03, 2013 Oct 03, 2013

Aaron,

You're probably assuming I know a lot more than I do. I'm getting this error: " TypeError: Error #1006: playBackwards is not a function. at reverseDissolve_fla::"

This is my action script in frame one of the main timeline:

// On Cue Point
function onCuePoint(event:CuePointEvent):void

{
    //This looks for only that cue point and takes action.
    if (event.name == "dissolveUp")
      {
         faceOne_MC.visible = true;
         faceOne_MC.play();// Makes the movie clip play (dissolves up using a tween).
      }

if (event.name == "dissolveDown")
     {
        //now I need to dissolve down when she says "wanted" by playing the faceOne_MC in reverse
        faceOne_MC.playBackwards();
     }
}




function playBackwards():void
{
     addEventListener(Event.ENTER_FRAME, enterFrame);
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 03, 2013 Oct 03, 2013
LATEST

hold on. Ok I just realized that the

function playBackwards():void
{

addEventListener(Event.ENTER_FRAME, enterFrame);

}

function enterFrame(e:Event):void {
      prevFrame();
}

...goes in the frame script at the end of the dissolve in the movie clip.

Thanks much Aaron!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines