A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] Limit number of copies within a script?

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Posts
    4

    [F8] Limit number of copies within a script?

    Hi everyone.

    I'm using the following script to generate snow, bubbles, falling hearts for valentinesday, or stuff like that.

    function onEnterFrame() {
    var mydepth = getNextHighestDepth();
    var copy = heart.duplicateMovieClip('sne'+mydepth,mydepth);

    copy._x = random(900);
    copy._xscale = random(100);
    copy._yscale = copy._xscale;
    copy._alpha = copy._xscale;
    copy._rotation = random(15);
    }

    The problem is that it just keeps going on and on, and if you wait long enough, it starts skipping frames, and eventually it'll jam up the entire computer.

    Is there any way to limit the number of copies, or the available depth-levels?

    As you might guess I'm not really an ActionScript-buff... ;-)

    Cheers

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    welcome to FK ... u need to remove the movieclips when no longer needed (for example when they are not on stage any longer)

    to see an example download :: Letter/Number Rain :: from my library and see how that has been scripted..
    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