dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] Removing onEnterFrame from AS 2 class

  1. #1
    Actionscript Developer KigD's Avatar
    Join Date
    Jan 2003
    Location
    georgia
    Posts
    597

    [F8] Removing onEnterFrame from AS 2 class

    Anyone know if there's a way? I lose a lot of efficiency when I onEnterFrames running on multiple clips. With the timeline I always do
    PHP Code:
    myClip.onEnterFrame = function()
    {
    if (
    condition to stop)
    {
    delete this.onEnterFrame;
    }

    But I don't have this feature with AS 2 classes...

    PHP Code:
    class Ball extends MovieClip{
    function 
    Ball()
    {
    }
    function 
    onEnterFrame()
    {
    // This'll keep running forever :-(. I don't want to use booleans to check if I should run the code in here since it'll still slow down...
    }

    Anyone know of any way to disable onEnterFrame from running on a particular class object?

    Thanks,
    -Danny
    K2xL - My games, tutorials, message boards, and experiments.
    Blog

  2. #2
    Actionscript Developer KigD's Avatar
    Join Date
    Jan 2003
    Location
    georgia
    Posts
    597
    Nvermind, I just figured a way around it.

    var F:Function = new Function();
    F = Ball.onEnterFrame;
    Ball.onEnterFrame = undefined; // Garbage collection should pick it up right?
    Ball.onEnterFrame = F; // Restores onEnterFrame
    K2xL - My games, tutorials, message boards, and experiments.
    Blog

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