05 November 2008

Looping for specific time in movie clip

File size are really matter when you working with flash lite. Specially when you making application with flash lite 1.* or 2.*. They will asking for lower than 100 kb as file size.

So, coding will be important. When you create movie clip and asking it for looping only several times, you will rather using coding than making movie clip many. So, for example, you want to have a movie clip only looping 3 times or 5 times, you can try this one.

Put a code in frame 1 :

var countMe = 0;
var howManyTimes = 2;

(Notes : 0 is included as a number..This would loop 3 times)

Then on frame 2 add keyframe, and do nothing.

On last frame :
if (countMe==howManyTimes) {
stop();
} else {
countMe++;
gotoAndPlay(2);
// note: cannot go back to frame one because countMe var
// would get reset if that frame is entered...
}

And, you are done!

PPL IAIN Syekh Nurjati Cirebon

Jika ditanya apa yang kau suka dari kehadiran mereka? Mereka punya jawabannya : semangat yang tinggi dengan keingintahuan yang tipikal mahas...