A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Scaling buttons script

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    16

    Scaling buttons script

    Hi everyone I found a cool scaling buttons script. But can anyone take a look at the script and tell me how to make the button gotoAndPlay a scene. Here's the script.




    // ---- function to scale buttons in or out

    var scaleSpeed:Number = 3; // the higher, the slower the movement is
    var originalScale:Number = 100; // default scaling of the buttons
    var maxScale:Number = 150; // maximim scaling of the buttons

    function scaleButton(scaleTo:Number, scaleClip:MovieClip){
    scaleClip.onEnterFrame = function(){
    // smooth scaling
    this._xscale = this._yscale += (scaleTo-this._xscale)/scaleSpeed;
    // stop when scale is finished, remove onEnterFrame function
    if(Math.round(this._xscale) == scaleTo){
    delete this.onEnterFrame;
    }
    }
    }

    // ---- make button actions for webIcon

    _root.webIcon.onRollOver = function(){
    scaleButton(maxScale, this);
    }
    _root.webIcon.onRollOut = function(){
    scaleButton(originalScale, this);
    }
    _root.webIcon.onDragOut = function(){
    scaleButton(originalScale, this);
    }
    _root.webIcon.onRelease = function(){
    trace("do stuff from webIcon");
    }



    Thanks

  2. #2
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    this is actionscript 2 code

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center