-
-
.
Hi,
You just need to remove the listener. there are a few ways to do this, but here is one.
PHP Code:
import flash.display.Shape;
import flash.events.Event;
var j:Number = 0;
var maxDot:Number = 500;
var star:Shape = new Shape();
addChild(star);
star.graphics.beginFill(0xe4d00d);
star.graphics.drawCircle(10,10,2);
star.alpha = 0.8;
stage.addEventListener(Event.ENTER_FRAME,pl);
function pl(event:Event)
{
star.graphics.drawCircle(Math.random() * 550, Math.random() * 200, Math.random() * 3);
j++;
trace(j);
if (j >= maxDot)
{
stage.removeEventListener(Event.ENTER_FRAME,pl);
trace("Reached " + maxDot + " now stop.");
}
}
-
.
Hi
Or you could simplify it and draw them all instantly, like so.
PHP Code:
import flash.display.Shape; import flash.events.Event;
var j:Number = 1; var maxDot:Number = 500;
var star:Shape = new Shape(); addChild(star);
star.graphics.beginFill(0xe4d00d); star.graphics.drawCircle(10,10,2); star.alpha = 0.8;
while (j <= maxDot) { star.graphics.drawCircle(Math.random() * 550, Math.random() * 200, Math.random() * 3); trace(j); j++; }
or a do while
PHP Code:
do { star.graphics.drawCircle(Math.random() * 550, Math.random() * 200, Math.random() * 3); trace(j); j++; } while (j <= maxDot);
Last edited by fruitbeard; 02-25-2015 at 08:11 AM.
-
it works ... Thanksyou So much fruitbeard :)
Originally Posted by fruitbeard
Hi
Or you could simplify it and draw them all instantly, like so.
PHP Code:
import flash.display.Shape;
import flash.events.Event;
var j:Number = 1;
var maxDot:Number = 500;
var star:Shape = new Shape();
addChild(star);
star.graphics.beginFill(0xe4d00d);
star.graphics.drawCircle(10,10,2);
star.alpha = 0.8;
while (j <= maxDot)
{
star.graphics.drawCircle(Math.random() * 550, Math.random() * 200, Math.random() * 3);
trace(j);
j++;
}
or a do while
PHP Code:
do
{
star.graphics.drawCircle(Math.random() * 550, Math.random() * 200, Math.random() * 3);
trace(j);
j++;
} while (j <= maxDot);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|