Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to stop an actionscript from running

    I have made a Flash file with a kind of sparkling effect following the cursor by using actionscript. It works like it should, but I want this effect to stop at a certain frame number. How can I do that?

    This is the script in frame 1 of the flash-file:

    var d_r:Number = Math.PI/3;
    function sparkle():Void {
    var clip:MovieClip = _root.attachMovie("sparkle", "sparkle"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
    clip._xscale = clip._yscale=Math.random()*40 | 0;
    var s:Number = Math.random()*3 | 0;
    var a:Number = Math.random()*6 | 0;
    clip.onEnterFrame = function() {
    if (this._alpha <= 0) {
    delete this.onEnterFrame;
    } else {
    this._alpha -= 10
    this._x += (Math.cos(a*d_r)*s);
    this._y += (Math.sin(a*d_r)*s);
    }
    };
    }
    onMouseMove = function () {
    for (var z = 0; z<10; z++) {
    sparkle();
    }
    };

    This is the URL of the Flash file with the problem: http://graphid.nl/kerst/card.html

    Thanks for your help
    Last edited by JavaRookie; 12-07-2011 at 03:31 PM. Reason: Adding URL


 

Tags for this Thread

Posting Permissions

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