...

View Full Version : Conditional Stop



StupidRalph
10-14-2006, 02:26 AM
I want to be able to move the stop() around on the timeline based on a condition. The condition it the hour of the day.

For Ex.

//get date info from system
mydate =new Date();
myhour = mydate.getHours();

switch (myhour) {
case 1:
//play and then stop play head on frame 24;
break;

case 2:
//play and then stop play head on frame 27;
break;

default:
//play and then stop play head on frame 30;
}

The reason I didn't think I could use gotoAndStop() is because I want it to play until the desired stop frame at which point it would stop, opposed to jumping directly to the stop frame and stopping.

Any suggestions?

StupidRalph
11-10-2006, 12:18 AM
Shouldn't this ideally work? Or am I missing something?


function playUntilFrame (mc:MovieClip,f:Number):Void {
// this function plays movieclip 'mc' until it reaches frame 'f'
mc.onEnterFrame = function () {
if (this._currentframe<f) {
// 'mc' is not yet at frame 'f' so go to next frame
this.nextFrame();
} else {
// reached frame 'f' so stop oEF
delete this.onEnterFrame;
}
}
}
// call like so:
playUntilFrame(instanceNameMovieClip,45);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum