I'm A Flash Spastik
- Started
- Last post
- 6 Responses
- MrBixler
Ok team, I need to define some actionscript to a button to play out the remaining frames of the current timeline and then jump to a specified scene when it reaches the end.
I have 5 buttons that should play the same frames before jumping to different scenes. Any ideas?
- rabattski0
why not work with instances instead of frames? i assume you have some sort of animation you want to play first before it jumps to a different scene right? if so, i would go by using instances (movie clips) and not doing it on the timeline.
- UndoUndo0
you could just stick a gotoAndPlay() action on the last frame of yr scene and have all the buttons use gotoAndPlay() to target the first frame of the animation.
Rabattski is right tho. using instances is usually a lot easier
:D
- rasko40
but he needs each button to redirect to a different scene (I think), I guess he could duplicate the scenes and fake it that way. Either way, scenes are a bad idea.
- UndoUndo0
right I'm with yr.
define a function that targets a specific frame in a scene. Call the function at the end of the animation and pass a variable value [the new scene name]to the function.
set the variable value when you click on the button.
ie.
//define variable
_global.nextScene;
//btn function
_root.myBtn.onPress = function(){
_global.nextScene = "Scene2"
}
// function to be called at the end of each scene
_global.nxtScene = function(nextScene){
_root.gotoAndPlay(nextScene, 1)
}you can substitute the number 1 for the frame number you want the playhead to goto in the new scene
:)
- MrBixler0
Cheers team. I'll give Undos code a try. Why are scenes a bad idea then?
- UndoUndo0
you have more control when using MC's instead of scenes. scenes are a good way of organising your work when you start out but dont give you the flexibility you need when things get more advanced.
good luck