Jump to content
Search Community

How to move a movie clip continuosly towards up?

learner_7n test
Moderator Tag

Recommended Posts

Hi,

 

How can I move my movie clip continuosly towards up? The following code works for To & Fro animation, but not always up direction once it is complete the timeline length.

 

var SideHeader:TweenMax = new TweenMax(SideHeader_mc, 5, {y:195, repeat:-1, yoyo:true});

 

 

Thanks.

Link to comment
Share on other sites

I tried the following code but it didn't work. No error but the Clip stays exactly where it was on the stage before publishing.\

 

import com.greensock.*; 
import com.greensock.easing.*;

function up():void
     {
        TweenMax.to(Clip_mc, 1, {y:Clip_mc.y + 10, ease:Linear.easeNone, onComplete:up});
     }

 

Further help, please.

Link to comment
Share on other sites

Thanks for the reply. Actually what I need is, when I click on SWF file the MovieClip_mc start moving from 600 bottom to top -100 and when it reaches to -100 the same clip come backs to 600 bottom and moves to top -100 so on.

 

Sorry for not clear description.

 

Regards.

Link to comment
Share on other sites

The same code will work, just assign an event listener to start the function running.

 

So remove up(); from the main body, and replace it with an:

 

addEventListener(MouseEvent.MOUSE_DOWN, up);

 

So that way the movie clip will sit still until you mouse down.

 

Of course you'll need a helper function to handle the mouse event, and a second main function to hold the tween.

 

Anyway, another zip attached. Click the box...

Link to comment
Share on other sites

No problem.

 

I'm using 5.5 - I always forget I'm a knife edge software user and most other aren't.

 

Anyway, the code:

 

import com.greensock.*;
import com.greensock.easing.*;
import flash.events.MouseEvent;

addEventListener(MouseEvent.MOUSE_DOWN, go);

function go(event:MouseEvent):void
{
up();
}

function up():void
{
TweenMax.fromTo(myMC, 1, {y:450}, {y:50, onComplete:up, ease:Linear.easeNone});
}

Link to comment
Share on other sites

Hmm, did you call the helper function? Try either simply calling it with:

 

go();

 

or use an event listener to grab it:

 

addEventListener(MouseEvent.MOUSE_DOWN, go);

 

It works fine here.

 

Let me try to make a legacy file format for you. Can't promise though, 5.5 on Lion is behaving really bad. Buggy as hell, you never not what it's going to do.

Link to comment
Share on other sites

hi mrEmpty. thank you for taking the initiative to help learner7n.

 

another way to do this would be like this:

 

TweenMax.fromTo(box, 1, {y:400}, {y:100, repeat:-1, ease:Linear.easeNone});

 

it seems in his original code he was using yoyo:true which he didn't want.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...