Re: [Flashcoders] array problem,loop.plot

2011-08-22 Thread Kerry Thompson
Hi Nasim,

You can certainly create an array of 20,000 elements (or two Vectors,
as I did, with a smaller number).

The problem is, I don't think you can display that many points. How
big is your stage? I had mine set to 1024 x 768, which is normally
about as high as you want to go.

You don't need that many points to create a smooth graph, though. Try
using every 10th point, and either lineTo or curveTo.

To do that, in the part that creates the graph, increment by 10:

// Now draw the graph
for (x = 1; x<= len; x+=10)

Did you get my second e-mail, where I wrote the class for you? It uses
lineTo(), which should give you pretty smooth graph with 2,000 points.
My class isn't bug-free, but it is free, and you should be able to
make it do what you want. If not, I'll take another look at it in the
morning (it's after midnight here).

Cordially,

Kerry Thompson


On Tue, Aug 23, 2011 at 12:13 AM, nasim h  wrote:
> Dear Kerry
> Hi
> I am really apreciate u , one of my bigest problem is when i want create 
> point , my boss want to have an array of point that has distance between 
> -1 to 1 or more than it because when the user want scale graph i 
> should use that stoored point to calculate new graph , but the prolem is when 
> i want to store data in array this loop take a lot of time and  flash dont do 
> anything until the loop finished , and after 15 s it get me eror of time or 
> hang the program and close it 
> in my program i should fine soulotion to draw online point plz help me
>
> --- On Mon, 8/22/11, Kerry Thompson  wrote:
>
>
> From: Kerry Thompson 
> Subject: Re: [Flashcoders] array problem,loop.plot
> To: "Flash Coders List" 
> Date: Monday, August 22, 2011, 3:34 PM
>
>
> Sure. I knew there would be bugs in my code :-)
>
> Actually, you have so many points, you probably don't need to use
> curveTo(). lineTo() would probably work for you, and it just takes two
> parameters.
>
> Here's a class I wrote that draws something. It's probably not what
> you want, but it works, at least. You can take it from here. (I
> created this class in a Flex AS3 project--that's why I defined the
> stage size in line 6. If you do it in Flash, you won't need that--just
> set the stage size to what you want).
>
> Cordially,
>
> Kerry Thompson
>
> package
> {
>     import flash.display.Sprite;
>     import flash.display.Graphics;
>
>     [SWF(width='1024',height='768',backgroundColor='#FF',frameRate='24')]
>     public class GraphTst extends Sprite
>     {
>         private var pointX:Vector.; //vectors are much faster than 
> arrays
>         private var pointY:Vector.;
>         private var ndx:int = 0;
>         private var len:int;
>
>
>         public function GraphTst()
>         {
>             init();
>             createPoints();
>             drawGraph();
>         }
>
>         private function init():void
>         {
>             // You have to create the vector in a new code line
>             pointX  = new Vector.();
>             pointY  = new Vector.();
>         }
>
>         private function createPoints():void
>         {
>             // first fill the vectors
>             for (var i:Number= -100; i<100; i++)
>             {
>                 pointX[ndx]=i + 100;
>                 pointY[ndx]=5*Math.sin(20*i);
>                 ndx++;
>             }
>         }
>
>         private function drawGraph():void
>         {
>             // prepare to draw the graph
>             graphics.lineStyle(2, 0X00); //set the line to 2 pixels wide, 
> black
>             len = pointX.length - 1;
>
>             // Now draw the graph
>             graphics.moveTo(pointX[0], pointY[0]);
>             for (ndx = 1; ndx< len; ndx++)
>             {
>                 //trace("ndx: " + ndx);
>                 graphics.lineTo(pointX[ndx], pointY[ndx]);
>             }
>         }
>     }
> }
>
>
>
>
>
> On Mon, Aug 22, 2011 at 2:08 PM, nasim h  wrote:
>> Dear  Kerry
>> I 'am really appreciate u ,but the first problem that i didnt use curve to 
>> is it's parameter
>> it needs 4 parameter  and i cant guess how to define curve point
>> do u have any idea plz tell me
>>
>> --- On Mon, 8/22/11, Kerry Thompson  wrote:
>>
>> From: Kerry Thompson 
>> Subject: Re: [Flashcoders] array problem,loop.plot
>> To: "Flash Coders List" 
>> Date: Monday, August 22, 2011, 9:41 AM
>>
>> 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.; //vectors are much faster than arrays
>> var pointY:Vector.;
>>
>> // You have to create the vector in a new code line
>> pointX  = new Vector.();
>> pointY  = new Vector.();
>> ndx:int = 0;
>> len:int;
>>
>> // first fill the vectors
>> for (var i:Number= -1 ;i<1;i+=.1)
>> {
>>    ndx++;
>>    pointX[ndx]=i;
>>    pointY[ndx]=5*Math.sin(20*i);
>> }
>>
>> // prepare

RE: [Flashcoders] array problem,loop.plot

2011-08-22 Thread Chris Foster
Nasim,

As you already know, pre-calculating all those data points is too much work for 
Flash, and it's also way more points than any monitor can show at one time.

Why don't you try calculating only the points you need, only when you need 
them? Tell your boss that 'having an array of points' from -1 to 1 is 
the wrong solution.

A solution that will work in Flash is to start by deciding how many points you 
can reasonably plot (for example 1000), then define the 'zoom' of your graph by 
specifying the START and END values, and then plot ONLY 1000 POINTS between 
your start and end values.

Zooming in and out just means changing the START and END values. The onscreen 
display will remain the same size, but the shape of the plotted line will 
change as you zoom in and out.

Also, if you can, you should buy Keith Peter's excellent book "ActionScript 3 
Animation - Making Things Move". It deals specifically with the issues you're 
experiencing.

C:

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com 
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of nasim h
Sent: Tuesday, 23 August 2011 2:13 PM
To: Flash Coders List
Subject: Re: [Flashcoders] array problem,loop.plot

Dear Kerry
Hi
I am really apreciate u , one of my bigest problem is when i want create point 
, my boss want to have an array of point that has distance between -1 to 
1 or more than it because when the user want scale graph i should use that 
stoored point to calculate new graph , but the prolem is when i want to store 
data in array this loop take a lot of time and  flash dont do anything until 
the loop finished , and after 15 s it get me eror of time or hang the program 
and close it  
in my program i should fine soulotion to draw online point plz help me

--- On Mon, 8/22/11, Kerry Thompson  wrote:


From: Kerry Thompson 
Subject: Re: [Flashcoders] array problem,loop.plot
To: "Flash Coders List" 
Date: Monday, August 22, 2011, 3:34 PM


Sure. I knew there would be bugs in my code :-)

Actually, you have so many points, you probably don't need to use
curveTo(). lineTo() would probably work for you, and it just takes two
parameters.

Here's a class I wrote that draws something. It's probably not what
you want, but it works, at least. You can take it from here. (I
created this class in a Flex AS3 project--that's why I defined the
stage size in line 6. If you do it in Flash, you won't need that--just
set the stage size to what you want).

Cordially,

Kerry Thompson

package
{
    import flash.display.Sprite;
    import flash.display.Graphics;
    
    [SWF(width='1024',height='768',backgroundColor='#FF',frameRate='24')]
    public class GraphTst extends Sprite
    {
        private var pointX:Vector.; //vectors are much faster than 
arrays
        private var pointY:Vector.;
        private var ndx:int = 0;
        private var len:int;


        public function GraphTst()
        {
            init();
            createPoints();
            drawGraph();
        }
        
        private function init():void
        {
            // You have to create the vector in a new code line
            pointX  = new Vector.();
            pointY  = new Vector.();
        }
        
        private function createPoints():void
        {
            // first fill the vectors
            for (var i:Number= -100; i<100; i++)
            {
                pointX[ndx]=i + 100;
                pointY[ndx]=5*Math.sin(20*i);
                ndx++;
            }
        }
        
        private function drawGraph():void
        {
            // prepare to draw the graph
            graphics.lineStyle(2, 0X00); //set the line to 2 pixels wide, 
black
            len = pointX.length - 1;
            
            // Now draw the graph
            graphics.moveTo(pointX[0], pointY[0]);
            for (ndx = 1; ndx< len; ndx++)
            {
                //trace("ndx: " + ndx);
                graphics.lineTo(pointX[ndx], pointY[ndx]);
            }
        }
    }
}
    




On Mon, Aug 22, 2011 at 2:08 PM, nasim h  wrote:
> Dear  Kerry
> I 'am really appreciate u ,but the first problem that i didnt use curve to is 
> it's parameter
> it needs 4 parameter  and i cant guess how to define curve point
> do u have any idea plz tell me
>
> --- On Mon, 8/22/11, Kerry Thompson  wrote:
>
> From: Kerry Thompson 
> Subject: Re: [Flashcoders] array problem,loop.plot
> To: "Flash Coders List" 
> Date: Monday, August 22, 2011, 9:41 AM
>
> 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.; //vectors are much faster than arrays
> var pointY:Vector.;
>
> // You have to create the vector in a new code line
> pointX  = new Vector.();
> pointY  = new Vector.();
> ndx:int = 0;
> len:int;
>
> // first fill the 

Re: [Flashcoders] array problem,loop.plot

2011-08-22 Thread nasim hhhhh
Dear Kerry
Hi
I am really apreciate u , one of my bigest problem is when i want create point 
, my boss want to have an array of point that has distance between -1 to 
1 or more than it because when the user want scale graph i should use that 
stoored point to calculate new graph , but the prolem is when i want to store 
data in array this loop take a lot of time and  flash dont do anything until 
the loop finished , and after 15 s it get me eror of time or hang the program 
and close it  
in my program i should fine soulotion to draw online point plz help me

--- On Mon, 8/22/11, Kerry Thompson  wrote:


From: Kerry Thompson 
Subject: Re: [Flashcoders] array problem,loop.plot
To: "Flash Coders List" 
Date: Monday, August 22, 2011, 3:34 PM


Sure. I knew there would be bugs in my code :-)

Actually, you have so many points, you probably don't need to use
curveTo(). lineTo() would probably work for you, and it just takes two
parameters.

Here's a class I wrote that draws something. It's probably not what
you want, but it works, at least. You can take it from here. (I
created this class in a Flex AS3 project--that's why I defined the
stage size in line 6. If you do it in Flash, you won't need that--just
set the stage size to what you want).

Cordially,

Kerry Thompson

package
{
    import flash.display.Sprite;
    import flash.display.Graphics;
    
    [SWF(width='1024',height='768',backgroundColor='#FF',frameRate='24')]
    public class GraphTst extends Sprite
    {
        private var pointX:Vector.; //vectors are much faster than 
arrays
        private var pointY:Vector.;
        private var ndx:int = 0;
        private var len:int;


        public function GraphTst()
        {
            init();
            createPoints();
            drawGraph();
        }
        
        private function init():void
        {
            // You have to create the vector in a new code line
            pointX  = new Vector.();
            pointY  = new Vector.();
        }
        
        private function createPoints():void
        {
            // first fill the vectors
            for (var i:Number= -100; i<100; i++)
            {
                pointX[ndx]=i + 100;
                pointY[ndx]=5*Math.sin(20*i);
                ndx++;
            }
        }
        
        private function drawGraph():void
        {
            // prepare to draw the graph
            graphics.lineStyle(2, 0X00); //set the line to 2 pixels wide, 
black
            len = pointX.length - 1;
            
            // Now draw the graph
            graphics.moveTo(pointX[0], pointY[0]);
            for (ndx = 1; ndx< len; ndx++)
            {
                //trace("ndx: " + ndx);
                graphics.lineTo(pointX[ndx], pointY[ndx]);
            }
        }
    }
}
    




On Mon, Aug 22, 2011 at 2:08 PM, nasim h  wrote:
> Dear  Kerry
> I 'am really appreciate u ,but the first problem that i didnt use curve to is 
> it's parameter
> it needs 4 parameter  and i cant guess how to define curve point
> do u have any idea plz tell me
>
> --- On Mon, 8/22/11, Kerry Thompson  wrote:
>
> From: Kerry Thompson 
> Subject: Re: [Flashcoders] array problem,loop.plot
> To: "Flash Coders List" 
> Date: Monday, August 22, 2011, 9:41 AM
>
> 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.; //vectors are much faster than arrays
> var pointY:Vector.;
>
> // You have to create the vector in a new code line
> pointX  = new Vector.();
> pointY  = new Vector.();
> ndx:int = 0;
> len:int;
>
> // first fill the vectors
> for (var i:Number= -1 ;i<1;i+=.1)
> {
>    ndx++;
>    pointX[ndx]=i;
>    pointY[ndx]=5*Math.sin(20*i);
> }
>
> // prepare to draw the graph
> graphics.lineStyle(2, 0X00); //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 h  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

Re: [Flashcoders] array problem,loop.plot

2011-08-22 Thread Kerry Thompson
Sure. I knew there would be bugs in my code :-)

Actually, you have so many points, you probably don't need to use
curveTo(). lineTo() would probably work for you, and it just takes two
parameters.

Here's a class I wrote that draws something. It's probably not what
you want, but it works, at least. You can take it from here. (I
created this class in a Flex AS3 project--that's why I defined the
stage size in line 6. If you do it in Flash, you won't need that--just
set the stage size to what you want).

Cordially,

Kerry Thompson

package
{
import flash.display.Sprite;
import flash.display.Graphics;


[SWF(width='1024',height='768',backgroundColor='#FF',frameRate='24')]
public class GraphTst extends Sprite
{
private var pointX:Vector.; //vectors are much faster 
than arrays
private var pointY:Vector.;
private var ndx:int = 0;
private var len:int;


public function GraphTst()
{
init();
createPoints();
drawGraph();
}

private function init():void
{
// You have to create the vector in a new code line
pointX  = new Vector.();
pointY  = new Vector.();
}

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

private function drawGraph():void
{
// prepare to draw the graph
graphics.lineStyle(2, 0X00); //set the line to 2 
pixels wide, black
len = pointX.length - 1;

// Now draw the graph
graphics.moveTo(pointX[0], pointY[0]);
for (ndx = 1; ndx< len; ndx++)
{
//trace("ndx: " + ndx);
graphics.lineTo(pointX[ndx], pointY[ndx]);
}
}
}
}





On Mon, Aug 22, 2011 at 2:08 PM, nasim h  wrote:
> Dear  Kerry
> I 'am really appreciate u ,but the first problem that i didnt use curve to is 
> it's parameter
> it needs 4 parameter  and i cant guess how to define curve point
> do u have any idea plz tell me
>
> --- On Mon, 8/22/11, Kerry Thompson  wrote:
>
> From: Kerry Thompson 
> Subject: Re: [Flashcoders] array problem,loop.plot
> To: "Flash Coders List" 
> Date: Monday, August 22, 2011, 9:41 AM
>
> 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.; //vectors are much faster than arrays
> var pointY:Vector.;
>
> // You have to create the vector in a new code line
> pointX  = new Vector.();
> pointY  = new Vector.();
> ndx:int = 0;
> len:int;
>
> // first fill the vectors
> for (var i:Number= -1 ;i<1;i+=.1)
> {
>    ndx++;
>    pointX[ndx]=i;
>    pointY[ndx]=5*Math.sin(20*i);
> }
>
> // prepare to draw the graph
> graphics.lineStyle(2, 0X00); //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 h  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
> _

Re: [Flashcoders] array problem,loop.plot

2011-08-22 Thread nasim hhhhh
Dear  Kerry
I 'am really appreciate u ,but the first problem that i didnt use curve to is 
it's parameter 
it needs 4 parameter  and i cant guess how to define curve point
do u have any idea plz tell me

--- On Mon, 8/22/11, Kerry Thompson  wrote:

From: Kerry Thompson 
Subject: Re: [Flashcoders] array problem,loop.plot
To: "Flash Coders List" 
Date: Monday, August 22, 2011, 9:41 AM

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.; //vectors are much faster than arrays
var pointY:Vector.;

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

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

// prepare to draw the graph
graphics.lineStyle(2, 0X00); //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 h  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
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] array problem,loop.plot

2011-08-22 Thread Kerry Thompson
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.; //vectors are much faster than arrays
var pointY:Vector.;

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

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

// prepare to draw the graph
graphics.lineStyle(2, 0X00); //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 h  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


[Flashcoders] :: monster debugger issue ::

2011-08-22 Thread Arindam Dhar
Hi,

I am facing a monster debugger issue where in it stops displaying traces after 
a huge number of traces already been displayed. I am using the latest, 3.0.1 
and have the latest flash player debugger.


Any fix or work around ?

many thanks,

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


Re: [Flashcoders] array problem,loop.plot

2011-08-22 Thread Henrik Andersson
Use a reasonable amount of points. Don't draw more points than the graph 
is wide.


Consider using curveTo to get smoother lines.

Consider using the bulk drawing to reduce the cost of telling flash each 
point. One method call vs one per point can make a difference.

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


Re: [Flashcoders] array problem,loop.plot

2011-08-22 Thread nasim hhhhh
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?


--- On Mon, 8/22/11, Gerry Beauregard  wrote:

From: Gerry Beauregard 
Subject: Re: [Flashcoders] array problem,loop.plot
To: "Flash Coders List" 
Date: Monday, August 22, 2011, 4:31 AM

On 2011-08-22  , at 16:06 , nasim h wrote:

> for( var i:Number= -1 ;i<1;i+=.001) { arr[i]=new object() arr[i].x=i
> arr[i].y=5*Math.sin(20*i);
> functiononlinedraw()
> }

Perhaps the problem is simply that you're trying to plot too many points.  If 
you're stepping from -1 to +1 in increments of 0.001, that's 20 million 
points.  Plotting 20 million points of a sine function seems a little futile…

I suggest you try a smaller range and bigger increment first, just to see 
whether the code's basically working, e.g. go from -100 to +100 in steps of 0.1.

If speed and space are issues, try using two vectors of Numbers, one for the x 
values, the other for the y values. 

-Gerry
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] array problem,loop.plot

2011-08-22 Thread Gerry Beauregard
On 2011-08-22  , at 16:06 , nasim h wrote:

> for( var i:Number= -1 ;i<1;i+=.001) { arr[i]=new object() arr[i].x=i
> arr[i].y=5*Math.sin(20*i);
> functiononlinedraw()
> }

Perhaps the problem is simply that you're trying to plot too many points.  If 
you're stepping from -1 to +1 in increments of 0.001, that's 20 million 
points.  Plotting 20 million points of a sine function seems a little futile…

I suggest you try a smaller range and bigger increment first, just to see 
whether the code's basically working, e.g. go from -100 to +100 in steps of 0.1.

If speed and space are issues, try using two vectors of Numbers, one for the x 
values, the other for the y values. 

-Gerry
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] array problem,loop.plot

2011-08-22 Thread nasim hhhhh
sorry i correct it 
hi
In my program create x,y  and i should plot it , the number of point are too
much
2*10 ^ 8
i use for  to create point depend on it's formula but my for stuck in 1
with step .001

for( var i:Number= -1 ;i<1;i+=.001) { arr[i]=new object() arr[i].x=i
arr[i].y=5*Math.sin(20*i);
functiononlinedraw()
}

then in another function i plot the point oe by one by graphics.lineTo(x,y)
if the distance be more than 1 it will stuck in loop and give me error
more than 15S my program generate x,y and i should plot it one by one but ,
i think flash dont let me plot poin until the loop finished myproblems
1: how can i do  up senario is there better way?
2: Is there a way to set delay in for loop , and i make smal for  to show 
ploted point that user can see on that time and after delay i full  remain
on array ?
how can write this dealy?
3: is this write that array can store data  until the last index of them
,and the last index of them is last integer number ???

--- On Mon, 8/22/11, Cor  wrote:

From: Cor 
Subject: RE: [Flashcoders] array problem,loop.plot
To: "'Flash Coders List'" 
Date: Monday, August 22, 2011, 3:17 AM

Not the solution, but I notice you try to add .001 to an integer.
So the var i should be a Number?


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of nasim h
Sent: maandag 22 augustus 2011 9:12
To: Flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] array problem,loop.plot

hi
In my program create x,y  and i should plot it , the number of point are too
much
2*10 ^ 8
i use for  to create point depend on it's formula but my for stuck in 1
with step .001

for( var i:int= -1 ;i<1;i+=.001) { arr[i]=new object() arr[i].x=i
arr[i].y=5*Math.sin(20*i);
functiononlinedraw()
}

then in another function i plot the point oe by one by graphics.lineTo(x,y)
if the distance be more than 1 it will stuck in loop and give me error
more than 15S my program generate x,y and i should plot it one by one but ,
i think flash dont let me plot poin until the loop finished myproblems
1: how can i do  up senario is there better way?
2: Is there a way to set delay in for loop , and i make smal for  to show 
ploted point that user can see on that time and after delay i full  remain
on array ?
how can write this dealy?
3: is this write that array can store data  until the last index of them
,and the last index of them is last integer number ???
 


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


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


RE: [Flashcoders] array problem,loop.plot

2011-08-22 Thread Cor
Not the solution, but I notice you try to add .001 to an integer.
So the var i should be a Number?


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of nasim h
Sent: maandag 22 augustus 2011 9:12
To: Flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] array problem,loop.plot

hi
In my program create x,y  and i should plot it , the number of point are too
much
2*10 ^ 8
i use for  to create point depend on it's formula but my for stuck in 1
with step .001

for( var i:int= -1 ;i<1;i+=.001) { arr[i]=new object() arr[i].x=i
arr[i].y=5*Math.sin(20*i);
functiononlinedraw()
}

then in another function i plot the point oe by one by graphics.lineTo(x,y)
if the distance be more than 1 it will stuck in loop and give me error
more than 15S my program generate x,y and i should plot it one by one but ,
i think flash dont let me plot poin until the loop finished myproblems
1: how can i do  up senario is there better way?
2: Is there a way to set delay in for loop , and i make smal for  to show 
ploted point that user can see on that time and after delay i full  remain
on array ?
how can write this dealy?
3: is this write that array can store data  until the last index of them
,and the last index of them is last integer number ???
 


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


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


[Flashcoders] array problem,loop.plot

2011-08-22 Thread nasim hhhhh
hi  
In my program create x,y  and i should plot it , the number of point are too 
much 
2*10 ^ 8
i use for  to create point depend on it's formula but my for stuck in 1 
with step .001

for( var i:int= -1 ;i<1;i+=.001)
{
arr[i]=new object()
arr[i].x=i
arr[i].y=5*Math.sin(20*i);
functiononlinedraw()
}

then in another function i plot the point oe by one by graphics.lineTo(x,y)
if the distance be more than 1 it will stuck 
in loop and give me error more than 15S 
my program generate x,y and i should plot it one by one but , i think flash 
dont let me plot poin until the loop finished 
myproblems
1: how can i do  up senario is there better way?
2: Is there a way to set delay in for loop , and i make smal for  to show  
ploted point that user can see on that time and after delay i full  remain on 
array ?
how can write this dealy?
3: is this write that array can store data  until the last index of them ,and 
the last index of them is last integer number ???
 


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