Mailing List
Home
Forum Home
Flash Pro
Subjects
Subject: RE: Firework Effect
Web Service Results
Flash Interface with 10mb xml file
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash MX 2004 Sucks
Reading and displaying RSS feeds in Flash MX
Flash and QuickTime VR
Textfield prototype question
XML to Object help
Order of events per frame
MX2004 Dataset itemClassName
memory management removeMovieClip /
Event Dispatcher between classes
Help: MX 2004 How to script a print button to print the entire sli
ScrollPane component doesn 't auto update
setInterval bug identified and fixed
setInterval bug identified and fixed
Listener Object 's best practice
 
setInterval problem

setInterval problem

2004-03-15       - By Adrian McTaggart

 Back
Reply:     1     2     3     4     5     6     7     8     9     10  

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)