PDA

View Full Version : Change Frame on Main Timeline from Within An MC



flyingmonkey456
January 11th, 2010, 06:36 PM
I'm tying to make the frame change to the previous or next one when a person clicks on an arrow. I can't figure out how to make the frame change, though. I've tried _global.gotoAndStop() and setting _global._currentframe, neither of them worked. Does anybody know how to do this?

therobot
January 11th, 2010, 07:24 PM
I'm tying to make the frame change to the previous or next one when a person clicks on an arrow. I can't figure out how to make the frame change, though. I've tried _global.gotoAndStop() and setting _global._currentframe, neither of them worked. Does anybody know how to do this?

try _root.gotoAndStop(frameNumberOrFrameLabelHere);

_currentframe is read-only I think.

flyingmonkey456
January 11th, 2010, 09:54 PM
try _root.gotoAndStop(frameNumberOrFrameLabelHere);

_currentframe is read-only I think.

Argh, I accidentally got global mixed up with root. Thanks.

flyingmonkey456
January 11th, 2010, 10:10 PM
Well, that made it work better. Now for some reason MCs are carried between frames. When I move to another frame, there are still things from the last one on the screen and it keeps piling up every time I change. Here's my code:



onClipEvent(load)
{
var Frame = _global.Area + 1;
}onClipEvent(enterFrame)
{
if(_global.NewArea != _global.Area)
{
Frame = NewArea + 1;
}
this.swapDepths(9999);
_root.gotoAndStop(Frame);
}

flyingmonkey456
January 13th, 2010, 02:06 PM
Anyone?