Question

Flaah CS4, AS2

I am making an interactive tour. On the main timeline I have two movieclips: ABOUT and RENTALS.

I would like a button btnFLRcafe in the ABOUT movieclip to connect to RENTALS and start playing on the timeline at a frame named CAFE.

This is the code that I have on btnFLRcafe:

on(release){
_root.gotoAndStop("RENTALS");
_root.mcRENTALS.gotoAndPlay("CAFE");
}

When the button is pressed it navigates to RENTALS, but starts playing from the beginning of the timeline. It seems that the second part of the code is being ignored.

What am I doing wrong?

Was it helpful?

Solution

After the first gotoAndStop call, it takes 1 frame before mcRENTALS is loaded.

There is a couple of ways to get around this.

You can wait for the onEnterFrame callback, and then make the second call.

You could also keep About and Rentals in the same frame, and just hide and show them. Then you wont have to wait for them to load (since they are never unloaded).

You could also set a global value that a framescript in mcRENTALS will read, and then jump to the correct frame.

Though all of those solutions have a bit of a "hack" to them. Depending on the time you have available and how much coding you want to do, I would suggest you to do it in ActionScript 3 instead. You can pass the subsection a parameter to a constructor of the mainsection. And besides that, ActionScript 3 is just easier once you get into it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top