array_count_values in Actionscript

In PHP there is a very useful function called array_count_values. It sorts an array by returning a 2 dimensional array consisting of non duplicate elements as keys, and values determined by how many times these elements appeared in the original array.

So, for example, an array [“red”,”green”,”blue”,”red”] would be converted into [“red” => 2, “green” =>1, “blue” => 1]. Duplicate elements are removed and the new array indicates how many times each, now unique value occurred in the array.

Unfortunately, Actionscript has no such function built in, so I made one. It is a modification of Senocular’s array.unique() prototype (which you can find in his Actionscript library), however rather than simply returning a unique array, it returns the 2 dimensional array mentioned above. Read : AS2 Array count values »

Posted on 20 Jun 2007
Posted in
Tagged
2 Comments
0 Trackbacks

A decent computer and lots of volume is recommended.

Well, due to the fear of slipping behind, I felt I better start learning the new Flash language, Actionscript 3, and at first glance, one of the coolest features is definitely the SoundMixer.computeSpectrum function. Read : AS3 Music Visualisation »

Posted on 14 May 2007
89 Comments
6 Trackbacks

Flash Dynamic Stacking Menu

Update: AS3 Version using TweenLite is available here

In this experiment, you can drag the boxes; when you release them the stack will shuffle to accommodate the dropped box.

I have recently been working on building an application in which I wanted to use Photoshop style ‘layers’ which the user could create, drag onto different depths and delete.

The basic idea was for the user to click and drag ‘layers’, and drop them in between others. This would cause the other layers to reposition to accommodate the new layer and to fill the gap which it had left in it’s old position. Get it? Read : Dynamic Stacking »

Posted on 13 Apr 2007
44 Comments
4 Trackbacks

Illustrated IChing

I became interested in the I Ching after reading biography of Philip K Dick, who used the I Ching to establish a lot of the content for his novel ‘The Man in the High Castle’. Read : Illustrated IChing »

Posted on 05 Apr 2007
8 Comments
0 Trackbacks

Flash Liquid Layout Dynamic Positioning

Following another post regarding using stage listeners to dynamically resize and position MovieClips in Flash, I was asked to upload and FLA as an example. The previous code can just be pasted into the actions panel and will run without any MovieClips needed, and was designed to show the StageListener function rather than showcase a particular dynamic layout.

Download: Fluid Flash Layout Example Read : Dynamic Positioning Continued »

Posted on 08 Mar 2007
Posted in
Tagged
57 Comments
0 Trackbacks

About me

Soulwire is a weblog by Justin Windle; a Creative Technologist at Lean Mean Fighting Machine, London – I often Tweet, Flik, Link and Vim.

Twitter <follow>

September 2nd 2010 - 8:44am

I Hate Perfume » http://is.gd/eR5FP