Creating controls with rollover states
February 23rd, 2008 . by polyGeekHere is a short - 6 minute - video tutorial to help you create rollovers effects for your video interface controls.
[ Download Example | Download FLV ]
If you want to use the new API call - playBackward() - mentioned in this video you’ll need the latest videoMaru 3.5 beta SWC - see link at top of window.
playBackward( mc ) works be taking the MovieClip that you pass and creating an onEnterFrame function. On each enterFrame event it says: gotoAndStop( this._currentframe - 1 );
Then it checks to see if this._currentframe == 1. If so then it deletes the onEnterFrame function.
It looks like this:
function playBackward( mc:MovieClip ):Void { mc.onEnterFrame = function():Void {
this.gotoAndStop( this._currentframe - 1 );
if( this._currentframe == 1 ) {
delete this.onEnterFrame;
}
}
}








Just wanted to say thanks for videomaru.
As for the rollover states… It only seems logical to add to your playBackward function with a playForward function. Now the rollover and rollout are flawless.
this.mc.onRollOver = function():Void{
this.playingThis = 1;
this._parent.playForward(mc);
}
this.mc.onRollOut = function():Void{
this.playingThis = 0;
this._parent.playBackward(mc);
}
function playBackward( mc:MovieClip ):Void {
mc.onEnterFrame = function():Void {
this.gotoAndStop( this._currentframe - 1 );
if( this._currentframe == 1 || this.playingThis == 1 )
{
trace(playingThis);
delete this.onEnterFrame;
}
}
}
function playForward( mc:MovieClip ):Void {
mc.onEnterFrame = function():Void {
this.gotoAndStop( this._currentframe + 1 );
if( this._currentframe == this._totalframes || this.playingThis == 0 )
{
//trace(playingThis);
delete this.onEnterFrame;
}
}
}
There seems to be a bug in your example available for download. If I press the play button before pressing the startPlay button, the video doesn’t play and the button doesn’t switch to the pause state. The tutorial you have on this page is functioning properly, but the downloaded .fla doesn’t seem to be working right. Just a heads up. Thanks