Jump to content
Search Community

start properties on onComplete

omnider test
Moderator Tag

Recommended Posts

Hi, another interesting situation occurred :) I have a timeline which I define and initialize in the constructor of a class. I use this timeline later on in the code when I click a button. The timeline is to animate this button away from stage. The thing is this button also has a onMouseOver event handler that changes it's position and rotation. Somehow I thought the timeline would use the current properties of the object beeing tweened when it's defined (now I realise that it can't work this way). Anyhow, when I want to reappear the button on the stage again I'm using reverse on that timeline which of course tween the button on the stage to the position it was when the mouse was over it, which I don't really want. Therefore my question - is there any way to tell the tweens in my timeline to return to different coordinates on reverse ? some sort of mix of startAt and onUpdate ? ... I'm not sure if I explained the situation clearly enough. Thanks for any ideas :)

Link to comment
Share on other sites

I'm having a difficult time visualizing this.

 

can you post a very simple fla that just has

 

1) this button that moves when you rollover it and that moves off stage when you click

2) a button that will bring the previously mentioned button back on stage.

 

it would be much easier if we could see the exact animation that is taking place.

 

what you are describing doesn't really seem like one linear timeline and I don't know if there is going to be an easy way to play a timeline backwards with different values.

 

you may need to have multiple timelines to make it work

Link to comment
Share on other sites

Hi,

 

I've been creating something similar to what you've described, but having problems too.

 

Have a post called: Issue event listeners being ignored

 

All the code is there and I believe what I have that DOES work will help you

Link to comment
Share on other sites

thanks very much for your replies guys.

 

Carl: I don't even know why I was describing the problem so deeply. The question put simply is : let's say I have an MC at x:0 y:0 I use timeline to tween it to x:20 y:20. When I get there I would like to reverse this timeline but so that it returns to different coords, for instance x:10 y:10. In this simple case it doesn't make much sense but it's pretty much what I'm trying to achieve. So basically I'd like to call a function on onComplete for instance that would change initial attributes of the timeline ... hope that makes sense :)

 

Manic: I've read through the thread and I don't think you were trying to achieve the same I do. Thanks anyway :)

Link to comment
Share on other sites

Sorry, I can't think of a way to do that. Doesn't mean it isn't possible.

 

I would probably just create a tween/timeline at the time you want the button to reappear with the correct values instead of reversing.

 

another possibility could be to have a series of tweens in one timeline that

 

tweens from startPos to rollOverPos (when rollOver occurs)

tweens from rollOverPos to offStagePos (when click occurs)

tweens from offStagePos to start pos. (when re-appear requested)

 

these could all be achieved with a tweenFromTo on a TimelineMax http://www.greensock.com/as/docs/tween/ ... eenFromTo()

 

in this scenario to achieve smooth continuous tweens you would have to prevent clicking during the first segment and prevent re-appear during the second.

being that I can't visualize the exact animations and interactions, i'm not sure this is a great suggestion.

Link to comment
Share on other sites

yeah I know what you mean. well the rollover animations are fairly fast but I think preventing to click during the animation isn't the best user experience...plus the animations are quite complex and there are lots and lots of animations put in one timeline basically so changing the whole flow isn't the smoothest thing to do. Your suggestion is good and makes a perfect sense no doubt, it's just that this whole thing was handed to me by someone else and the way it's been done in the first place is...well...not optimal to say the least. The easiest way to fix the whole thing would be to be able to change the initial attributes of some tweens as I was asking, but since you're saying there's probably no way to do it I'll just rebuild it all:)

 

Thanks

Link to comment
Share on other sites

you probably are better off re-doing it, but i didn't say there was no way, its just that I don't know.

 

if you are handy with the various timelineMax methods like getChildren(), shiftChildren(), invalidate() and TweenMax methods like updateTo, its very possible that you could loop through the timeline, find the tweens you are after and try to re-record destination values and start values.

 

by the time you did all that do, you could probably do it in a cleaner fashion.

 

-carl

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