A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Laggy swf.

  1. #1
    Member
    Join Date
    Oct 2004
    Posts
    57

    Laggy swf.

    My swf starts with 100 movieclips, and that makes it really laggy. After a while in the swf, those movieclips are being removed through AS3. And after they are removed, the swf is still that laggy! And if I start off with zero movieclips, it is not laggy at all.

    Please help! In AS2 I could simply use updateAfterEvent...

  2. #2
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    Hi Pattt, could you post your .fla file ? or something that we could take a look at because it's really hard to tell what's wrong ( if there's anything wrong ).

  3. #3
    Member
    Join Date
    Oct 2004
    Posts
    57
    There isn't anything wrong with the code really.
    The only thing is that the swf keeps being slow even after the movieclips (that made the swf slow) is gone.

    In AS2, that could be fixed with updateAfterEvent, but now I don't know.
    Any idea?

  4. #4
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    Just because you think your code is ok and it isn't causing the lagging doesn't mean you're right. Anyways, here's an example for updateAfterEvent:

    code:
    function onTimer(event:TimerEvent):void {
    if (40 < my_mc.x && my_mc.x < 375) {
    my_mc.x-= 50;
    } else {
    my_mc.x=374;
    }
    event.updateAfterEvent();
    }

    var moveTimer:Timer=new Timer(50,250);
    moveTimer.addEventListener(TimerEvent.TIMER,onTime r);
    moveTimer.start();


    Hope it helped with anything.

    Good luck.

  5. #5
    Member
    Join Date
    Oct 2004
    Posts
    57
    Okey, maybe updateAfterEvent isn't going to help me then.
    Alright, let's look at the part where the movieclips are removed:

    removeEventListener(Event.ENTER_FRAME, run);
    Object(parent).removeChild(this);


    Every movieclip has a enterFrame event, that are been removed also.
    Could there be some problems here?

  6. #6
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    Easily could, having separate listener for lots of movie clips is a pain in the arsche... Btw, if you are using Enter_Frame that updates itself anyways after each event, that's why we use it for preloaders...

    IMHO try thinking of an other way of doing whatever you want to do... Once your movie reaches really high amount of movie clips and each of those clips containing enter frame event, will surely kill your animations speed.

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