ActionScript 3.0 :: Linked List Sorting Best Algorithm?

Dec 26, 2009

I know there isn't a built-in linked list in AS3, but one can easily write his own. However, I found it difficult to come up with a good solution for sorting such list.If you didn't know, linked list is a chain of "cell" objects, where each object has a reference to the next object, typically you can write it like this:

Cell1.next = Cell2;
Cell2.next = Cell3;
CellN.next = null;

(Circular linked list and bidi linked lists are out of the scope of my problem, for now at least).

I looked into other languages that do have linked lists or even standard libraries for them, however, I don't seem to be able to either port any of their solutions, or, some of them, if ported to AS3 would not be workable (since they use recursion) or would otherwise have huge overhead because of lots of method calls etc.

I think, I'm focused on 2 possible algorithms: Merge sort and Insertion sort. These two seem to be most applicable to AS3. However, I may be wrong - so, please fill free to correct me.

View 5 Replies


Similar Posts:


Linked List In Flash Cs4?

Dec 9, 2009

I am currently making a website in flash for a football team and i would like to make a list of all the players names which link to separate player profiles in the same flash document.

View 4 Replies

Performance :: Linked List Faster Than Vector ?

Sep 10, 2011

I tried the benchmark on this site: Array vs. Vector vs. Linked list. It tests the performance of iterating over said sequences.Remarkably, iterating over a linked list is approximately 2.5x faster than a Vector.<int>. What is the reason for this counter-intuitive result?

View 1 Replies

ActionScript 3.0 :: Linked List From Text File?

Aug 18, 2011

i need to create objects with a unique name with a loop in a way that i could get this...

var n1:node=new node(12);
var n2:node=new node(22);
var n3:node=new node(32);

[code].......

View 1 Replies

ActionScript 3.0 :: Implementing A Linked List To Use Instead Of Arrays In Some Areas?

Sep 13, 2010

I was looking at implementing a linked list to use instead of arrays in some areas. But is it really worth it in AS3? I did some speed tests using 10000 objects (ints). Access is about the same as long as you know what node you're on. Removal is of course faster.But adding to the linked list is actually slower than push() by the same amount that it is faster in removal.So is it really worth it to use them?

View 1 Replies

Actionscript 3 :: Flex List Sorting Animation?

Jun 25, 2011

I have a list which displays votes cast on things in a descending order (=the dataprovider has a sort assigned). The elements have variable height, but there are not so many elements, so i do not need to use a virtual layout

My problem is that this list needs to be updated real-time and i want to make this happen with a nice animation. (e.g. if an item overtakes another by votes, then they swap places.) Anyone knows how to make this animation with Flex 4.5 (spark list)? Do i need to write a custom layout?

View 1 Replies

AS3 :: Linked List - Send LinkedList From Red5(Java) To Flex?

Jun 12, 2011

I have a linked list of data in Red5server that updating every 8 second. I want to send this linked list to Flex. is it possible using shared object? or any other solution?

View 1 Replies

Actionscript 3 :: Create A Combobox Or Listbox That Can Display A List Of Locations Sorting Them Either Alphabetically Or By The Category?

Feb 12, 2010

I have xml data that I can load into my flex app; however, I need to sort it by node.I'm trying to create a combobox or listbox that can display a list of locations sorting them either alphabetically or by the category they are in...

I can't get my head around how to format the xml or how to code the flash file to sort according to location name alphabetically and then press a button that will sort it by category 1st and second by name alphabetically.

Should I format the xml like this:

<POIs>
<location>
<name>Barbaras Bagels</name>

[code].....

View 1 Replies

Flash :: Find Out The Linked Url Of The Image And Where Is The Linked Url Code In?

Nov 29, 2011

How can find out the linked url of the image in the flash of a website? I looked for the image url some time. but couldn't find itif find the linked url of the image, and i want to alter an image linked url address. where is the code in?

View 3 Replies

Flash - Sorting Display Objects By Their Display List Depth

Aug 5, 2011

I have a list containing display objects from throughout the application (insertion order). I want to process the list either top-down (parent, child) or bottom up (child, parent). The only requirement is that either a parent is processed before any child or vice versa a child before its parent. What is a good approach? This question is not about sorting a list. It's about retrieving the depth of a particular display object.

Example
Display list:
A (root)
B1
C1
C2
D1
B2
......

My list:
list = [E1, F4, A, B2, B1, C3, ..., N9, N8]

Bottom-up:
N9, N8, F4, E1, C3, B2, B1, A

Top-down:
A, B2, B1, C3, E1, F4, N9, N8
Does not matter if N9 before N8 or N8 before N9. Important is that any N is before M (first run) or any M before its children N* (second run).

View 2 Replies

Flex - Mxmlc With Both Linked And Not Linked Rsls?

Jul 27, 2009

On the mxmlc command line, I can include paths to RSL files. I can choose to link these RSLs at runtime by setting

-static-link-runtime-shared-libraries=false What if I need to link to some rsls and embed (static-link) other rsls? Is there a way to set the link settings for each rsl?

View 1 Replies

Actionscript 3.0 :: What Algorithm I Should Use?

Dec 20, 2010

[flash=]
package app.demo.MyTouchApp{
import flash.display.Sprite;[code]..........

how to perform a search in XML, so I use the above method, kinda hard code I know...for example, I try to search " keyIn:String = "BR1014"; " means I wanna search BR1014 in 4 XML files, so I load the XML info into an array, and using for loop to loop the XML array (in this case TitleArray1[i], TitleArray2[i]...) and compare it with keyIn (which store the value BR1014), some how the value is located in TitleArray4[i] which have the length of 12 (trace(TitleArray4[i].length) = 12)

so everytime I run it, I will overwrite abc 12 times... and out put 12 time the abc value, in this case BR1014 was located in TitleArray4[3], so the 4th output of "abc" is BR1014 but others is all 999...

View 2 Replies

ActionScript 2.0 :: Crossing Algorithm?

Jun 4, 2011

I have table

words = [aaaa, bbbb,cccc,dddd,eeee,ffff]
and i want to make table like this:
words2 = [aabb,bbaa,ccdd,ddcc,eeff,ffee]

View 1 Replies

Sql :: Realization Of An Algorithm In SQL Query?

Dec 14, 2011

I have a database which has 2 tables:

CREATE TABLE RecipeDB (
RecipeID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR,[code]........

I also have an actionscript, in which I have ingArr:Array of ingredient strings.Now, I would like to realize the following queries here:

1) Select (all fields) one recipe which has the most of ingredients from the array. If more than one record have the same amount of matches, then divide the number of matches by total number of ingredients in recipe and return the one with the highest ratio. If there are no matches return nothing.

2) As above, but return 10 recipes with the most matches and do not perform check for equal number of matches. Sort the results by the number of matches.

View 2 Replies

ActionScript 3.0 :: Algorithm - Stimulate Sea Wave

Dec 15, 2011

I want to stimulate sea wave,but I have no idea about it. Is there an example code for it? I know as3 can make many good graphics and text effect, so I want to learn it eagerly,but I don't know which book should I read. Anyone could introduce a good book for me about as3 algorithm? More example code are better in the book.

View 3 Replies

Java :: Sha Or Md5 Algorithm Encrypt And Decrypt?

Feb 25, 2010

I am developing my application in flex and JSP, so when I am passing values through HTTP Service Post method with request object but these values are tracing and modifying by testing team so I am planning to encrypt values in flex and decrypt it in jsp.so is there any algorithms like SHA or MD5 more secure algorithms,

[Code]...

View 4 Replies

AS3 :: C - Implementation Of Upper Power Of Two Algorithm

Mar 1, 2011

I have been trying to implement the Round Up Power Of 2 algorithm outlined in the following link in AS3.

[Code]...

The algorithm works great for most of the values I've tested. It is mentioned that this will return 0 when given an input value of 0 which is technically incorrect but I'm ok with that output. What I'm not ok with is when given an input of 1 I get and output of 1. I'm thinking that this must be a caveat of AS3 and its wonky uint implementation but I can't seem to figure it out. I have also tried using the >>> logical shift operator to the same result. My C is a little rusty, but I'm not sure how this would even return 2 in C. Can someone explain to me whats going wrong here? I assume if an input of 1 was a special case it would have been mentioned in the above link.

View 1 Replies

Flash :: Erase Algorithm To Be Implemented Using AS3?

Jun 10, 2011

Is there any algorithm to perform erase operation in a bitmap? I would like to create functionality similar to how photoshop or other graphic application performs erase. Is erase operation so difficult that there isn't much help (for bitmaps) available? I am OK even with name of an algorithm, I can proceed from there.

View 2 Replies

Flash :: Algorithm To Create Concertina?

Sep 12, 2011

I've searched and racked to no avail.. so, does anyone have an algorithm to create a concertina type rectangle, ideally horizontally. The desired effect is exactly like that of normal horizontal Window Blinds (assume they're closed- doesn't matter) of say 30 parts (or slats) of equal height and uniform width.

When such a blind is raised half-way up notice how the parts at the bottom go from dead flat to an increasing value in height, with perhaps the top-most part hanging normally.

Similarly, when the whole Blind is all the way up, all parts are flat. Conversely, when the whole Blind is fully extended, all parts hang at their own, uniform height. It's this "slightly differing but related to my neighbors height" I'm stuck on.

View 1 Replies

ActionScript 2.0 :: A Algorithm Of The Number's Sequence?

Dec 13, 2004

how to implement this algorithm: I have number (1-100), however, it will return to 0, when it meets 10, likewise 11 returns to 1, 12 to 2...

90 -> 0
91 -> 1
...

View 3 Replies

ActionScript 3.0 :: Button Animation Algorithm?

Apr 26, 2008

I have 5 Button movieclips, each with different states, (OVER, OUT, and ACTIVATED)Obviously when you rollover the button, itll play the over animation, itll also apply for the rollout event of the button. When you click the button, itll go to the activated state.Here's my question...What condition will i use so that when a certain button is activated and i click on a different button, the activated button will play its rollout state before going to its idle state.. What's happening to me is itll just quickly go to its idle state without playing his roll out animation.

View 8 Replies

ActionScript 2.0 :: Making Algorithm Using Two Arrays?

Jul 25, 2008

I am programing with AS2 so here goes my question: I want to create an algorithm that looks up an array and finds the nearest integer in it. Lets say i have different numbers like 1, 2, 4, 5, 8, 9 and i want to find the nearest member to 6 from those numbers. How should i build the algorithm. So far i'm using two arrays and two inside loops, but cant find the right way to make it.

View 3 Replies

ActionScript 2.0 :: Cyclic Algorithm In Flash

Jun 5, 2004

my program calculates ax,ay -> using this variables -> vx,vy -> after that I calculate the little step that my mc will make, in other words I calc x,y position [code]as you can see all depend on each other...but the problem is that after getting new x,y I want this x,y to be used to calculate next step!fo every new coordinate I want new vx,vy ax ay!

View 8 Replies

ActionScript 2.0 :: An Algorithm Of The Number's Sequence?

Dec 13, 2004

I met a problem while I am learning the flash actionscript 2.The question is how to implement this algorithm: I have number (1-100), however, it will return to 0, when it meets 10, likewise 11 returns to 1, 12 to 2...

90 -> 0
91 -> 1
...

View 3 Replies

Flash - Get Shortest Number Algorithm In AS Syntax

Apr 15, 2010

I want to put shortest int in shortest:
shortest = 500;
for(i = 1; i <= _global.var_process_count; i++) {
if(_root["process" + i].process_time_original.text < shortest)
shortest = _root["process" + i].process_time_original.text ;
}
What's wrong with above lines of code?

View 1 Replies

Actionscript 3 :: Implement SHA1 Algorithm In Flex?

Dec 9, 2010

I am building an application in Flex, wherein I need to encrypt user id and password using the SHA1 alogorithm. I have not come across any standard Flex library which allows me to do this. Does anyone know how to achieve this in Flex?

View 1 Replies

ActionScript 3.0 :: Manage The Depths Of The MCs Was A BubbleSorting Algorithm

Feb 5, 2009

I'm currently working on side scroller that has an isometric-type perspective (think Double Dragon) and the only thing I could think of to use to manage the depths of the MCs was a bubbleSorting algorithm.

[Code]...

Now this works fine (because I don't have a huge amount of MCs to sort), so I guess this is more of an academic question. As far as I know, bubblesorting is pretty much one of the worst sorting algorithms out there. Has anyone successfully adapted a better one for this purpose? Not trying to get you to post your code as much as just an idea for me to play around with because I'm a geek like that.

View 0 Replies

Actionscript 3.0 :: Good Algorithm To Move Along A Path?

May 17, 2009

I have finished a little game called "math match". The idea of the game comes from "math mountain", a game is for the player who must caculate some kind of mathmatic questions, if the answer is correct, the player will move along a predefined path in several steps. I am newbie for programming games, so I am not sure what I have done in moving the role is the correct one, although it works okay. I know in Flash CS3, I can use motion guid layer to make the role move along a predefined path, but it seems it's not good in the game, or I don't know how to control it in actionscript 3.0. So I used many 'marks'(little movieclip) along the path. That divide a path into small pieces of lines, so I can move the role along the lines. If the 'marks' is enough, the precise is enough, the movement works okay.

But I think it's quite not a good method. I don't know if there is any good algorithm to move the movieclip along a predefined path, and this path is random, is hardly to be described by any math equation. I think in Flash CS3, we can draw a path by author tools, indeed Flash CS3 use some algorithm to do that. If we can get that math equation, we can simulate the movement very precisily, but is it possible? I don't know.

View 7 Replies

ActionScript 2.0 :: Mod-10 Number Validation Algorithm (modulo 10)

Jul 22, 2005

I'm looking for a Mod-10 (modulo 10) validation algorithm writen in actionscript. From a text-field, the user will enter a code and on submit, actionscript will validate if the number is right.

View 3 Replies

ActionScript 2.0 :: Algorithm For Determining Variety Within Set Of Data

Aug 25, 2006

Any algorithm to see how many different variations there are within a set of data... For example, if I had:
1 1 1 1 2 3 3 2 1 1 4
The algorithm could figure that there are 4 different "types". I don't mean 4 numbers, because there are obviously more, but 4 varieties; of course, how to go about count how many of the different types.

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved