Jump to content
Search Community

It's posible manage a timelineMax that's in external SWF?

lluc666 test
Moderator Tag

Recommended Posts

I put this code in main SWF to acces at external SWF

 

var MiEntorno:MovieClip = loaderEntorno.rawContent;
 MiEntorno.pauseEntorno();

 

this runs my function (at external SWF) , but i can't pause the timelineMax

 

public function pauseEntorno():void {

		trace("PAUSE")
		timelineSlider.paused=true;
		timelineSlider.invalidate();
	}

Link to comment
Share on other sites

Hi lluc666,

I think the syntax is incorrect here (but I might be wrong):

 

    public function pauseEntorno():void {

            trace("PAUSE")
            timelineSlider.paused=true;
            timelineSlider.invalidate();
         }

 

Try this instead:

 

    public function pauseEntorno():void {

            trace("PAUSE")
            timelineSlider.pause();
            timelineSlider.invalidate();
         }

Link to comment
Share on other sites

Either one should work - these both do the same thing:

 

myTimeline.pause();
myTimeline.paused = true;

 

If it's not working for you, I suspect there's a problem elsewhere in your code, but it's very difficult to say without seeing an example FLA that clearly demonstrates the issue. Feel free to post one, but please remove all unnecessary code. No need to post your production files - just the simplest isolated demo would be great.

Link to comment
Share on other sites

You forgot to include the FLA for entornoSliderprova.swf, but I think I might see the problem. You are using tweenTo() to create a tween of the timeline's currentTime. Basically, that pauses the TimelineMax and creates a TweenLite instance that changes the TimelineMax's currentTime value over time.

 

Pausing the TimelineMax doesn't magically stop that tween instance (which is separate and outside of the TimelineMax). Think about it this way: let's say you have a MovieClip timeline that has 100 frames and you have a stop() action on frame 50. At frame 50, it would obviously stop, but then if you do TweenMax.to(mc, 2, {frame:100}) it will make that MovieClip act as though it is playing even though it's not (really) - it's just that the tween itself is scrubbing the frame value manually. The same concept applies here with the TimelineMax instance. It can be paused but if you tweenTo() a certain value, it creates a separate tween that affects the currentTime of the TimelineMax.

 

The solution would be to pause() that tween that is created by the tweenTo() call. For example:

 

var tween:TweenLite = timelineSlider.tweenTo(10);
//then later...
tween.pause();

Link to comment
Share on other sites

You're right!!

 

I didn´t know that´s tweenTo create an intance. Now I understand why currentFrame of timelineSlider runs but a could'n pause... very good explanation!!!

 

 

Is TweenTo the only way to navigate to a especific point in a timeLineMax?

 

 

I bought the club greensock 2 weeks ago and I'm very happy with it and with the big help of this forum, a lot of thank...

Link to comment
Share on other sites

Is tweenTo() the only way to navigate to a specific point in a TimelineMax?

Yes, although I suppose you could addCallback() at a specific spot in the timeline and have it call a function that stops the timeline. Then you could just play() and wait for it to stop, but I think tweenTo() is much more elegant. And of course you could pause() the timeline and create the tween yourself manually like TweenLite.to(myTimeline, 2, {currentTime:5, ease:Linear.easeNone});

 

I bought the club greensock 2 weeks ago and I'm very happy with it and with the big help of this forum, a lot of thank...

Fantastic. Thanks for being a Club GreenSock member!

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...