LoadVars.sendAndLoad Not Calling OnLoad
Hypothetically, in what kind of situation would a call to LoadVars.sendAndLoad not call onLoad? Are there any? Or will sendAndLoad always call onLoad at some point, even if it is just onLoad(false)
Thanks,
dege
FlashKit > Flash Help > Flash ActionScript
Posted on: 09-02-2004, 02:59 PM
View Complete Forum Thread with Replies
Sponsored Links:
Can't Receive From PHP Using LoadVars, SendAndLoad And OnLoad
Hello,
I can't belive that I am unable to get the simplest of concepts to work
I was trying to setup a simple email page in flash using PHP for a backend. I could receive the email, but the form never changed. All of the data placed into the form, stayed in the form.
To try something a little more simple (I am a newb), I setup a flash page with one input text box (instance name of incoming_txt), a submit button (instance name of btnSubmit) and one dynamic text box (instance name of outgoing_txt). The idea was to type into the input text box, click submit and what ever I typed would be sent to a PHP script and then back to Flash and displayed in the dynamic text box. Simple right? Well, it doesn't work.
I can type in the input text box, I can click submit, but all I ever get in the dynamic text box is 'undefined'. My .fla consists of three layers (actions, form and button) and 1 frame for each layer.
Here's my ActionScript:
Code:
//###################################
//## Start by creating LoadVars objects.
//## The first one sends data
//## The second one receives data
//###################################
dataSender = new LoadVars();
dataReceiver = new LoadVars();
//################################
//## Submit Button Behavior
//################################
btnSubmit.onRelease = function()
{
//assign properties to LoadVars object
dataSender.incoming = incoming_txt.text;
//send data to script
dataSender.sendAndLoad("stepOne.php", dataReceiver, "POST");
//handle return data
dataReceiver.onLoad = function()
{
outgoing_txt.text = response;
}
}
I think the problem is in the outgoing_txt.text = response; line. I've tried other things there but nothing seems to work...
Here's my php:
PHP Code:
<?php
$thetext = stripslashes(trim($_POST['incoming']));
echo urlencode('response=' . $thetext);
?>
Anyone have any idea what I'm doing wrong?
TIA,
DigitalGypsy
[edit]To correct title[/edit]
View Replies !
View Related
Help LoadVars.send Vs. LoadVars.sendAndLoad
OK, my understanding is that if example 1 works so too should example 2:
Example 1:var my_lv:LoadVars = new LoadVars();
my_lv.overall_score = _root.overall_score;
my_lv.send("score.php", _blank, "GET");
Example 2:var my_lv:LoadVars = new LoadVars();
my_lv.overall_score = _root.overall_score;
my_lv.sendAndLoad("score.php", result_lv, "GET");
My understanding is however clearly wrong as example 1 will pass the variable quite happily to my php script which will update appropriately. In example 2, nothing. Nada. Variables aren't availabe to php and (therefore unsurprisingly) my_lv.onload isn't picking up any return.
Where am I going wrong this time?!
Cheers,
Andrew
View Replies !
View Related
LoadVars.send VS LoadVars.sendAndLoad
Last edited by gkcohen : 2004-04-23 at 09:19.
can someone tell me what the difference is with these two. here is my problem. i am trying to submit some info to php script. i have my variables in text file.
if if loadVars.load("textFile.txt");
and then say loadVars.send(url, "_blank", "post") then it will work. but i dont want to load the resulting php page outside of flash. if instead i do loadVards.sendAndLoad(url, dataReceiver, "post") then it will not work. my dataReceiver will return blank, or i will get an error that the variables were not sent.
i guess that you cant loadVar from a text file and then use it with sendAndLoad, is that right?
the reason for using the text file is the real problem. the php script requires a variable 'group_ids[]' with an integer for a value. apparently, flash cant read the variable with the '[]' in it. i have tried different ways to get it formatted, but it wont work. i tried do something like loadVars.group_ids + "[]" = 1 but i get message stating the the object to the left of the operand must be a variable.
my only fix was to use a text file to load this variable. it works, but only when using the send and having a php srcipt popup.
i am not too familiar with php to modify the scipt, and i think that variable needs to be an array.
i dont know what else to do. HELP
gkc
View Replies !
View Related
Using SendAndLoad And OnLoad() From Externally Loaded SWFs?
My site basically uses movieclips to load things in a similar method to HTML frames...I have set up a simple forum using php and mySQL, and everything works fine...provided that the forum's swf is loaded as _root...however when i have the index.swf up and load in the forum's swf as a movieclip, nothing works properly...what it is supposed to do is through a sendAndLoad kick out the forum name that should be retrieved to a php script, then return the text and display it in a dynamic text field...simple...and working when layers are not in the way...it still sends the data properly...but the text does not return, or at least does not display...
on (release) {
sendout.forum=topic.getValue();
sendout.sendAndLoad("HIDDEN FOR POSTING", read, "POST");
}
is the button's code and
read = new LoadVars();
sendout = new LoadVars();
read.onLoad = function(success) {
if (success) {
forumtext.text = read.displaycomment;
}
};
is on frame 1...the variable returned by php is 'displaycomment' and on the stage the dynamic text box is 'forumtext'....
as i say, when this swf is loaded in the browser all is well...but when it is loaded into the main swf, it all falls appart...
any help would be greatly apperciated...
index: www.ancalagon.net/index.swf
standalone: www.ancalagon.net/whatwassaid.swf
View Replies !
View Related
LoadVars.sendAndLoad
I'm still having trouble dealing with this sendAndLoad thing.
As long as i use .send it works (although it does open a new window with the output ), but as soon as i use .sendAndLoad the data is not send, and i get no response. This can not be a security thing, since my .swf file and the .isa i am calling are on the same domain.
I've been looking at other threads about this, but haven't found my answer yet...
anyone?
bates out...
View Replies !
View Related
LoadVars.sendAndLoad.oh-boy
Hi,
Anyone got an idea on these ones...
1.
when the loadVars.sendAndLoad executes does it include the "?" to form a query string? I'm getting pretty unreliable results trying to call an asp script for a shopping cart I'm building.
2.
tell me there's no difference 'twixt using the loadvars object on the _root timeline or inside a childMC. Whadja think?
And whilst I'm here...
3.
what's the crack with relative/absolute target paths when using say, an XML object? If the object is declared within "firstMC" which is on the main timeline, do I need to use _root.firstMC.myXML to target it from elsewhere in the movie.
Lastly,
Why's that pink duck only got one leg?
Oh God......
Thanks,
Scott
View Replies !
View Related
Plz Help With LoadVars.sendAndLoad()
[code]on (release) {
var ltimes = _global.times;
var lshortcode = _global.shortCode;
var loriginatoradress = mob.text;
var lmessages = _global.messages;
sendable = new LoadVars();
sendable.DestinationAddress = lshortcode;
sendable.OriginatorAddress = loriginatoradress;
sendable.Message = lmessages;
sendable.MessageId = "123";
sendable.Operator = "Verizon";
sendable.sendAndLoad("http://www.idinteractive.co.uk/wap/receivesms.php", sendable, "POST");
the page is working fine when i replaces the following line
Code:
sendable.sendAndLoad("http://www.idinteractive.co.uk/wap/receivesms.php", sendable, "POST");
with this line
Code:
sendable.send ("http://www.idinteractive.co.uk/wap/receivesms.php", "_blank", "POST");
the php page is sending values to database. When i send the values via LoadVars.send() method, all values goes into server database but when i send the values using LoadVars.sendAndLoad() the values don't go to database. plz plz help i have spent hours on this problem, i would be very thankful.
View Replies !
View Related
LoadVars.sendAndLoad() Help Plz
I am looking for a simple function script using LoadVars.sendAndLoad()to send html formatted text from a textfield in flash to a php script.
My text field has an instance name of myText and a variable name of myTextvar.
The php script is called page1.php and is set up to recieve the variable.
PHP Code:
$myTextvar = $_POST['myTextvar'];
the submit button is called 'submitButton'
Any help is much appreciated. I've already tried a few ideas and I understand the basics of how this script is supposed to function but can't get it to work.
View Replies !
View Related
LoadVars SendAndLoad Xml Php
Hi all,
I'm using mx2004 and I'm trying to send large query strings to a php file with loadVars() and sendAndLoad. Needless to say, when the query string gets to 2033 characters in size, the .php page doesn't respond. I'm going to be sending around 10000 characters from flash to the php script.
I found mention of using xml to send the data to a php script, but I'm not having any luck learning how. The closest I came, was a post that says to use xml and then the poster says "..and I'm sure you know how to do that" (really helpful), or a page that requried php to write the xml file, which seems useless, when it should be flash writing the file, then php picking it up to parse for a database insert.
Can I have some input or maybe a link to a tut that can get my data from flash to php? this is the only thing keeping me from finishing my project.
I've never actually HAD to use xml for anything, so unfortunatly, this is very new to me.
Thanks!
View Replies !
View Related
LoadVars - SendAndLoad?
I've a little problem:
Normally I use the sendAndLoad function to send variables from flash to a PHP script and then do something (like writing the variables to a database)
Now i have a PHP script who "creates" a variable for me and i want to send that variable to flash. But i don't know how!?
Does anyone know how to achieve this?
View Replies !
View Related
LoadVars.sendAndLoad
Need some help getting back the answervariabel from the phpfile
turns up undefined, the code
PHP Code:
lv = new LoadVars();new_lv = new LoadVars();new_lv.onLoad = function() {if (this.sent== "OK") {statusmsg.text = "something";play();} else {statusmsg.text = "something else";play();}};function sendMessage() {lv.text1 = t1.text;lv.sendAndLoad("textfiles/movie1writer.php", new_lv, "POST");statusmsg.text = "checking...";}
PHP Code:
<? $fd = fopen("movie1.txt", "w"); $write = fwrite($fd, "text1=$text1"); if ($write){ echo urlencode("sent=failed"); }else{ echo urlencode("sent=failed"); }
View Replies !
View Related
LoadVars And SendAndLoad
Hi all,
I am looking for some help please.
I have been working with the code below to transfer variables from one asp page to another via Flash.
Code:
gatherData = function ()
{
myData = new LoadVars();
myData.fromFlash = sfid;
input_txt.html = true;
input_txt.htmlText = myData.fromFlash;
myData.toFlash = this.toFlash;
myData.onLoad = function ()
{
display_txt.html = true;
display_txt.htmlText = myData.toFlash;
};
myData.sendAndLoad("sample.asp", myData, "POST");
};
gatherData();
It works just fine in a test swf.
I am wanting to run this function at the start of an existing fla to check for variables before playing the rest - but it just will not work.
Do I simply copy and paste the entire function to the top of the Actionscript?
Here is the first part of the AS of the existing FLA....
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var thisWidth:Number;
var thisHeight:Number;
var maximumHeight:Number;
var maximumWidth:Number;
var oldx:Number;
var oldy:Number;
var ratio:Number;
var toggle_flag:Boolean = false;
var mclis:Object = new Object();
mclis.onLoadInit = function(target_mc:MovieClip) {
thisWidth = target_mc._width;
maximumWidth = 180;
thisHeight = target_mc._height;
maximumHeight = 179;
I thought I read somewhere that there is something different about Loadvars with mx.transitions - but I may be horrible mistaken.
Any help would be appreciated - I am rather lost.....
View Replies !
View Related
LoadVars, OnLoad?
Hi all,
I'm using the LoadVars object to pull data from an ASP.net script. I'm having some trouble with the function that I set up to trigger once the data has loaded.
So a simple question:
When you use loadVars, does the success function fire off as soon as data is loaded or when all of the data is loaded?
Someone told me that I needed to add a loop to make sure all of the data is loaded... but I though you didn;t need that if you use the LoadVar object...
Thanks
View Replies !
View Related
LoadVars.onLoad Help
hi
i am using loadvars to load url encoded data from a php file.
when i trace the output it shows that the variables have been retrived successfully.
now i need to use the values by assingning then to a variable. i cant seem to get this going
i am using flash 8 with as2.
myVars.onLoad = function (success) {
if (success) {
trace (" variables loaded ");
ad1id.text = myVars.ad1id;
ad1src.text = myVars.ad1src;
clipid.text = myVars.clipid;
clipsrc.text = myVars.clipsrc;
ad2id.text = myVars.ad2id;
ad2src.text = myVars.ad2src;
} else {
trace (" Error loading variables ");
}
}
is the above method used for assigning the variables correct.
i need to use the values of the variables on the left in another part of the script. the script extracts url encoded data from a php script very successfully i have already check this with trace.
ram
View Replies !
View Related
LoadVars OnLoad
Is there any fixed sequence in which onLoad and onData event handlers of LoadVars object is called.
And are there any chances that following code snippet written in the first frame of timeline lead to infinite loop showing the error "The script in your movie is making the Macromedia Flash Player to run slowly. Do you want to abort the script?"
stop();//stop till everything gets loaded
myLoad=new LoadVars();
myLoad.load(<someip>,myLoad);
myLoad.onLoad=getMy;
function getMy(success)
{
if(success)
{
play();//go ahead when everything is loaded
}
else
{
//show some message if loading unsuccessfull
}
}
which is correct method to use in this situation.
onLoad or onData?
Please reply as soon as possible.
View Replies !
View Related
LoadVars OnLoad
Is there any fixed sequence in which onLoad and onData event handlers of LoadVars object is called.
And are there any chances that following code snippet written in the first frame of timeline lead to infinite loop showing the error "The script in your movie is making the Macromedia Flash Player to run slowly. Do you want to abort the script?"
stop();//stop till everything gets loaded
myLoad=new LoadVars();
myLoad.load(<someip>,myLoad);
myLoad.onLoad=getMy;
function getMy(success)
{
if(success)
{
play();//go ahead when everything is loaded
}
else
{
//show some message if loading unsuccessfull
}
}
which is correct method to use in this situation.
onLoad or onData?
Please reply as soon as possible.
View Replies !
View Related
OnLoad Or LoadVars
Have I just found some code to load xml into Flash:
moXML = new XML();
moXML.onLoad = makeArray;
moXML.load("xmltest.xml");
Previously I was loading the info in from a .txt file using:
var oVars = new LoadVars();
oVars.load("asp_data2.asp", "_root");
which method should I use?
monkey
View Replies !
View Related
LoadVars.sendAndLoad Frustration
I am trying to simply display the variable sent back to Flash from CF. I'm sorry to be asking such a basic question, but I can't make sense of where the problem is. My actionscript is:
on (release) {
sendVars = new LoadVars();
sendVars.clientID = clientID;
sendVars.clientPassword = password;
getVars = new LoadVars();
getVars.session="";
message_txt.text = "authenticating...";
sendVars.send("clientLogin.cfm", "_blank", "POST");
getVars.onLoad = handleReply;
function handleReply(success) {
if (success) {
message_txt.text = getVars.session;
} else {
message_txt.text = "no";
}
}
sendVars.sendAndLoad("clientLogin.cfm", getVars);
}
the "sendVars.send("clientLogin.cfm", "_blank", "POST");" line is indicating that CF is returning:
session=1234
When I enter the correct clientID and password message_txt.text displays "authenticating..." then goes blank when it should display the value of getVars.session.
What am I doing wrong?
On a related note, how are we supposed to paste code into our messages to get the:
code
------------------------
------------------------
format?
R
View Replies !
View Related
Help With LoadVars()/sendAndLoad() In My Form
Hi there,
I've been trying to figure this out and the documentation is really confusing, at least to me. First, I have a basic HTML form that I am submitting with a flash button. To do that I am doing this:
Code:
(actionscript on button)
on (release) {
getURL("javascript:flashFormSubmit();");
}
(javascript in page)
function flashFormSubmit()
{
var myForm = document.forms[0];
myForm.submit();
}
That has tested to work fine. Now, the next thing I need to do is tell the server which button has been pressed, since there are multiple submit buttons. This is where things are confusing. How can I send some kind of variable to the server on post along with the form submission?
First I tried setting a variable...
Code:
set ("submitted", "pestcontrol");
But couldn't figure out how to send it. Then I found this code"
Code:
var ldata = new LoadVars();
ldata.dataToSend = "pestcontrol";
ldata.onLoad = function(success)
{
if(success){
trace(this.dataReceived);
} else {
trace("error");
}
}
ldata.sendAndLoad("self2.html?submitted=pestcontrol", ldata, "POST");
self2.html is the page I am posting to for my testing. Adding this has no effect on my page. I tried to put it after the on(release) and that did nothing either. A few things are confusing, first of all the method is POST here but the URL shown is a GET string.
Secondly, since I am submitting the form with javascript, I don't see how anything outside the HTML can be sent. How can I insert my variable to get sent along with the post?
Sorry this is convoluted but I am fairly confused - all I want to do is send a button name that can be read in the POST.
Thanks
Tom
View Replies !
View Related
LoadVars, SendAndLoad + Delegate = ?
Hello, I am having a few problems with loadVars and Onload.
The onload gets called fine, but it's not pulling in the variable from the asp page.
ASP CODE--
response.Write("&userInfo =false")
Flash Code --
Code:
public function login() {
trace("login");
var login_lv = new LoadVars();
login_lv.onLoad = Delegate.create(this, function (userInfo:Object) {
trace(userInfo);
});
_global.username = formParent.f_name.text;
login_lv.username = formParent.f_name.text;
login_lv.password = formParent.f_password.text;
login_lv.sendAndLoad(_global.serverURL+"login.asp",login_lv,"POST");
}
FLASH CODE THAT WORKS---
Code:
public function login() {
trace("login");
var login_lv = new LoadVars();
login_lv.onLoad = function() {
if (this.userInfo == "true") {
trace("Access Granted");
trace("_global.username "+_global.username);
} else {
_global.username = null;
trace("Access Denied");
createNotice("* Username allready exsist. Please choose another one.");
}
};
_global.username = formParent.f_name.text;
login_lv.username = formParent.f_name.text;
login_lv.password = formParent.f_password.text;
login_lv.sendAndLoad(_global.serverURL+"login.asp",login_lv,"POST");
}
I need to get the delegate way working as I need to be in the correct scope for what I want to do next.
Any idea where I am going wrong.
Many thanks
Kaan
View Replies !
View Related
LoadVars SendAndLoad Issues
I am having a little issue with the LoadVars sendAndLoad. I will give you an outline of the project and hopefully somebody will be able to help me with this.
Project:
We build websites for real estate agents and communities around the Columbia, SC area. A feature we have been offering is a basic interactive community map. The user rolls over a lot, and some information comes up about that lot. Originally we loaded the lot information from a text file, but to minimize the amount of time we had to spend updating customers websites, we recently implemented a section where the client can login and add/update their lot information on a website. This data is stored in a MySQL database.
I am using LoadVars sendAndLoad to access a PHP script on the server which connects to the database, grabs the required information, and sends it back to Flash.
The PHP script looks like this:
PHP Code:
<?php
include("../../conn/dbconn.php");
$lot = $_GET['lot'];
$community = $_GET['community'];
$q="SELECT * FROM $community WHERE lot = '$lot'";
$result = mysql_query($q,$conn);
$dbarray = mysql_fetch_array($result);
$data = $dbarray['data'];
echo "&lotdata=".$data;
?>
When the Flash file is tested locally, this script works flawlessly. However, when we put it live on the website, it is throwing an error.
I have included the .fla for you to look at, and would greatly appreciate any help. You can view the non-working flash on the server at hurricanebuilders.net
You can download the .fla here
P.S. I am not an actionscript developer, so I apologize in advance for the messy code.
View Replies !
View Related
LoadVars.sendAndLoad Problem
Having trouble sending data to a php file and getting xml back. My guess is because the data I am sending it not URL encoded.For some reason when I trace LoadVars.toString() I get a non url encoded string. Any ideas? Here's my code.
function getSession():Void{
sessionData = new LoadVars();
sessionData.player = player;
sessionData.version = verison;
sessionData.format = format;
sessionData.identifier = identifier;
trace("**dataSent: "+ sessionData.toString());
var myReply_xml:XML = new XML();
myReply_xml.ignoreWhite = true;
myReply_xml.onLoad = myOnLoad;
sessionData.sendAndLoad("url", myReply_xml, "POST");
function myOnLoad(success:Boolean) {
if (success) {
trace("**connectionSuccess**");
trace(myReply_xml.firstChild);
trace("**connectionSuccess**");
} else {
trace("**connectionFailed");
}
}
}
View Replies !
View Related
Questions Re:LoadVars.sendandLoad
Hi-
Well I went out to a php forum to see if my problem about LoadVars.sendandLoad not posting my variables is in the php file, and the problem seems to be Flash.
1) Is it true that sendandLoad does not post data when running in the Test Movie player?
2) I'm running Flash 8 (Educational Version)-Would it be disabled in this version?
3) Does anyone know another way to write a file to the local file system?
Once again here is my code:
Code:
function WriteXML(inputstring:String){
//getURL( phploc+"writeRoomLayout.php", "_blank" );
var SubmitLoadVars:LoadVars= new LoadVars();
SubmitLoadVars.xfile = "roomLayout.xml";
SubmitLoadVars.input= inputstring;
trace("SubmitLoadVars.xfile = "+SubmitLoadVars.xfile);
trace("phploc= "+phploc+"writeRoomLayout.php");
for (var prop in SubmitLoadVars) {
trace(prop+" -> "+SubmitLoadVars[prop]);
}
SubmitLoadVars.onLoad = function(success:Boolean){
if(success){
trace("result= "+this.receivedData);
}
};
trueorfalse=SubmitLoadVars.sendAndLoad(phploc+"writeRoomLayout.php",SubmitLoadVars,"POST");
trace("trueorfalse= "+trueorfalse);
}
Also how do you get the actionscript code tags to work on this site?
The only options I see are wrap selected text in CODE , PHP or HTML?
View Replies !
View Related
Problem W/ LoadVars.sendAndLoad
hi,
im having a problem getting flash to read a returned variable from php--
result_lv.returnVal traces to 0, but when I see if it is equal to "0", it is false.
here's the as2:
ActionScript Code:
stop();
var data_lv:LoadVars = new LoadVars();
var result_lv:LoadVars = new LoadVars();
data_lv.nam = "john";
btn.onRelease = function() {
data_lv.sendAndLoad("phpTest1.php", result_lv, "POST");
trace("this is result_lv.returnVal: "+this.returnVal);
result_lv.onLoad = function(success:Boolean) {
//result_lv.toString();
trace("this is result_lv.returnVal: "+this.returnVal);
if (success) {
trace("this is result_lv.returnVal: "+this.returnVal);
//test_txt.text = result_lv.returnVal;
if (this.returnVal == "0") {
trace("returnVal = 0");
} else {
trace("didnt work");
}
}
};
};
here's the php test:
PHP Code:
<?
$nam = $_POST['nam'];
echo "&returnVal=0";
?>
thanks!
View Replies !
View Related
LoadVars.sendAndLoad Wait
I have a puzzler. I have a function that needs to return a boolean. The boolean is set from a sendAndLoad. I am trying to figure out a way to wait until the data comes back from the server before I return the boolean. The code is below. I cannot return directly out of the onLoad=function(success), as my outer function must return the boolean.
function isChapterComplete(BookNum:Number, ChapterNum:Number):Boolean {
var isTrue:Boolean = false;
var lvResult:LoadVars = new LoadVars();
lvResult.onLoad = function(success:Boolean) {
if (success) {
if (lvResult.Complete == "True") {
isTrue = true;
} else {
isTrue = false;
}
} else {
Message = "Error connecting to server.";
}
};
var lvSend:LoadVars = new LoadVars();
lvSend.Method = "CompleteCheck";
lvSend.BookNum = BookNum;
lvSend.ChapterNum = ChapterNum;
lvSend.UserName = UserID;
lvSend.sendAndLoad("ChapterHelper.aspx",lvResult," _Blank","POST");
Message = "Chapter Completed="+isTrue;
if (lvResult.load) {
return isTrue;
}
}
View Replies !
View Related
Problem With LoadVars/SendAndLoad
Hi
I was wondering if anybody could shed some light on a problem I've been experiencing. I'm basically sending some variables to a php script from flash and then returning some values back to flash from the script. The problem is that the values returned to flash are appearing correctly but do not test correct.
My actionscript and php scripts are below (just samples displaying the the mechanics of what i'm trying to do):
#actionscript#
ActionScript Code:
import mx.utils.Delegate;
movieclip_mv._visible = false;
gatherData = function () {
myData = new LoadVars();
myData.fromFlash = my_txt.text;
myData.onLoad = function() {
var myVar = myData.toFlash;
if(myVar == 1) {
movieclip_mc._visible = true;
} else {
result_txt.text = myData.toFlash;
}
trace(myVar);
};
myData.sendAndLoad("sendandload.php", myData, "POST");
};
submit_btn.onPress = function() {
gatherData();
};
PHP Code:
$fromFlash = $_POST["fromFlash"];
if($fromFlash != "") {
echo "toFlash=1";
}
?>
trace(myVar) display correctly...show a value of 1. However the movieclip is still not visible.
Would really appreciate some help.
Thanks!
View Replies !
View Related
LoadVars SendAndLoad Question
does the sendAndLoad function of loadVars work automatically?
i.e.- does it pass any variables in your loadVars object to your outside file and then accept any reply variables on it's own or do you need to have another loadVars object to capture the reply variables (i'm using the POST method in this case)
If not (non-automatic) can I use an onload function of the first loadVars to trigger a second loadVars?
appreciate any insight/help!
View Replies !
View Related
LoadVars() / SendAndLoad() -> PHP Not Loading?
ok, so I'm having this problem. I'm (now) using LoadVars() and sendAndLoad() to post a highscore to a MySQL database using a PHP script and then retrieve the list of the top ten highscores from the database to display in the flash (after submitting).
It posts (sends) the highscore fine to the database, however, it does not/will not retrieve the variables.
Here is the code:
Actionscript (Within the "submit Highscore" Button -- NOT on _root.):
Code:
on (press) {
HS_Sender = new LoadVars();
HS_Catcher = new LoadVars();
HS_Catcher.onLoad = declareHS();
HS_Sender.score = _root.points;
HS_Sender.sendAndLoad("./scripts/nmbh13th_submiths.php", HS_Catcher, "POST");
function declareHS(){
for(i=1; i < 11; i++){
this["name" + i] = HS_Catcher["php_name" + i];
this["score" + i] = HS_Catcher["php_score" + i];
}
this.play();
}
}
Here is the PHP (since the insertion works fine, I only included this piece of code to save space.)
This takes the High Score table and retrieves the top ten scores and assigns them to $echo_string through a while loop. It also deletes any scores at the bottom of the list beyond $max_scores (which is 30, for now):
PHP Code:
$num = 1;
while($r = mysql_fetch_object($result2))
{
$result = mysql_db_query($db_name,"SELECT * from $db_table WHERE id='{$r->id}'", $newscore_link_id);
$resultArray = mysql_fetch_array($result);
$did = $resultArray["id"];
$username = $resultArray["username"];
$score = $resultArray["score"];
if($num < 11){
if($num == 1){
$echo_string = "&";
}
$echo_string .= "php_name" . $num . "=$username&php_score" . $num . "=$score&";
}
if ($num > $max_scores) {
$sql = mysql_query("DELETE FROM $db_table WHERE id='$did'", $newscore_link_id);
}
$num++;
}
echo $echo_string;
Ok, here is the output that the above PHP file outputs:
Code:
&php_name1=Rege&php_score1=5300&php_name2=Rege&php_score2=2000&php_name3=Rege&php_score3=2000&php_name4=empty&php_score4=1900&php_name5=Rege&php_score5=1900&php_name6=Rege&php_score6=0&php_name7=Rege&php_score7=0&php_name8=empty&php_score8=0&php_name9=empty&php_score9=0&php_name10=empty&php_score10=0&
So, as for the output, it (as far as I can see) is perfect. So there must be something I'm doing wrong.
Some more notes that might be helpful.
- The highscore variables in flash are being defined, just there's no value being assigned; they remain "undefined". So, it is running through the script correctly.
- In flash, if I manually assign the variable (ie. this.name1 = "Poop"; ), it assigns correctly.
- In flash if I manually assign a loaded variable (ie. this.name1 = HS_Catcher.php_score1 it DOES NOT work and returns "undefined." This means that it's not the loop that's causing the problem.
It must be something with how I'm passing the variable, ro trying to retrieve the variable.
Any help appreciated. Every tutorial and article I've found for this matter gives me nothing, and makes it appear I'm doing everything perfectly.. but I obviously cannot be...
Thanks in advance,
-Rege
View Replies !
View Related
LoadVars.sendAndLoad <-> PHP Stumped
Hi all,
I'm in the process of learning PHP and I was playing around with interaction between Flash and PHP. I can get loadVars.send to pass to a php script just fine, but I can't seem to get sendAndLoad to work using the same php script that the send function works fine with. Here's my AS :
ActionScript Code:
varS = new LoadVars();
varR = new LoadVars();
varR.onData = function() {
return_txt.text = "Response recieved.";
};
varR.onLoad = function() {
return_txt.text = "The loaded var is : " + varR.toflash;
};
varS.first = "John";
varS.last = "Smith";
//
test_btn.onRelease = function() {
varS.sendAndLoad("return.php", varR, "POST");
//varS.send("return.php", "_self", "POST");
};
and here's my PHP script :
PHP Code:
<?php
echo "&toflash=$first$last& ";
?>
When I use just loadVars.send, the PHP script correctly prints &toflash=JohnSmith&. But when I change my AS to sendAndLoad, it seems to get a response from the server, but the variable never loads. My status bar show's "Transferring data from 192.168.0.4..." but never completes. I corroborated that by using an onData function to let me know when data was received.. but it never seems to trigger an onLoad, nor does the variable toflash ever make it into my Flash movie. I tried using an enterframe to keep checking for the variable's presence, but it never materialized.
I'm sure there's some simple explaination for this.. can someone shed some light?
Thanks in advance
View Replies !
View Related
LoadVars SendAndLoad Problem
Ok, so here's what I'm trying to do... I have a PHP file that returns a specific row from a MySQL database based on an input variable called id. It URL-encodes this row, and should return three different variables (date, title, and content). I've been trying to use LoadVars.sendAndLoad to send the id variable, and if this worked correctly, it should return these three variables and display them in dynamic text fields I've set up to display those variables. However, when I try this, I see nothing there. I'm not sure whether the problem is sending the id variable or retrieving the results from the PHP file.
I would appreciate any insight into how exactly one would go about doing something like this.
-Curt
http://www.catty-eagle.org
View Replies !
View Related
Pitfalls With SendAndLoad With LoadVars
I'm working on a flash as2 - PHP project that uses sendAndLoad with LoadVars. I feel like I'm getting inconsistent results. I have PHP pages that do different sorts of database calls and logic, but in the end output the same result (like &sent=ok ). If you access these different pages with an html form you can see nothing is wrong. But if you try hitting these different pages using the same LoadVars - sendAndLoad code, one page works and the next one doesn't.
Are there any pitfalls I should be on the lookout for? I'm going to try to set the PHP pages so they are looking for $Get instead of $Post.
I don't think I have the option to switch to xmlLoad on this project - that seems to be preferred.
Any insight on pitfalls on this subject would be appreciated.
View Replies !
View Related
LoadVars.sendAndLoad() Cannot POST
i find that i cannot POST data with LoadVars.sendAndLoad(),
i use firebug for tracking request data
in the code, "request_receiver.php" is used to show $_REQUEST, $_POST & $_GET
parameters were sent succesfully from lv when i set the method to GET
but when i set method to POST, there's no data sent from lv
which means php didn't received any POST data
also i tried LoadVars.send()
the POST value sent successfully~~ but i dont need to refresh the page nor popup a new page
PS:dont suggest me using alternative way, i want to figure out why the method failed suddenly while i've been using this method long time ago without any error
thankyou
here is my code:
---------------------------
var lv:LoadVars = new LoadVars();
var rv:LoadVars = new LoadVars();
mcc.onRelease = function() {
lv.para1 = 1;
lv.para2 = 2;
lv.para3 = 3;
rv.onLoad = function(succ) {
//blar blar blar
};
lv.sendAndLoad("request_receiver.php",rv,"POST");
};
View Replies !
View Related
LoadVars.sendAndLoad() Cannot POST
i find that i cannot POST data with LoadVars.sendAndLoad(),
i use firebug for tracking request data
in the code, "request_receiver.php" is used to show $_REQUEST, $_POST & $_GET
parameters were sent succesfully from lv when i set the method to GET
but when i set method to POST, there's no data sent from lv
which means php didn't received any POST data
also i tried LoadVars.send()
the POST value sent successfully~~ but i dont need to refresh the page nor popup a new page
PS:dont suggest me using alternative way, i want to figure out why the method failed suddenly while i've been using this method long time ago without any error
thankyou
here is my code:
---------------------------
var lv:LoadVars = new LoadVars();
var rv:LoadVars = new LoadVars();
mcc.onRelease = function() {
lv.para1 = 1;
lv.para2 = 2;
lv.para3 = 3;
rv.onLoad = function(succ) {
//blar blar blar
};
lv.sendAndLoad("request_receiver.php",rv,"POST");
};
View Replies !
View Related
LoadVars.sendAndLoad() Cannot POST
i find that i cannot POST data with LoadVars.sendAndLoad(),
i use firebug for tracking request data
in the code, "request_receiver.php" is used to show $_REQUEST, $_POST & $_GET
parameters were sent succesfully from lv when i set the method to GET
but when i set method to POST, there's no data sent from lv
which means php didn't received any POST data
also i tried LoadVars.send()
the POST value sent successfully~~ but i dont need to refresh the page nor popup a new page
PS:dont suggest me using alternative way, i want to figure out why the method failed suddenly while i've been using this method long time ago without any error
thankyou
here is my code:
---------------------------
var lv:LoadVars = new LoadVars();
var rv:LoadVars = new LoadVars();
mcc.onRelease = function() {
lv.para1 = 1;
lv.para2 = 2;
lv.para3 = 3;
rv.onLoad = function(succ) {
//blar blar blar
};
lv.sendAndLoad("request_receiver.php",rv,"POST");
};
View Replies !
View Related
LoadVars - SendAndLoad() Over Https.
I am having problems with loadVars over https. What I am trying to do is sending credit card information from a flash store to a PHP-script on a server over https, and the PHP-script should return a reply. (So I am using the LoadVars sendAndLoad command). The problem is that the reply I get from the script is empty. If I try the same over http, it works fine.
Can anybody please help me?
View Replies !
View Related
Loadvars():sendAndLoad() Question
[Actionscript 2.0]
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.
EXAMPLE
Code:
var lvObj:LoadVars=new LoadVars();
var xmlObj:XML=new XML();
lvObj.something=true;
lvObj.sendAndLoad("script.php",xmlObj,"post");
Is it possible? Any help will save me from the "Trail & Error" process.
Thanx
View Replies !
View Related
LoadVars.sendAndLoad Nightmare.please.help.me
Hi there,
I am having an absolute nightmare with LoadVars.sendAndLoad. I have the following code on the root of my app and it keeps returning a value of 'false' for the "LV loaded ok: "+this.loaded trace.
var sendInfo_lv:LoadVars = new LoadVars();
sendInfo_lv.onLoad = function(success:Boolean){
sendInfo_lv.action = page;
sendInfo_lv.brochureID = broID;
trace("Brochure ID = "+broID);
trace("LV loaded ok: "+this.loaded);
}
sendInfo_lv.sendAndLoad("actions.php", sendInfo_lv, "POST");
Has anyone any ideas what I am doing wrong, please any help would be gratefully accepted!!
Thanks
View Replies !
View Related
LoadVars Not Working For SendAndLoad()
Lol, so this is like the third topic I have posted asking for help in the last two days. I am trying to use this code to get some data from a file on my site.
Code:
var var1 = "hello, I'm Bobby.";
var var2 = 100;
var var3 = "John Deer";
var envelope:LoadVars = new LoadVars();
var envelope_received:LoadVars = new LoadVars();
envelope.variable1 = var1;
envelope.hellothere = var2;
envelope.byebye = var3;
envelope.sendAndLoad("http://lukesterspy.uni.cc/flash.php",envelope_received);
var returned = envelope_received.hi;
trace(returned);
But whenever I try to run this, I always get these errors.
Code:
**Error** Scene 1, Layer 'Layer 1', Frame 1, Line 5: 1046: Type was not found or was not a compile-time constant: LoadVars.
var envelope:LoadVars = new LoadVars();
**Error** Scene 1, Layer 'Layer 1', Frame 1, Line 6: 1046: Type was not found or was not a compile-time constant: LoadVars.
var envelope_received:LoadVars = new LoadVars();
**Error** Scene 1, Layer 'Layer 1', Frame 1, Line 5: 1180: Call to a possibly undefined method LoadVars.
var envelope:LoadVars = new LoadVars();
**Error** Scene 1, Layer 'Layer 1', Frame 1, Line 6: 1180: Call to a possibly undefined method LoadVars.
var envelope_received:LoadVars = new LoadVars();
Does anyone have any idea? I have no clue what the deal is, but this is kind of getting annoying. Btw, that file on my site echos out "&hi=Yo Yo Yo&" (without the quotes).
View Replies !
View Related
LoadVars.sendAndLoad() Gives Me Headache
Hey there,
Why is it that I'm having so much trouble getting the LoadVars.sendAndLoad() function to work? Specifically with a remote URL. I never really use local URLs for sendAndLoad();
I created an application 2 days ago, tested it and it works. Today, I test it again (after not changing any code at all) and it doesn't work.
I have something like this :
HTML Code:
myVars = new LoadVars();
myVars.sendAndLoad("http://www.domain.com/remotefile.php", myVars, "POST");
myVars.onLoad = function (success)
{
if (success)
{
//"customValue" is something which is printed from the "remotefile.php"
getURL("javascript:alert('" + this.customValue + "');");
}
else
{
getURL("javascript:alert('Remote file could not be loaded!');");
}
}
I've even done this :
HTML Code:
System.security.allowDomain("www.domain.com", "domain.com", "http://www.domain.com");
For some reason it simply doesn't load.
What more can I do? loadVariables() and load() is causing the same problems.
Even so, I really need to use sendAndLoad, since I need to POST some values to the server.
Please see if you have some advice for me. I'm just lost...
View Replies !
View Related
[AS1 FMX] LoadVars.sendAndLoad Problem
Ultramates, I need some help
I´m doing a login-swf with two input-fields (username and password) that is supposed to call an .aspx page that compares the variables with a database. Here´s my script:
ActionScript Code:
stop();
//pass_txt.password=true;
varSender = new LoadVars();
varReceiver = new LoadVars();
varReciver.onLoad = function(){
trace("user:"+this.userStatus);
trace("pass:"+this.passStatus);
}
function logIn(user,pass){
varSender.user = user;
varSender.pass = pass;
trace(varSender.toString());
varSender.sendAndLoad("theLoginCheck.aspx?nocache="+new Date().getTime(),varReceiver)
}
login_btn.onRelease=function(){
logIn(user_txt.text,pass_txt.text);
}
test_btn.onRelease=function(){
trace(varReciver.userStatus);
}
The username and password seems to be sent the the .aspx-page as supposed, but then nothing happens
The .aspx-page writes out:
userStatus=0&userPass=0
or "1" if the user and/or pass exists. As I understand it, flash is waiting for those variables in return and fires the varReciever.onLoad when they arrive. But I get nothing but Undefined when I press my test_btn, and the varReciever.onLoad never seems to fire at all...
Please....I cannot sleep until this is sloved
View Replies !
View Related
LoadVars Problem (using An OnLoad)
I had this working earlier on, and about an hour ago it just stopped working/updating. I can't locate my change, nor do I have another copy to compare to. See if you can see my prob in here:
function addListData() {
set(txtLoaded, "done..");
}
theList = new LoadVars();
theList.onLoad = addListData;
theList.load("CDlist.txt");
It doesn't seem to update any of the text fields, I don't think the load is working. I've got the CDlist.txt file in the correct place..
If you want to check out the files:
http://kaede.bc.ca/FlashHelp/Test1.fla
http://kaede.bc.ca/FLashHelp/CDlist.txt
I've even tried stripping out the function, and the .onLoad line. And just have the text fields in there to see if they update when it gets loaded... nadda.
Thanks!
-J
View Replies !
View Related
LoadVars --> Is OnLoad Checked Only Once?
hi all,
i'm hoping for a little walkthrough the loadVars method
what i want to achieve is this: the movie that loads the variables should remain still UNTIL the data has been loaded, and only then resume play...
===============================
// FRAME 1
// stop at frame 1 and resume only when all data is loaded
stop();
// LOAD EXTERNAL DATA //
// event handler function
loadHandler = function(success){
if(success){
// if data loads, play movie...
play();
myTextBox.html = this.text;
}else{
gotoAndStop("error");
}
}
// create loadVars object
myData = new LoadVars();
// set event handler
myData.onLoad = loadHandler;
// load data
myData.load("myFile.txt");
===============================
now here's my question:
is the line 'myData.onLoad ...' checked only once? in other words, does this line do what i need or do i need to place some code on the movie's enterframe event? (something like:
onData{
play();
}
** the movie works locally but it failed to load the data when i tried it up in some webspace (i can't get to it right now, so i thought i'd try asking here)
thanks again
View Replies !
View Related
Need An Explanation For LoadVars OnLoad()
hi.
i'm working on integrating my application with one of our clients. the developer i'm working with is an asp guy. he's asking something and i'm unclear how to answer him...and it's regarding the onLoad() method of the LoadVars() object.
basically, i'm making a POST using LoadVars sendAndLoad(). i have a dummy LoadVars that is my target object. my understanding is that if the connection to the server is made, my onLoad() will receive a boolean value of true. but the server can also send a message back with this, is that right? in the examples in the flash help file the target object does read a property of the server's response called "welcomeMessage".
what i've been telling the developer is to send me back a text file with the key/value pair of success=true/false if the POST went thru..and that's all that i'd need.
am i explaining this right to him or am i misunderstanding it?
thanks for any helpfulp tips.
matt.
View Replies !
View Related
LoadVars.onLoad Problem....Help Please
Hi,
I'm performing a very simple sendAndLoad to a ColdFusion page.
It works fine when the ColdFusion page is on my local host, but when it's on another server, the LOAD doesn't seem to work...(Flash never gets a response back form ColdFusion). Grrrr...
Anybody have any thoughts or insights? Do I need to adjust some setting on the server? I've also read that sometimes sendAndLoad only works with POST and not GET, but I've tried that to no avail. Why would it work on my local server but not on another? (And the SEND works fine...I've tried it; it's just that no response is ever received)
Please help!
Here's my ActionScript:
Code:
test_txt.onPress = function() {
mtv = new LoadVars();
mtv.test_input = 10;
mtv.onLoad = function(success) {
if (success) {
test_txt._width += 100;
sysout2.text += "testvar: "+mtv.testvar;
} else {
sysout2.text += "error loading from server";
}
};
mtv.sendAndLoad(SERVER+"cfdocs/New_Authentication/Main_Application_lib/test.cfm", mtv, "POST");
};
The ColdFusion is very simple...looks like this:
Code:
<cfoutput>
&testvar=15
</cfoutput>
View Replies !
View Related
LoadVars.onload And Return
i have been stuck on this thing for a while now and can't find the solution anywhere on the internet. I'm working on making a class file for the flash foru i just made and am stuck on the logging in part. The cript works and logs in the user, but i want to be able to know when the data has been loaded from php to flash.
ActionScript Code:
class trpFF { public var URLString:String; //Login Variables public var user:String; public var pass:String; public var output:String; function trpFF(absoluteURLString:String) { URLString = absoluteURLString; System.security.allowDomain(URLString); } public function loginUser(username_str:String, password_str:String) { var lv:LoadVars = new LoadVars(); var lo:LoadVars = new LoadVars(); lv.user = username_str; lv.pass = password_str; lo.onLoad = function(sucess:Boolean):Void { if (sucess) trace(output); }; lo.onLoad(); lv.sendAndLoad(URLString+"checkuser.php", lo, "POST"); }}
it works with this and logs me in
ActionScript Code:
as = new trpFF("http://www.trp-florida.com/flash_forum/");as.loginUser('teddy','any_password');
and i want to be able to do this
ActionScript Code:
as = new trpFF("http://www.trp-florida.com/flash_forum/");as.loginUser('teddy','any_password'); as.onLoggedIn = function() { gotoAndPlay(2);}
thanks for help anyone
View Replies !
View Related
|