If you understand how Flash Player works,you would probably do it
differently.

Flash Player executes the code in the frame before rendering the objects on
the frame...

You need to use Timer class  or frame-event (enterFrame) instead of
while-loop here... to update the screen (rendering or paint)..

-abdul



On 1/20/07, chrisvet2001 <[EMAIL PROTECTED]> wrote:

  I'm trying to develop a system to show how to get from point A to
point B on a floorplan...

I'm having 2 problems --
1) the best way to display these points over a period of time (to
'animate' the points)
2) when i do build in some delays, nothing gets displayed until all of
the points are already there...

my prototype code is below...

package {
import flash.display.Sprite;

public class Breadcrumbs extends Sprite {

private var _pathX:Array = ['10','30','30','75'];
private var _pathY:Array = ['10','10','50','50'];

public function Breadcrumbs() {
init()
}

public function init():void {
drawPath();
}

private function drawPath():void {
var lastX:int = _pathX[0];
var lastY:int = _pathY[0];
var currentTime:Date;
var previousTime:Date = new Date();
var i:int = 0;

while (i < _pathX.length) {
currentTime = new Date();
if (currentTime.getTime() > previousTime.getTime() + 5000) {
var s:Sprite = new Sprite();
s.graphics.beginFill(0xFF0000, 1);
s.graphics.drawCircle(_pathX[i], _pathY[i], 2);
addChild(s);
i++;
}
}
}
}
}

Any Ideas as to how to improve the 'delay' code and/or how to get the
individual points to show up one at a time?

Thanks,
Chris

Reply via email to