SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Next and prev frame

    Hi everyone,

    I have a few buttons (all movieclips) that i want to resize whenever somebody hovers on them. The button should go back to it's original size on mouse-out. So i created a movieclip for all of them. The movie is nothing but 10 frames from size a to size b.

    Now everytime somebody hovers a button i'd like the movieclip to play forward untill the mouse-out. If the mouse is out i want to play the movie backwards from that point.

    Something like this but then more advanced so the movie actually plays forward and backward.

    Code:
    on (press, release, rollOver, dragOver) {
    	nextFrame();
    }
    on (releaseOutside, rollOut) {
    	prevFrame();
    }
    Anyone has a suggestion or a turorial?

  2. #2
    SitePoint Wizard jim_morrison3's Avatar
    Join Date
    Apr 2004
    Location
    UK
    Posts
    2,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why take the pain of creating so many frames ? You can try something like this:

    Code:
    initWidth=btn._width;
    initHeight=btn._height;
    btn.onRollOver=function(){
    delete this.onEnterFrame;
     this.onEnterFrame=function(){
    this._width++;
    this._height++;
    }
    }
    
    btn.onRollOut=function(){
    delete this.onEnterFrame;
    
    this.onEnterFrame=function(){
    if(this._width > initWidth || this._height > initHeight){
    this._width--;
    this._height--;
    }else{
    this.onEnterFrame;
    }
    }
    }
    Good Luck!
    There are things known and Things unknown
    And in between are the Doors.
    I love hand Coding.

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did that initially, but it didn't work completely because the original heights, widths and alpha's change slighty when you hover a couple of times. Iam now trying the same thing with the tween class, perhaps that's any better.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •