05-14-2008, 03:03 AM
|
#1
|
|
it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
|
The ExtendedArray Class
Finally, here it is.
Quote:
METHODS
-------------------------
push():Array
extended so that it also returns the result in Array datatype
shuffle():Void
shuffles the array
includes(o, [forceMaxDepth:Boolean]):Number
returns the index position of the specified argument
can be forced to check till it reaches the max. depth
overwrite(o):Void
resets the array and pushes arguments
reset():Void
deletes the content of the array
duplicateArray(origArr:Array):Void
duplicates the source array
countOcc(o):Number
returns the number of occurence of the argument in the array
extractRandom(n:Number, [unique:Boolean]):Array
returns a new array with n elements selected randomly
from the ExtendedArray instance. returns unique values if
set so and returns as many values as possible if n exceeds
the unique content. 'null's are added for the missing values
remove(o, [all:Boolean]):Void
removes first or all the occurences of the argument from the array, if any
removeDuplicates():Void
removes all the duplicates in the array
offsetContents(n:Number):Void
offsets the contents of the array by the specified value
matches(arr:Array, [checkOrder:Boolean]):Boolean
returns whether the contents of the ExtendedArray instance matches
the content of the array specified in the first parameter. setting
the second parameter to true ensures the index order is the same
traceData([arrName:String]):Void
traces the content of the array in more detail - arrays with
brackets and commas, objects with curly braces, variables and
commas, strings with quotes, functions with <function> tag,
dates with the date wrapped in <date: > and remaining with
<other> tags. an optional array name is used in tracing
|
Attached is the class file with with a fla file (v.8) that has some examples. I hope this can be useful for some people out there.
Cheers :)
UPDATES:
v.1.4 - 'matches' method added
v.1.5 - a little bug fix in the 'traceData' method
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
Last edited by inhan; 10-08-2008 at 05:18 AM.
Reason: 'matches' method added
|
|
|
05-14-2008, 03:41 AM
|
#2
|
|
Super Moderator
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,507
|
Thanks a lot, I'll try it. I actualy made my own but you have some methods that I did not need/think about.
|
|
|
05-14-2008, 09:10 AM
|
#3
|
|
it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
|
You're welcome.
I almost forgot, my favorite is the 'traceData' method. Check that out with complicated data. That can be used with typical arrays too if integrated.
Additionally, for those who are planning to use it, I would appreciate if you could credit me in your code. Have fun.
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
|
|
|
05-14-2008, 09:56 AM
|
#4
|
|
Registered User
Join Date: Mar 2008
Posts: 51
|
This teaches me alot as a greenhorn to actionscripting. It definitely helps me in understanding the way arrays work. If i knew how to use them, my project wont be so long.... And it did be much easier to do.
|
|
|
05-14-2008, 12:19 PM
|
#5
|
|
Senior Member
Join Date: Oct 2002
Posts: 120
|
Heck no, Cheers to YOU, inhan. This 'traceData' looks fantastic. Thanks for the donation of your skills!
|
|
|
05-14-2008, 10:58 PM
|
#6
|
|
it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
|
Thanks, Caravaggio, I did all I could think of.
Something to note... The class name 'ExtendedArray' is a bit long, I know, but something like 'EArray' wouldn't tell much so I couldn't come up with a better one, sorry. I wrote that because everytime I use it I find it long myself - especially considering the lack of Flash autocompleting custom class data.
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
|
|
|
05-15-2008, 12:34 AM
|
#7
|
|
Senior Member
Join Date: Apr 2007
Posts: 4,772
|
Very nice inhan, thanks for all the work on this and thanks for sharing, looks very useful.
|
|
|
05-15-2008, 12:45 AM
|
#8
|
|
it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
|
Glad to share it.
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 02:25 PM.
///
|
|