Im wonder how I can make
_root.nextFrame();
go to a random frame and not play the same frame twice?
would this be the job of an array? write all the frame labels into an array and pop them when you go to the next frame?
thanks
Mark
Printable View
Im wonder how I can make
_root.nextFrame();
go to a random frame and not play the same frame twice?
would this be the job of an array? write all the frame labels into an array and pop them when you go to the next frame?
thanks
Mark
I found this on another forum but Im not sure how I can use it the way im doing things
this is written on the first frame,
-----------------------------------------------
[as:1:e3373511da]mc.onRelease = function()
{
this._parent.random_frame();
}
var frames = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 ]
function random_frame()
{
var c = frames.splice(random(frames.length), 1)
mc.gotoAndStop(c)
trace(frames.length)
}
[/as:1:e3373511da]
My que to send the playhead to the next frame is at the end of an animation on the timeline.
Would I just use write the array and splice var then call it at the end of my animation? like
-------------------------------------------------
on frame one
-------------------------------------------------
var frames = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 ];
function random_frame();
var c = frames.splice(random(frames.length), 1);
-------------------------------------------------
on my animation timeline que
-------------------------------------------------
_root.gotoAndPlay(c);
-------------------------------------------------
am I on the right track?