PDA

View Full Version : building SSS (server side scipt)


eggnogg
12-20-2005, 05:13 PM
hi

im trying to build a server side script-

im a intermidiate newbie flash programmer. i got my actionscript book in front of me and the web at my service BUT i gotta be sure if the way im going to build this script is correct because there are things about php that i dont know yet, so....
my question is. i have an operation

_root["item"+FlashVariable] = new Array [var1, var2, var3];

will this work when i send it to php script? will the php treat the result of _root["item"+FlashVariable] as a variable with an array of values in it?

Billy T
12-20-2005, 10:04 PM
no I dont think so...maybe with remoting

http://www.actionscript.org/tutorials/intermediate/PHP_Remoting/index.shtml

otherwise you could implode the array to a string, send to php, then exlode

OR

something like

getVars = new LoadVars();
getVars.numValues = _root["item"+FlashVariable].length;
for (i=0; i<_root["item"+FlashVariable].length; i++) {
getVars["item"+FlashVariable+'_'+i] = _root["item"+FlashVariable][i];
}



cheers

eggnogg
12-21-2005, 11:23 PM
thanks for the answer Billy

i've chosen the flash remoting "path". just installed phpdev, amf stuff, flash remoting components, and im ready to work. the thing bugging me is the variable's name that is created in flash and sent to php


_root["item"+FlashVariable] = new Array [var1, var2, var3];


basicly what i wanna do is send a variable holding an array into a database on a server, then have a script store this variable with the array in a database, then use this database to serve another flash swf located on a webpage. this swf is supposed to get the variable with the array. i just hope this works!!

im tired as hell but im gonna start reading!
anybody have something to say please go ahead :) i could use some certainties about how im working on this problem! thanks

eggnogg
12-21-2005, 11:36 PM
ok, after reading "If your data structure is simple, Remoting may not help much. Say you request a list of products and they all return ordernum, descr, price and image_url. The code to pick up that data is fairly simple using either LoadVars or XML." i cut to the chase and simply ask the question:

what is the best way to treat _root["item"+FlashVariable] = new Array [var1, var2, var3];and storing it in a database as myVariable= ("45","ferrari","yellow"); so i can then fetch this simple data from an swf on the web?

Billy T
12-21-2005, 11:40 PM
can you just implode it to a string and store that?

eggnogg
12-22-2005, 12:19 AM
im trying to decifre the code u gave me.
is it a way to transform _root["item"+FlashVariable] into an actual variable NAME?

Flash Gordon
12-22-2005, 12:50 AM
_root["item"+FlashVariable] = new Array [var1, var2, var3];
//assign that to a array variable variable. We'll call it item1
var LV = LoadVars();
for (i=0; i<item1.length; i++) {
LV.variables += item1[i] + "-";
}
LV.sendAndLoad("php.php", LV, "POST");

$myVars = explode("-", $_POST['variables']);


*********QUASI CODE**********

eggnogg
12-22-2005, 02:45 AM
what will be the name of the variable in php then?