ActionScript 2.0 :: LoadVars - Getting Variable From PHP?
Sep 27, 2004
I try to get a variable from php : I have a button with :
on (release) {
$myLoadVars = new LoadVars();
$myLoadVars_received = new LoadVars();
$myLoadVars.var_to_php = myComboBox.getSelectedItem().label;
$myLoadVars.sendAndLoad ( "script.php",$myLoadVars_received);
$affich_var = $envelope_received.var_from_php; }
PHP //
script.php :
<? $result = mysql_query( "select counter from data_base where data1='".$_POST['var_to_php']."'");
$counter = mysql_fetch_row($result);
echo ("&var_from_php=$counter[0]");
?>
My result of all this : nothing happens. no variable is received from php. (The is no request ( from the firewall ) from flash to access the internet). So I think the error is around the sendandload. By the way, the php script works perfectly with loadVariablesNum.
I am using loadVars to get strings from a text file and then I loop it to put them all in an array. But as indicated in the code, I want to check the variable name so a certain named variable will be put into a different variable, not the array. I have not been able to find how to check this...everything I try gives me undefined.
ActionScript Code: myVars.onLoad = function(success) { if (success) {
Can I bring in a variable (saved in a text file) using LoadVars and then make that variable accessible from anywhere in the script (i.e. make the variable a global)?
just wondering if there is a way to reset the LoadVars() success variable to false or undefined. i need to do this b/c i'm repeatedly fetching data from a asp file using the same LoadVars() Obj to store the data sent from the asp page.
Let's say I'd like to post some data to a server side script. If my data is
var data:String = "<data><tag1>hi</tag1></data>";
and I'd like to send it with LoadVars, I can do:
var lv:LoadVars = new LoadVars() lv.data = data; lv.sendAndLoad("http://thescript/", lv, "POST");
However, this results in the POST looking like this:
data=<data><tag1>hi</tag1></data>
if I want to send it without the variable name (no "data=", just the actual data), how is this possible? In AS3 I can just use the .data property of a URLRequest and it will work, however I can't find a way to do this in AS2.
I have an input field with the var name "chosenloc" in the same scope as the timeline I'm working in. I've set the input field var in code, on the fly, and by entering a number right into the field.
You will find enclosed a ".zip" file in wich there's a ".fla" file, a ".txt" file and 6 ".jpg" images. Frame 1 of the FLA only has a "Preload" class/constructor found on another site and works well. Frame 2 launches the graphic interface construction. The file "externalVar.txt" has one variable "maxVin" with a value of 6.
I would like to know WHY i can't acces this variable from outside of the loadVars object's scope (i would better say from outside of its ".onLoad" methode scope). In fact, when i trace my variable "maxVinNum" from outside of this function, flash player return "undefined". Even if i declare "maxVinNum" on the _root (_root.maxVinNum). For information, at the start of frame 2, i have let an instruction in comment: //var maxVinNum = 6; When we activate this instruction, then the variable is directely declared and everything works well. This test allow us to verify that scripts are not bugged. Here is the script of frame 2, some of you may understand quickly what's wrong :
For the life of me, I've tried everything: I've researched LoadVars on Adobe forum, used David Powers' books, googled 'flash to php', LoadVars, etc. and tried sendAndLoad, send, and using $_POST, $_GET, $_REQUEST. $HTTP_POSTVARS but I keep getting this same error.
I have a Unix server running Apache/PHP 4 - LoadVars worked to load name-value pairs into an array -see thread)
My goal with this simple app is to prototype being able to pass a variable from flash to a variable in php.
Parse error: syntax error, unexpected T_VARIABLE in flash_to_SQL.php on line 5
Actionscript 2.0 code:
var c :LoadVars = new LoadVars(); c.testing = "123FOUR"; c.send ("
I would like to send data from PHP to Flash however, it sends just fine but when displaying on Flash, it does not display the contents in the variable. Instead, it displays the name of the variable. This may be a simple answer but I'm quite new to this. Here is the code in Flash.
One of the moderators, could you've a look at this tutorial: [URL] it doesn't works with me, maybe because I've 2004 so if you change loadVars() into LoadVars() it should work
OK, I am trying to do my first simple user authentication for a test built in Flash. I'm just checking to see if someone with the same name and email exists in the mySQL database and then echoing out entryAllowed=false if they exist.
Code: PHP Code: //query is successful and these vars trace out in flash
I have created a site that calls in text from an external .txt file. The text file is a flat file that is updateable using PHP. What I need is for the Flash site to reflect the current contents of the text file each time it's updated through the PHP interface. I'm using the standard:
I did get it to 'kind of work' at one point, but the output text would flash 'undefined', then show the contents of my text file, then go blank then start that loop over again. Not acceptable.
I am converting a class into AS3 (was AS2). What would be the best way to replace the loadVars ? This is how the code looked like in AS2
ActionScript Code: public function load(csvPath:String): void { // Use the LoadVars class to load in the CSV file as a String var csvLoad:LoadVars = new LoadVars();
I have managed to develop code that will run a php script by passing a variable (obtained from a combobox control) to the MySQL database. Initially this works fine but if I try to repeat the excercise using a different value nothing happens.[code]...
I have read a little bit about loadVars and loadVariables, so I am trying to read and write to a .txt on my server. This is my functions: (only Read works, but Send doesn't)
ActionScript Code: function Load(F, VAR) { var DATA:LoadVars = new LoadVars();[code]...........
There are no errors or something; but the file is the same after Send();
Okay, so ive loaded some data from PHP into a textbox in Flash with loadVariables, but then found out, that loadVariables, havent got a way of checking if everythings loaded. So im gonna use LoadVars instead,This is the old loadVariables code:
Just wondering if you can use the sendAndLoad method of the Loadvars object to send "POST" data to a server then recieve the response in an XML object.
I am using the loadVars class (Flash 8) to load key/value pairs from a mySQL database through php (example &pic1=pic1.jpg&pic2=pic2.jpg&...).
The ultimate goal is to create a dynamic slideshow with a variable length, depending on how many pics were submitted by the user. Since the associative array object returned by loadVars does not share the "length" property of indexed arrays, my guess is that the values need to be converted into a new indexed array before being able to use them in the slideshow.
I have a project that needs to store user input on the server, then be able to reload it later.I am interested in opinions as to which separator would be best to use, ie comma, semicolon, tilde, etc. Of course whichever character it is, it will be restricted from usage by the user, so it must be uncommon.I'm leaning towards using the tilde, since I already use input textfield restrictions to prevent backticks for server security (same key on the keyboard). Seems to me as if the tilde is a very rarely used character, and so should be fine to exclude it from user inputs as well.
i'm currently trying to make a "create you're own guy" type thing, i dont have any clothes right now i just have skin colour and eyes, but it works on frames, like if you have frame 1 of eyes you'll have asian looking eyes. etc.
my problem is that, it only loads the first variable from my php doccument, ive tested everything, and all, switching up my 2 variables, and when EYES comes first in the doccument only eyes load, and when SKIN comes first in the php doc only skin loads...
but anyways heres my code.
Code: Var = new LoadVars(); Var.load("http://THISISMYSITE.com/site/phptest.php"); eyes.onEnterFrame = function() {
I need to load an image and 2 dynamic text fields tied to the TWEEN CLASSand controlling the SWF file via HTML ONLY - no PHP or external .TXT fileI want to change info in HTML code to change content of the SWF filecan this be done?