First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: ben david bennett | Website: http://www.synaptology.com
//### 5. Detect mouse location and scale clips accordingly###
function rescale() {		
    if (_root._ymouse <%gt%> 0 && _root._ymouse <%lt%> stageHeight/5) {
        _root.scale  = 1.02;
    } else if (_root._ymouse <%gt%>= stageHeight/5 && _root._ymouse <%lt%> (2*(stageHeight/5))) {
        _root.scale  = 1.01;
    } else if (_root._ymouse <%gt%>= (2*(stageHeight/5)) && _root._ymouse <%lt%> (3*(stageHeight/5))) {
        _root.scale  = 1;
    } else if (_root._ymouse <%gt%>= (3*(stageHeight/5)) && _root._ymouse <%lt%> (4*(stageHeight/5))) {
        _root.scale  = 0.99;
    } else if (_root._ymouse <%gt%>= (4*(stageHeight/5)) && _root._ymouse <%lt%> (5*(stageHeight/5))) {
        _root.scale  = 0.98;

    if (_root.scale <%lt%> 1) {
        _root.bigger = false;
        _root.smaller = true;
    } else if (_root.scale <%gt%> 1) {
        _root.bigger = true;
        _root.smaller = false;
    } else {
        _root.bigger = false;
        _root.smaller = false;

    if (_root.bigger == true) {
        if (clipWidthNow <%lt%> actualClipWidth*maxScaleFactor) {
            _root["holderMovie"]._xscale *= _root.scale;
            _root["holderMovie"]._yscale *= _root.scale;
            _root.clipWidthNow *= _root.scale;
    else if (_root.smaller == true) {
        if (clipWidthNow <%gt%> actualClipWidth*minScaleFactor) {		
            _root["holderMovie"]._xscale *= _root.scale;
            _root["holderMovie"]._yscale *= _root.scale;
            _root.clipWidthNow *= _root.scale;

The rescale() function also has 3 parts. First we detect the location of the mouse in the y-dimension and adjust the value of the variable, scale accordingly. Next we set the values of the Boolean variables, bigger and smaller depending on the current value of the variable, scale. Finally, we check the values of the variables, bigger and smaller. If bigger == true then we first check to make sure that the clip has not been scaled to a size greater than we determined using maxScaleFactor and if this returns true then we scale the holderMovie and the value of the variable clipWidthNow. The advantage to using this methodology is that by scaling the holderMovie clip instance we produce the visual impression that the menuMovie instances have been scaled whereas just the holderMovie clip has been scaled. Because holderMovie is an empty clip, we need to keep track of the size of the clips by scaling the value of the variable, clipWidthNow. The other advantge to using this methodology is that the move() and replace() functions do not have to account for scaling of the menuMovie clips because they are not actually scaled, rather just the clip within which they are nested (holderMovie) is scaled.

» Level Intermediate

Added: 2001-07-23
Rating: 7 Votes: 52
(10 being the highest)
» Author
No details available.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.