setInterval problem 2004-03-15 - By Adrian McTaggart
Back I have a movie clip that is being duplicated and animated using the following code. The problem is that the first time it runs it works fine, however the second time the setInterval seems to be firing faster than every 2 seconds and duplicates too many clips.
All this is within an mc that itself is on frame 3 of another mc. It is part of a game and if the player loses the mc is brought on to the stage and moved to frame 3. Not sure if the problem is with this code but can anyone spot any problems with what I have here:
-- ---- ---- ---- ---- ---- ---- ---- ------ var i = 1; showLoseBubble = setInterval(displayLoseBubbles, 2000); function displayLoseBubbles() { if (_global.winLoseBubbles == 2) { bubbleLose_mc.duplicateMovieClip("bubbleLose"+i, i); var bubbleX = Math.floor(Math.random() * (240)); var bubbleY = Math.floor(Math.random() * (90)) + 350; setProperty ("bubbleLose"+i, _x, bubbleX); setProperty ("bubbleLose"+i, _y, bubbleY); i++; trace("bubbleLose"+i); } else { clearInterval(showLoseBubble); } } -- ---- ---- ---- ---- ---- ---- ---- ------
TIA,
Adrian
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Supported by Fig Leaf Software -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Lower Prices for Certified Training! Check out new lower prices for Certified Macromedia Training from Fig Leaf Software. Expand your skill set with courses in ColdFusion, Flash, Rich Internet Applications and .NET in the new year. Fig Leaf Software provides the highest caliber instruction at our training centers in Washington D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location.
Get the details at http://training.figleaf.com/ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected) For additional commands, e-mail: flashnewbie-help@(protected)
|
|