Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-14-2008, 03:03 AM   #1
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Post 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
Attached Files
File Type: zip ExtendedArray v.1.5.zip (11.6 KB, 100 views)
__________________
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
inhan is offline   Reply With Quote
Old 05-14-2008, 03:41 AM   #2
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

Thanks a lot, I'll try it. I actualy made my own but you have some methods that I did not need/think about.
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 05-14-2008, 09:10 AM   #3
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

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
inhan is offline   Reply With Quote
Old 05-14-2008, 09:56 AM   #4
xin24
Registered User
 
Join Date: Mar 2008
Posts: 51
Default

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.
xin24 is offline   Reply With Quote
Old 05-14-2008, 12:19 PM   #5
Caravaggio
Senior Member
 
Caravaggio's Avatar
 
Join Date: Oct 2002
Posts: 120
Default

Heck no, Cheers to YOU, inhan. This 'traceData' looks fantastic. Thanks for the donation of your skills!
__________________
ALWAYS LEARN
Caravaggio is offline   Reply With Quote
Old 05-14-2008, 10:58 PM   #6
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

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
inhan is offline   Reply With Quote
Old 05-15-2008, 12:34 AM   #7
asf8
Senior Member
 
Join Date: Apr 2007
Posts: 4,772
Default

Very nice inhan, thanks for all the work on this and thanks for sharing, looks very useful.
asf8 is offline   Reply With Quote
Old 05-15-2008, 12:45 AM   #8
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

Glad to share it.
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
inhan is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Class extends - mothod help... code management? What would you do? Darcey ActionScript 2.0 11 06-24-2009 11:13 PM
Super class won't access properties which are provided in its descendants Marsoups ActionScript 3.0 5 05-06-2008 10:42 PM
using a public class method overbyte ActionScript 3.0 5 03-25-2008 02:22 PM
Class definition memory never released ? BillyRay ActionScript 2.0 0 07-31-2007 08:56 PM
Possible to dispatch event within a class? FarFeTTu ActionScript 2.0 5 04-29-2006 11:09 AM


All times are GMT. The time now is 10:22 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.