I have an on Clip looks loke this:
onClipEvent (load) {
//assuming you have a personal web server and PHP installed locally
loadVariables("http://www.guyswebdesigns.com/PHPfolder/test.php?Id=Id", this,
"GET");
}
I use the Id=Id to load my text boxes. Id =Id retrieves data that I would like
to use in an (If Statment)
How would I do That?
Guy
MotionMaker - 19 Apr 2007 12:24 GMT
1. You should be using
http://livedocs.macromedia.com/flash/8/main/00002336.html. The example there is
a good template to plop into the code.
2. You should be giving your TextFields and instance name and using the
http://livedocs.macromedia.com/flash/8/main/00002784.html property versus
using a variable assigned to the TextField.
//LoadVars object named send_lv.
//TextField object named my_txt.
send_lv.id=my_txt.text;
onelotusguy - 19 Apr 2007 20:57 GMT
Her is my code:
var send_lv:LoadVars = new LoadVars();
var my_lv:LoadVars = new LoadVars();
my_lv.onLoad = function(success:Boolean) {
if (success) {
//send_lv.Id=ID_txt.text;
button1.maxQuantity = "1" ;
button1.name = templete;
button1.price = "450";
button1.option1Name = "domain";
button1.option1Value = "included";
trace(this.toString(my_lv));
} else {
trace("Error loading/parsing LoadVars.");
}
};
my_lv.load("http://www.guyswebdesigns.com/PHPfolder/test.php?Id=Id", this,
"GET");
my_lv.Id=ID_txt.text;
I used (my_lv.Id=ID_txt.text;) The instance name still does not get filled out.
Did I just put the (my_lv.Id=ID_txt.text;) in the wrong place?
Guy
MotionMaker - 19 Apr 2007 21:22 GMT
send_lv.Id=ID_txt.text;
send_lv.sendAndload("http://www.guyswebdesigns.com/PHPfolder/test.php");
onelotusguy - 19 Apr 2007 21:52 GMT
Her is what I have so far
send_lv.Id=ID_txt.text;
trace(this.toString(send_lv));
send_lv.sendAndLoad("http://www.guyswebdesigns.com/PHPfolder/test.php");
Results in the output box:
[object Object]
No instance name, h=what next?
Guy
MotionMaker - 19 Apr 2007 23:11 GMT
1. a. toString is a method and not a function. Thus you are getting the string
representation of the this variable which is an object.
1.b. toString has no arguments.
2. To dump an object this is the code
foreach (key in send_lv)
{
trace(key +":" + send_lv[key]);
}
onelotusguy - 20 Apr 2007 01:15 GMT
Here is the code I have so far
var my_lv:LoadVars = new LoadVars();
var send_lv:LoadVars = new LoadVars();
send_lv.onLoad = function(success:Boolean) {
if (success) {
button1.maxQuantity = "1" ;
button1.name = "product";
button1.price = "450";
button1.option1Name = "domain";
button1.option1Value = "included";
trace(this.toString(send_lv));
} else {
trace("Error loading/parsing LoadVars.");
}
};
send_lv.Id=ID_txt.text;
send_lv.load("http://www.guyswebdesigns.com/PHPfolder/testpage.php");
foreach (key in send_lv)
{
trace(key +":" + send_lv[key]);
}
I get an error on foreach (key in send_lv)
here is the error:
**Error** Scene=Scene 1, layer=Layer 7, frame=5:Line 38: ')' or ',' expected
foreach (key in send_lv)
Total ActionScript Errors: 1 Reported Errors: 1
Next I put this(send_lv.Id=ID_txt.text;) code at the end just above the link
to the php.
I set the instance name to ID_txt for my text but nothing comes thru
This is what I get in my output box
option2%271=included&option1%271=domain&Quantity1=1&price1=450&templete1=product
1&id1=1 %3B%3C%2Fp%3E%0A=&%3Cp%3E=&Id=&onLoad=%5Btype%20Function%5D
What did I miss?
Thank You
Guy
MotionMaker - 20 Apr 2007 12:00 GMT
Re:
**Error** Scene=Scene 1, layer=Layer 7, frame=5:Line 38: ')' or ',' expected
foreach (key in send_lv)
Sorry wrong language on the foreach. Probably PHP or Perl or somthing
For Actionscrip use
for (key in send_lv)
{
trace(key +":" + send_lv[key]);
}
See: http://livedocs.macromedia.com/flash/8/main/00001872.html
onelotusguy - 20 Apr 2007 20:46 GMT
Is there any way I can scan thrue the line below to pick out product1 and use it in the If statment?
nbsp%3B%3C%2Fp%3E%0A%20product1=&%3Cp%3E=&ID=&onLoad=%5Btype%20Function%5D
Guy