A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: sorting XML data

  1. #1
    Huge Male Member BigFerg's Avatar
    Join Date
    Dec 2000
    Leeds, UK

    The problem I have is how to handle Xml data once I have got it into flash. I can write the loops to find the records I want and to make each field into an array (eg one array for passwords, one for usernames, etc.), but now I am not sure how to keep the arrays in sync. For example if I sort the usernames alphabetically, how can I have the passwords sorted into the same order? Am I going about this the right way?

    It has occurred to me that I should sort each record into a seperate array (eg. array1 has 1 username and the related password, array2 has the second username and related password, and so on...), but this is not the method the tutorial I used to learn how actionscript handles XML worked so I am a bit worried that there may be further implications I don't know about.

    Or alternatively, should I be putting the records I want into a new XML object? But then how would I sort it?

    As you can probably tell I am quite new to programming and would really appreciate a shove in the right direction.


  2. #2
    Senior Member
    Join Date
    Feb 2001
    Does that mean you load your full database of users and passwords into flash? i don't think this is good idea, for security and speed reasons. people can see passwords of the others then, download time increases with every new user and flash isn't what i'd call fast for processing xml data. also text operations are quite lame.

    I suggest to use serverside authentification and XML parsing. You could write a script that get's the users login info and looks in your xml if the user exists. if he exists and the password is correct the script returns some value telling flash that login was successful.

    If you like to sort and show all users/passes in the movie (why?) i'd suggest to take a look at XSLT. There're many serverside solutions out there i.e. for perl, php and apache itself. XSLT is quite easy to learn and makes it very easy to sort XML data.

    http://www.xslt.com/ - general info, tutorials
    http://www.zvon.org/xxl/XSLTreference/Output/index.html - a reference
    http://www.gingerall.com/ - sablotron (can be used with PHP)
    http://xml.apache.org/xalan-c/sample...achemodulexslt - the apache module

    for sorting your 2 arrays in flash i suggest to sort the names and create a second array holding a list of the the names new position in the sorted array. then you can loop through the passwords array and change their positions as they are set in the list of new name positions array.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center