Looping an FLV, (my own personal reminder)

Okay here’s some short lines of Actionscript 2 and 3, hardly worth blogging about, but its code I always forget and then have to go sift through old files for, so I’ll use the Coding category of the blog to try and remember I’ve noted this for later…

For Actionscript 2: If you have an FLV playback component on stage you want to loop forever, give it an instance name of myFLV, and in your Actions panel paste in…

myFlv.complete = function(eventObject:Object):void {

this.play();

};

For Actionscript 3: If you have an FLV playback component on stage you want to loop forever, give it an instance name of myFLV, and in your Actions panel paste in…

import fl.video.*;

function onFLVComplete(event:VideoEvent):void {

event.target.play();

}

myFLV.addEventListener(VideoEvent.COMPLETE, onFLVComplete);

And remember for point out the video file (.flv) you want to playback, you can do that in the Component Inspector window, in Parameters, under Source.  Or with code,

myFLV.source = “yourfile.flv”;

And wise, bad teacher sez… learning to program isn’t about memorizing lines of code, but memorizing where you last wrote those lines of code.