Re: [Flashcoders] Array Limit

2011-08-04 Thread Pedro Taranto
you should consider to use a linked list

--
Pedro Taranto


On Thu, Aug 4, 2011 at 4:26 AM, Kerry Thompson wrote:

> Deepak Sahu wrote:
>
> > consider a vector..its faster than array.
>
> It is. There are a couple of essential differences you should know of.
> Primarily, all the elements of the vector need to be of the same type.
> I think it will work with objects.
>
> The other difference is that you can't have empty elements in a
> vector. This is perfectly legal for an array:
>
> arr[0] = 0;
> arr[1] = 1;
> arr[100] = 100;
>
> You have 99 empty elements in that array--that is, there is nothing in
> arr[2]...arr[99].
>
> You can't do that with a vector. I think the compiler will throw an
> error. If not, you'll get an error at runtime.
>
> Cordially,
>
> Kerry Thompson
> ___
> 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 Limit

2011-08-04 Thread Kerry Thompson
Deepak Sahu wrote:

> consider a vector..its faster than array.

It is. There are a couple of essential differences you should know of.
Primarily, all the elements of the vector need to be of the same type.
I think it will work with objects.

The other difference is that you can't have empty elements in a
vector. This is perfectly legal for an array:

arr[0] = 0;
arr[1] = 1;
arr[100] = 100;

You have 99 empty elements in that array--that is, there is nothing in
arr[2]...arr[99].

You can't do that with a vector. I think the compiler will throw an
error. If not, you'll get an error at runtime.

Cordially,

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


Re: [Flashcoders] Array Limit

2011-08-04 Thread Kerry Thompson
Dave Watts wrote:

> If you want to reuse it, just redeclare it. If you want it to be
> garbage-collected (you don't want to reuse it), things become a bit
> more complicated I think.

There's not a way of forcing garbage collection that I know of. You
can make an array eligible for garbage collection by removing all
references to it (e.g., myArray = null should do it).

There are two ways of re-declaring it so you can use it over. myArray
= []; will do it, as Dave mentioned. myArray = new Array(); will also
do it. I believe that frees up the space used by your array, and it
can be garbage collected. The Flash VM has its own ideas about when
garbage collection happens, though--you can make something available
for garbage collection, but, as I said, you can't force it.

Cordially,

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


Re: [Flashcoders] Array Limit

2011-08-04 Thread Deepak Sahu
consider a vector..its faster than array.

On Wed, Aug 3, 2011 at 11:37 PM, Dave Watts  wrote:

> > And to get the last point var point = myarray[myarray.length -1]
>
> OK, I misread the question and didn't subtract 1 as a result. D'oh!
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> http://training.figleaf.com/
>
> Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
> GSA Schedule, and provides the highest caliber vendor-authorized
> instruction at our training centers, online, or onsite.
> ___
> 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 Limit

2011-08-03 Thread Dave Watts
> And to get the last point var point = myarray[myarray.length -1]

OK, I misread the question and didn't subtract 1 as a result. D'oh!

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Array Limit

2011-08-03 Thread Sumeet Kumar
4000 is not a very small number for array... I have tested it for very high
values. and you will hit the loop limit before you hit the array limit. So
4000,1 , 10 array should be fine. 

For making an array empty  just assign myarray = []

And I believe array is the best method to do it

And to get the last point var point = myarray[myarray.length -1]




-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of nasim h
Sent: Thursday, August 04, 2011 11:12 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Array Limit

I want to have an array of x,y I use array of object like this var
arr:Array=new Array arr[0]=new Object()
arr[0].x=10
arr[0].y=22

..
I have 4000 or more point because i want to save point of draw wave tore
draw it . i use array to save point what is Array limit 
and is there better way to do it
how can i emty array to use it again ?
how can i get last point
thx

___
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 Limit

2011-08-03 Thread Dave Watts
> I want to have an array of x,y I use array of object like this
> var arr:Array=new Array
> arr[0]=new Object()
> arr[0].x=10
> arr[0].y=22
>
> ..
> I have 4000 or more point because i want to save point of draw wave tore draw 
> it . i use array to save point
> what is Array limit 

Straight from the docs:

"Indexed arrays use an unsigned 32-bit integer for the index number.
The maximum size of an indexed array is 232 - 1 or 4,294,967,295. An
attempt to create an array that is larger than the maximum size
results in a run-time error."

> and is there better way to do it

I don't know. An array seems suitable to me.

> how can i emty array to use it again ?

If you want to reuse it, just redeclare it. If you want it to be
garbage-collected (you don't want to reuse it), things become a bit
more complicated I think.

> how can i get last point

arr[arr.length]

I'll add that I'm not a Flash developer, although I work with Flex
some, so others may have better answers. But all of the questions you
asked are easily Googleable.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders