A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Loops..

  1. #1
    Member
    Join Date
    Nov 2006
    Posts
    93

    Loops..

    Hi,

    I'm trying to unload all movie clips from continuing to spawn and move if I change to a certain frame. I've stopped them from spawning with a simple boolean statement but I'm having trouble with the unloading of movie clips that were already spawned just before changing frame in the scene.

    I can do it, with really awful coding like so:

    Code:
     _root.ArrowSpawn = 0;
    UnloadMovie("leftarrows1");
    UnloadMovie("leftarrows2");
    UnloadMovie("leftarrows3");
    UnloadMovie("leftarrows4");
    UnloadMovie("leftarrows5");
    UnloadMovie("leftarrows6");
    UnloadMovie("leftarrows7");
    UnloadMovie("leftarrows8");
    UnloadMovie("leftarrows9");
    UnloadMovie("leftarrows10");
    
    UnloadMovie("uparrows1");
    UnloadMovie("uparrows2");
    UnloadMovie("uparrows3");
    UnloadMovie("uparrows4");
    UnloadMovie("uparrows5");
    UnloadMovie("uparrows6");
    UnloadMovie("uparrows7");
    UnloadMovie("uparrows8");
    UnloadMovie("uparrows9");
    UnloadMovie("uparrows10");
    Etc...

    However obviously it would be better to do the same thing with a loop. I tried using a foo loop method and didnt manage to get it working. Can anyone help?

    Thanks I need foo pity.

  2. #2
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    Try this:

    Code:
    for(i=0;i<11;i++){
        UnloadMovie("leftarrows"+i);
        UnloadMovie("uparrows"+i);
    }
    Hope that helps!!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  3. #3
    Member
    Join Date
    Nov 2006
    Posts
    93
    Thank-you good Sir.

    Thats almost what I tried the first time, but I didnt write it quite like that, hence the problem

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    you should remove them using removeMovieClip() rather than using unLoadMovie

    unLoadMovie just 'empties' them but they will still exist, hence taking up memory...
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

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