Embarrassing gotoAndPlay Question

Greetings to everyone in kirupaville. :slight_smile:

It’s been a long time since I’ve been here, but alas it’s been about that long since I’ve had the time to have a little fun with Flash.

Anyway, I’ve started a small project and everything seemed to be going well until I started turning on some actionscript. I know I’m rusty, but I didn’t realize I was this rusty… but here’s the issue.

I can’t get a simple gotoAndPlay action working! Duh!

The main movie has two layers and one frame. Layer 1 is the actions layer and layer 2 has a movie clip named “doohickey”.

Doohickey has three layers and 16 frames. First frame is blank with a stop action. Second frame is labelled “fadeIn” and begins a tween. The next 15 frames are a simple tween (no AS). Frame 16 is blank with a stop action. Layer 1 is actions. Layer 2 is labels and Layer 3 is the tween.

The actions layer in the main movie:


The tween will not fire! The only way it’s working is if I put a play action on the second frame in the doohickey movie clip.

For the love of God, what am I doing wrong? You would not believe how long I’ve been trying to figure this out today…

Attaching the fla if it would be helpful.

Thanks in advance.


it does play, it’s just because you have doohickey’s width and height set to 0 so you cant see it :slight_smile:

Thank you Yeldarb.

I see what you’re saying about the size attributes, but isn’t that normal when the first frame is blank?

Did you get the swf to play without a play action on frame 2 of doohickey?

Again, thank you for helping me!

PS. The tween makes a red square into a blue square… original, huh?

hmm, kind of odd,
the way i fixed it was by adding play(); on the frame with the label… im not sure why it was stopped, but that works

Yes, that’s what I’m getting too. What’s making me crazy though is why such a thing would be necessary!

Makes me think there’s something else wrong with this file, because in my (albeit very limited) experience, a gotoAndPlay action for the second frame should over rule the stop action on the first frame.

But in this file, that’s not the case.

Again, thank you for looking at this with me. I thought I must be going crazy or something! And obviously, this is only a simple example of the issue I’ve isolated on a much bigger project. I’d hate to have something screwy going on with this part that may affect the larger site.

i don’t see anthing else wrong with it, may be a bug, that because instead of playing frame 2 you labeled it, but i have no idea otherwise, kind of kooky…

KAREN!!! Long time no see!!! How have you been?

This sounds kind of odd, lemme check out that file and see if I can figure anything out.

Ok, my solution…

On the _root timeline moves the actions to an empty keyframe on frame 2, and have the doohickey clip spanning frames 1 and 2. Check my attachment.

My theory:

Apparently the code on the frame gets read and interpreted before the content in the movieclip symbol. So when you declare the gotoAndPlay on the same frame the clip is created on the timeline it may screw up because Flash hasn’t completed reading the timeline inside the clip yet. Just theory though, I honestly have no clue ;(

Hey Beta!!! I was hoping you’d still be around so I could say hi. :slight_smile:

I’ve been good, lotsa work but also some fun stuff. Since this spring, I’ve been learning how to fly an airplane! It’s been challenging and fun. I kept meaning to dig into some Flash projects all summer, but the time just sped by - I can’t believe it’s October already. I’ll be taking the written knowledge test here very shortly for flying, though, and that will free up a good deal of time that had been spent in study.

I’m glad to know that it’s not just me that can’t figure this one out. I kid you not - I drove myself nuts over this yesterday. But I’m taking your suggestion here and am going to try the movie clip stopping on an alternate keyframe. I’ll post back the results.

Again, great to see you. :slight_smile:

PS. Whoops. You’ve already done that! You rock. Many thanks Beta.

By George, I think you have it.

I think your theory is right on target too. Your fla works like a charm. It makes perfect sense that it’s a Flash thing… doesn’t appear that the clip is “read” in time for the action in the main movie to work.

I tried a variation: a totally blank first frame in the movie clip allows the tween to fire as scripted as well. But then that doesn’t explain the loading thing - we’ve added more frames before the tween, not taken them away. However, trying to figure out the why of that is beginning to make my hair hurt.

So, I’ll just be happy it’s working now without a forced play action and call it a day. :slight_smile:

BTW, wrong thread for this Beta, but have you tried the new release of Flash?

I am glad I could help. I still think this is a very weird issue though, makes me confuzzled :h: hehe. I came up with the “frame after” method because with everything on frame 1 I put it all within an onMouseDown handler, and it worked like a charm then, but if I removed it from the handler it didn’t work. So I figured I would try putting the actions on the frame after the clip was created and voila, it worked. Flash should definitely fix this!

So you’re learning to fly a plane eh? That’s awesome! I will now refer to you has Karen the Aviator… or maybe KarenInTheAir and maybe you can fly over my house one day :beam: hehehe. I wish you the best of luck on that written knowledge test, I am sure you will do good.

I also hope you get back into Flash, from what I remember you created some pretty click stuff. I still have the .fla for your footer actually…lol. I don’t know if you remember, but I PMed you asking your for the .fla because I was amazed at how it worked. I was so n00b back then…hahaha.

And no, I have not tried the new release of Flash. I am still a Flash MXer and probably always will be. My main reason for not upgrading is cost, I just don’t have the money for that right now, and I don’t know if I will for a while. Another reason that deters me from getting it is how buggy it is. You can read the Flash MX 2004 Bug Report List thread in the Flash MX 2004 section of this forum. I believe the thread is a sticky in there.

Of course I remember :slight_smile:

Thanks for the good luck wishes! I’ll do well, I know… been studying my butt off for months, and it should pay off. If you’re interested, I just put up a video that I shot while on short final for landing. We were up doing touch and go practice (where you land and then takeoff again right away) and I noticed how beautiful it is right now with the leaves turningl. So I made my instructor fly the airplane while I filmed a bit of it.

The link is somewhat on-topic, sorta, because it’s done in Flash.

Landing Video

Anyway, I’m with you on the MX 2004 thing. Still so much to learn with the last version of MX. And yes, I’ll sure be doing some tutorials from right here to help along with that. Flash is fun.