video.Maru
by polyGeek polyGeek logo



 

Creating controls with rollover states

February 23rd, 2008 . by polyGeek

Here 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;

 	}

    }

}
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Technorati
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon

One Response to “Creating controls with rollover states”

  1. comment number 1 by: fiveinthechamber

    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;
    }
    }
    }

Leave a Reply

Name

Mail (never published)

Website