Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / March 2006



Tip: Looking for answers? Try searching our database.

Chained List

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
delatroy - 31 Mar 2006 13:42 GMT
Im looking to build a multi-user game in flash. Does action-script support a
chained-list? I need some kind of way to manage six users in one animation.

Refer to this URL to get a detailed example of a chained-list in C. >

http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm
.aix.cbl.doc/tpshr10e.htm
Any help with this would be great! Thanks.
P.
DELXYZ - 31 Mar 2006 15:02 GMT
Chained List is basicaly a concept. I mean the way may different but concept
will also apply here in AS.
You can use array and objects for it.
//Class...
class LinkedList
{
    private var list_arr:Array;
    private var prevNode:Number;
    private var nextNode:Number;
    private var data:Object;
   
    function LinkedList()
    {
        list_arr = new Array();
    }
   
    function addNode(obj:Object):Void
    {
        if(list_arr.length != 0)
        {
            obj.prevNode = list_arr.length - 1;
            //Next node for previous one...
            list_arr.nextNode = list_arr.length;
        }
        trace(obj.names)
        list_arr.push(obj);
    }
    function deleteNode(obj:Object):Object
    {
        if(list_arr.length != 0)
        {
            return list_arr.pop();
        }
        return (new Object());
    }
}

Implementation....
var lst:LinkedList = new LinkedList();
lst.addNode({names:"del", age:25});
lst.addNode({names:"xxxxx", age:25});
lst.addNode({names:"yyy", age:25});
lst.addNode({names:"xyz", age:25});
lst.addNode({names:"zzzz", age:25});

var obj = lst.deleteNode();
trace(obj.names)
Jeckyl - 31 Mar 2006 16:53 GMT
That a rather complicated way to do it. Can just do it with simple objects.
No need for arrays and indices like that.  Just keep a reference to the next
(and/or prev) item in the object.
--
Jecyl
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.