interesting flash problem
- Started
- Last post
- 10 Responses
- radiculture
anyone ever have this happen?
i have a button with the following on it.on (release) {
_level1.play("close");
gotoAndPlay("information");
}now, both statements (_level1 and gotoAndPlay) will not work at the same time! Only one works. I can even comment one or the other out, and each works fine on it's own. Any ideas?
- gun0
play() does not accept args.
- D70
I dont see an "arg".
- jpolk0
well, you are not looking then '...play("close")'
- nuggler0
yeah try {gotoAndPlay("close")}
- autonoma0
Not really a good idea to target levels.
- SmilingBuddh0
on (release) {
_level1.play("close");
gotoAndPlay("information"
);
}The problem is likely that the first statement moves the timeline on which this button sits... cutting the instruction off in mid-flow (Flash will execute timeline commands instantly).
The way to think about this is that as soon as the first statement is executed, the button 'dissapears' (the playhead moves somewhere where the button doesn't exist), and the script goes with it.
Without seeing how your timelines are structured, I can't offer you a solution to this, but that's more than likely the problem.
:>buddha
- beingdevious0
on (release) {
_level1.play("close");
gotoAndPlay("information"
);
}should be
on(release){
_root.close.play();
information.gotoAndPlay();
};
- mr_flaco0
Try putting it in a function, somewhere that doesn't move playheads - try keeping your scripts in a central location...anyhow, buddah's probably right - you cant tell a clip to do something if it no longer exist!!!
- beingdevious0
oops i made an err. the second cammand should be "
_root.gotoAndPlay("information")
sorry bout that.
also, im refering _root. to _level1
instead of calling and organizing levels, why dont you just load and play instances. example
_level1 could be a movie clip instanced as "close" therefore you would call "close.play();"
or if you have the mc "close" in _level1, which is another mc, try mcname.close.play(); where mcname is _level1's instance name.
so the final code in the first frame(hint: try using centralized scripts, its easier sometimes)
this=your buttons instance name
//------
this.onRelease=function(){mcname.close.play();
_this.gotoAndPlay("information...}
//----------------
instead of the code being on the button, put this on the stop() frame where your waiting for a click
goto http://beingdevious.com/flashhel… for my example
:)
-AJ
- radiculture0
wow, thanks a lot for all the responses guys. i appreciate it. i'm sorry i was not more clear about what i was doing. guess i was not expecting so many replies.
i'll try to be more clear. the buttons i am using are on the main timeline. (level0) each button loads a new .swf into level1.
so the following Actionscript is supposed to play a "close" sequence in whatever movie is loaded into level1... and then the main timeline goes to a corresponding section (information).
If i use the code as you see it here, it ONLY plays the "close" sequence on level1. it does NOT move the main timeline. HOWEVER, if i comment out the level1 statement, it WILL move the main timeline. It only does one or the other! That's why i thought it was so strange.
on (release) {
_level1.gotoAndPlay("close");
gotoAndPlay("information"
);
}If you're still with me, check it out here. http://radiculture.com/portfolio…
Hit any of the nav buttons, and it will successfully proceed from the main graphic. NOW, hit one of them again and all you'll see it do is play "close". it does not move the main timeline.
p.s. I also tried using gotoAndPlay() rather than play(). just thought i'd see if something else worked.
whew..long post.
thanks.