A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Scales up, but not down

  1. #1
    Junior Member
    Join Date
    Jan 2004
    Posts
    21

    Scales up, but not down

    I ahve to scripts, one on each frame. One scales an MC up to 330% (which works) the other to scale it back down (which doesnt work).

    The scale up script:

    scale = 30
    zoomItem.onEnterFrame=function()
    {
    if (this._xscale<330)
    {
    this._xscale+=scale;
    this._yscale+=scale;
    }else{stop()};
    };

    stop()

    The scale down script (version 1) - this scales it down, just ot scale it back up again (by 30)
    scaleDown = -30;
    zoomItem.onEnterFrame=function()
    {
    if (this._xscale>5)
    {
    this._xscale+=scaleDown;
    this._yscale+=scaleDown;
    }else{stop()};
    };

    stop()

    The scale down script (version 2) - same as version 1
    scale = 30;
    zoomItem.onEnterFrame=function()
    {
    if (this._xscale>5)
    {
    this._xscale-=scaleDown;
    this._yscale-=scaleDown;
    }else{stop()};
    };

    stop()

  2. #2
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Version 2 should be wrong, as u set scale = 30; but try to use scaleDown, which isn't set.

    Version 1 acutally looks good to me...

    maybe the stop() is your problem, to stop an onEnterFrame action stop() won't work..

    instead of stop() try this.onEnterFrame = null;
    My letters on the F1 key have faded, how are yours today?

  3. #3
    Junior Member
    Join Date
    Jan 2004
    Posts
    21
    Sorry the second should read....
    The scale down script (version 2) - same as version 1
    scaleDown = 30;
    zoomItem.onEnterFrame=function()
    {
    if (this._xscale>5)
    {
    this._xscale-=scaleDown;
    this._yscale-=scaleDown;
    }else{stop()};
    };

    stop()

    If I don't put the else stop() in there is no change n the script - it blinks smaller then larger again. Removing the stop (below the close of the onEnterFrame) the script loops to the first frame of the sequence and starts the series of scripts all over again.

    What does the this.onEnterFrame = null do? as far as I can follow it would be if some setting is null, (not set), in this case is it a yes / no answer, which should always return witha valid answer

  4. #4
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    well the zoomItem.onEnterFrame will never stop, if u don't overwrite it with like null.

    From now on it would be too much guessing to me, why your script doesn't work, any
    chance of posting the fla ?
    My letters on the F1 key have faded, how are yours today?

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