A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] Sending And Updating Multiple XML Elements

  1. #1
    Junior Member
    Join Date
    Feb 2006
    Posts
    19

    [F8] Sending And Updating Multiple XML Elements

    Hey, I'm about to give this little application a bash at the minute but am struggling to grasp what needs to be achieved.

    Basically I have an XML which looks like (for example):

    <player>
    <uid>1</uid>
    <name>Bob</name>
    <positionx> </positionx>
    <positiony> </positiony>
    </player>

    <player>
    <uid>1</uid>
    <name>Bob</name>
    <positionx> </positionx>
    <positiony></positiony>
    </player>

    Now positionx and y are going to be the elements co-ords on the stage, I've currently got them appearing but I want to be able to effectively save their new x / y co-ords to the XML file without having to re-write the XML from scratch.

    Effectively a logic of
    -Drag movieclip(uid =1 (name=bob)) to a new position.
    -press a button
    -Flash sends the new X and Y location of the movie clip to a coldfusion script which then finds the <player> element with the uid of 1, and inserts the x location into the <positionx> part and the y location into <positiony>.

    Does this make sense? I'm just currently researching the best method to do this as there are going to be multiple elements (wont just have to update uid=1/name=bob but also about another 10 movie clips on the stage).

    Anyone offer any advice?

  2. #2
    Junior Member
    Join Date
    Feb 2006
    Posts
    19
    Ok, basically i'm gonna start with just trying to get the right variables to the coldfusion script and i've come up with this.

    All the elements are on the stage and are named "Shirt" + i (where i is a number).

    There is a button at the bottom called save, with this script attributed to it.

    Code:
    on(press){
    		vars = new LoadVars();
    		
    		for (i=0; i<my_xml.childNodes.length; i++) {
    			vars.id = i;
    			vars.xposition = _root["shirt" + i]._x;
    			vars.yposition = _root["shirt" + i]._y;
    			
    			vars.send("http://www.roptix.co.uk/flashtest.php", POST)
    		}
    }
    (i'm using a small php script to simply write the variables to a file (our CF server is broken atm) not doing anything to them), however when i press the save button nothing happens and the file the script is supposed to write to stays empty. (php works as i've tried writing with GET and accessing it directly with a variable in the URL)

    EDIT: doing
    Code:
    trace(vars)
    shows exactly what i want it to achieve... yet i can't get it to send... whats the problem ?
    Last edited by Ryu85; 04-29-2007 at 12:14 PM. Reason: new information

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