Gerry and Henrik have the right answer. Your computer monitor isn't
capable of displaying 20 million points, and Flash will hang, as you
have found out.

This is untested e-mail AS3, but I would do it something like this:

var pointX:Vector.<Number>; //vectors are much faster than arrays
var pointY:Vector.<Number>;

// You have to create the vector in a new code line
pointX  = new Vector.<Number>();
pointY  = new Vector.<Number>();
ndx:int = 0;
len:int;

// first fill the vectors
for (var i:Number= -10000 ;i<10000;i+=.1)
{
   ndx++;
   pointX[ndx]=i;
   pointY[ndx]=5*Math.sin(20*i);
}

// prepare to draw the graph
graphics.lineStyle(2, 0X000000); //set the line to 2 pixels wide, black
graphics.moveTo(pointX[0], pointY[0]); // move to the starting point
len = pointX.length + 1;

// Now draw the graph
for (x = 1; x<= len; x++)
{
   graphics.curveTo(pointX[x], pointY[y];
}

There's more you have to do--importing the graphics package, perhaps
putting this all into a class, and so on. There are probably minor
bugs in the code you'll have to fix--this is just off the top of my
head. I think you will be much happier with performance and appearance
with something like this, though.

Cordially,

Kerry Thompson

On Mon, Aug 22, 2011 at 4:49 AM, nasim hhhhh <iranebah...@yahoo.com> wrote:
> but the most problem is for loop i think flash dont do any thing until the 
> loop finishde
> i need to  use smal step because if the step is big the graph will be show 
> like line to line , it s ugly graph
> and the distance that i use for loop is more importatnt for me i want to show 
> 2*10^8 distance / i want to make point in my program and plot it one by one i 
> make i plot
> i make i plot
> is there better way?

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to