PDA

View Full Version : actionscript vs. timeline control?


circa1977
10-08-2003, 08:11 PM
I have a slide in/slide out "nav panel" movie clip that's working great with one exception. Let me set up what I've built:

Frame 1, Timeline ActionScript Stops the movie. An onRelease exists for a button in the movie which Plays it again. This sets the Timeline going and begins the animation of the panel sliding out.

After the motion tween of the background shape, graphic symbols (nav labels), and clear buttons over each label, the movie stops. Timeline ActionScript has an onRollover, onRollout for each label. The onRollover for the label, Instance named "request1," performs the following:
new_color = new Color(request1);
new_color.setRGB(0xFF0000);
to change the color on rollover to red. onRollout uses the same code to change the color back to white and onRelease calls another function that changes content displayed in the movie.

Clicking the button described above for Frame 1 Plays the movie again, this time advancing it through the second half of the Timeline which slides the nav panel back in. When the Timeline reaches the last frame, it returns to Frame 1 where it stops again.

Two things:
1. When previewing the movie or viewing the published movie, all functionality tied to buttons and most playback performs as expected.
2. When dragging the head back and forth across the Timeline all playback performs as expected.

What's not working?

Any of the labels that changed color onRollover do not slide back in as they're expected to. If the cursor hasn't rolled over them, they're fine and follow the Timeline as expected. Basically, once they've been modified by ActionScript as described above, they seem to be removed from the Timeline.

Is there something I need to do to reattach these instances to the Timeline? I'm scouring the Help content, but I'm really not sure where to even start in this case.

Help! And thanks!!

Csneeky
10-08-2003, 08:28 PM
post your fla man. easier to get what is going on that way

circa1977
10-09-2003, 12:01 AM
Thanks for the reply.

I'm afraid I can't post the fla. It's getting a bit big and is code for a client and such, but you can see an example (work-in-progress) at http://www.markjreeves.com/dev.

WARNING:It's built for FlashPlayer 7/MX 2004 and doesn't prompt you to update your player, so if you haven't, please do so first. Some things won't look quite right otherwise.

Click the NAVIGATION tab, you'll see it slide out. If you DON'T rollover any of the links inside, you'll be able to click NAVIGATION again and it will slide in gracefully. If you do rollover, they don't flow with the timeline and sit in the spot where the Stopped frame left them.

The code on them is literally what I posted earlier. An onRollover function in ActionScript on the Timeline containing the Color class code I posted above.

Thanks again.

circa1977
10-09-2003, 03:21 PM
Still tearing my hair out over this. I've been playing around with stripping it down and different properties, etc. The basic question comes down to this:

If I have an instance of a movieclip and do anything in TimeLine ActionScript to its properties, i.e.

request_button.onRollOver = function() {
//new_color = new Color(request1);
//new_color.setRGB(0xFF0000);
// - or-
//request1._alpha = 50;
};

it works fine within that frame, but once play is resumed, the movieclip doesn't follow the timeline. The movieclip is a single frame containing a single item.

If the function is never called, the movieclip plays fine in the timeline as expected.

A function that doesn't modify the properties, such as:

request_button.onRelease = function() {
loadRequest();
};

works fine!

Csneeky
10-09-2003, 03:59 PM
what do you mean by "TimeLine ActionScipt"? Are you saying that you have a layer labeled "ActionScript" that is holding all your event handlers for the button on the stage? Have you kept all the code in one keyframe on the first layer? How are those textfields attached to the clip that slides out? Is is dynamic? Check to see if they are still in the same scope with a

trace(typeof buttonName);

do that once without rolling over and once with rolling over. If you have really stripped it down why not just post the source?

circa1977
10-09-2003, 10:43 PM
Everything that you mentioned checked out. Thanks again for your help and sorry for so much back and forth on this.

I ended up just creating different instances of all the clips that get modified for the slide in tweening, the still frame with the rollOver, rollOut and release functions, and the slide out tweening. That way any changes made to the properties of the clips in the still frame only affected that instance, and no instances of anything in the slide out animation.

Perhaps this is how it should have been approached in the first place! I guess I envisioned a seamless animation/transition across the TimeLine, with the stop() in the middle, with the instances that I dropped on the stage.

Thanks again.