Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Sendandload Variable With Space



I am posting from my Actionscript form to an external service. One of the variables is "Email Address" with a space in it.

How can I post that?


Code:
Here's an ActionScript example that can not work because of the space in Email Address:

var lv = new LoadVars();

lv.fname="Doug";
lv.lname="Karr";
lv.Email Address="doug@somewhere.com";

lv.sendAndLoad("http://somesite.com/subscribe.aspx", lv, "POST");



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 03-04-2006, 09:46 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

SendAndLoad Variable Setting
Hello,

Below is some code to get a record from my DB, at the bottom, you will see a trace call to print out SR Num. It is always undefined! I cant figure out why, i guess something with loading of variable order, however the trace functions where I have >> always has data.


Code:
lo = new Object();
lo.click = function( event ) {
... bunch of stuff...
var timeline= this;
var windowTitle= targetHost + " device";
var xCoord= 15;
var yCoord= 10;
var recordId= myRowId;
var scriptPath= "http://mysite.com/swf-php/getRec.php?i=" + myRowId;

// Get record
var reqBy;
var reqDate;
var ipAddr;
var ifName;
var sDate;
var eDate;
var srNum;
var ccNum;
var addInfo;

// get data
if ( myRowId ) {
trace( "Querying database for record " + myRowId + " now." );

var recSender:LoadVars= new LoadVars( );
var recReceiver:LoadVars= new LoadVars( );

recReceiver.onLoad = function( ok )
{

if ( ok ) {
reqBy= recReceiver[ "requested_by" ];
reqDate= recReceiver[ "requested_date" ];
ipAddr= recReceiver[ "ipaddress" ];
ifName= recReceiver[ "port" ];
sDate= recReceiver[ "start_date" ];
eDate= recReceiver[ "end_date" ];
srNum= recReceiver[ "sr_number" ];
ccNum= recReceiver[ "cc_number" ];
addInfo= recReceiver[ "additional_info" ];
trace( "url record for: " + recReceiver[ "ipaddress" ] );
trace( ">> reqBy: " + reqBy );
trace( ">> reqDate: " + reqDate );
trace( ">> ipAddr: " + ipAddr );
trace( ">> ifName: " + ifName );
trace( ">> sDate: " + sDate );
trace( ">> eDate: " + eDate );
trace( ">> srNum: " + srNum );
trace( ">> ccNum: " + ccNum );
trace( ">> addInfo: " + addInfo );

} else {
trace( "Failed to get record data..." );
addInfo= "Failed Record Lookup.";

}

}

recSender.sendAndLoad( scriptPath, recReceiver, "GET" );

}

trace( "SR NUm: " + srNum );

}

click_btn.addEventListener("click", lo);


output of this program is:


Code:
Querying database for record 0000000000000002 now.
SR NUm: undefined
url record for: 10.1.1.1
>> reqBy: bob
>> reqDate: 08-29-2006 22:13 PM EDT
>> ipAddr: 10.1.1.1
>> ifName: fastEthernet13/5
>> sDate: 08-29-2006 23:13 PM EDT
>> eDate: 08-30-2006 22:13 PM EDT
>> srNum:
>> ccNum: 0167913
>> addInfo: updating device


I can see the SR NUm getting printed out (in red above)before my >> trace data, what is wrong with my ordering ?

Thanks!

A

Sendandload Undefined Variable Receiving
output is "error" even i send "hello". what is the problem here?

actionscript

Code:
function dothis() {
sv = new LoadVars();
rv = new LoadVars();
sv.v1 = "hello";
sv.sendAndLoad("newsletter.php", rv);
rv.onLoad = function(obj) {
trace(rv.var1);
};
}


php

Code:
$var1=$_POST["v1"];
if($var1=="hello") echo "&var1=ok&"; else echo "&var1=error&";

SendAndLoad() And Variable Assignment Issue
Hello,

I am new to Flash so please bear with me, I need all the help I can get.

I have a flash file that I want to acquire input data from for a database query. After submitting the search terms, I want the results to display in the same file later on. My PHP/MySQL code is all working fine. It prints out variables that Flash should accept:

nmr_date=Sunday November 23, 2003&nmr_type=Total&nmr_central_duration=01 Min. and 57 Sec.

Later in my flash file I have 3 dynamic text boxes where I want the returned results to be displayed.

I am having trouble understanding how to use sendAndLoad() in this instance, and even more trouble understanding how to assign the returned values to the text boxes.

So far my ActionScript is this:


ActionScript Code:
on (release) {
   
   doSubmit ();
   
   function doSubmit()
   {
      nmForm = new LoadVars();
      nmForm.nmf_location = nmf_location.getValue();
       
      nmResponse = new LoadVars();
      nmResponse.onLoad = get_nmResponse();
       
      //I think I should use sendAndLoad() here
      nmForm.sendAndLoad("near_me.php",nmResponse,"POST")
       
      //I use this just to make sure the data query worked
      //and it always has
      nmForm.send("near_me.php","_BLANK","POST")
   }
   
   
   //This is where I need help assigning values
   function get_nmResponse(result)
   {
      if(result == true)
      {
         set("results.nmr_date", result.nmr_date);
         set("results.nmr_type", result.nmr_type);
         set("results.nmr_central_duration", result.nmr_central_duration);
      }
      else
      {
         //display error
      }
   }
   
   gotoAndPlay(40);
}


I hope that makes some sense, go easy on me I'm new.

Thanks for any help you might give!

Accessing An Object Variable With A Space In
This should be easy, but I am stuck. I have created a dataprovider for a datagrid and the data comes from a db.

I have an object that is populated by the data from db. The field names have spaces in, so the code that creates the object creates a series of variables such as:

object.First Name;
object.Last Name;

But flash is not happy with the spaces (syntax error). But I need them for my datagrid columns. How do I get flash to see property name correctly? I have tried eval[""] to no effect.

thanks

frank

[F8]Changing Variable When Space Is Pressed
Hello guys,

I have an question. I wanna change the variable 'color' higher when space is pressed. This is what I have but when I trace color it's always 1.


Code:
onClipEvent (enterFrame){
if (key.IsDown(Key.SPACE))
{
if (color = 1)
{
set (color,2);
}

if (color = 2)
{
set (color,3);
}

if (color = 3)

{
set(color,1);
}
}


btw, it has to increase by 1 if you press it. So if it's 2 it needs to go 3 and when its 3 to 1. And so on.

Thanks for the help already!

Koekoeka.

Splitting A Variable From A Database On The Space.
Hi guys.

I wondered if anyone could help me with a problem I'm having with variables I have read in from a database? Basically, due to how the database is created, one field has more than one id held in it (they are sectors and a user can be associated with more than one sector but the total amount is unknown). Is there a way of splitting these IDs up based upon where there is a space/pipe?

Any questions please ask.

Thanks

Holding Space, Increase Variable?
right now, my code looks like this:

Code:
onClipEvent(load){
speedy = 1.1;
gravity = 9.82;
speedx = 40;
}

onClipEvent(enterFrame){

if(Key.isDown(Key.SPACE)){
speedx *= 1.2;
}

time = getTimer();
time /= 100;
speedy = gravity * time;
this._x += speedx/5;
this._y += speedy/5;

}
What I want is that the flash should wait until I've finished pressing space, and the longer I hold in space, the bigger the variable speedx is. I can hold it in right now, but the ball will fall before I've released space. I'm really new to this so please be nice

EDIT: the flash is a ball that "throws", and the code is on the ball, which is a movie clip.

Using SendAndLoad To Send Loadvars Variable And Getting XML Returned
Hi, I am having trouble receiving the results of a php script that takes variables and returns xml. Everything works fine up to trying to decode the answer. Ive tried interpret it as xml object but doesnt take it. Here is the code:


PHP Code:



var returnInfo:LoadVars = new LoadVars();
    var sendInfo:LoadVars = new LoadVars();

    sendInfo.email = user;
    sendInfo.pwd = pass;
    returnInfo.onLoad = function(success) {
        if(success) {
                           parseXML(returnInfo);
        }else{
            trace("ERROR: ");
        }
        for(i in returnInfo){//testing
            testt += "- i("+i+") r[i]("+returnInfo[i]+") 
";
        }
     };
      sendInfo.sendAndLoad(sendUrl, returnInfo, "POST"); 




Ive also put a output all the objects found in the returned answer its this:


Quote:




- i(<?xml version) r[i]("1.0" encoding="utf-8" ?>
<data>
<id value="14" />
<title value="Ms" />
<firstname value="qaz" />
<surname value="zaq" />
<address1 value="adr1" />
<address2 value="adr2" />
<city value="brzl" />
<postcode value="bs6" />
<dob value="30 Nov 99" />
<email value="qaz@qaz.com" />
<tel value="1234" />
</data>)
- i(onLoad) r[i]([type Function])




It Looks like it found two objects :
i(<?xml version) => "1.0" encoding="utf-8" ?><data><id value="14" />....
i(onLoad) => [type Function]

the onload object which is a function I assume it adds on automaticly to set of the onLoad function,
but I dont get the first object. Its almost like its cut in two. So if I add i + returnInfo[i] it actually gives me a string which looks like a complete xml.

This has completely bummed me. How do I find the xml in this that I can parse as usual?

Thanks for any help.

? How To Translate 3D Space To 2D Space (sort Of) ?
Hi everybody,

I have a question about coordinate systems. I have a 3D space set up (papervision3d), with an array of 20 objects(planes) sitting on the origin (0, 0, 0). What I'd like to do is evenly distribute those 20 objects across the x and y axis so that they appear to be on a 2D plane facing the viewer.

I imagine that some sort of translation needs to be made between the 2D "stage" and the 3D "scene" (dividing the stage width and height). My first idea was to create 4 Arrays of 5 objects each and position those arrays evenly along the y-axis. Next, I was wondering how matrix objects work and if they would have any advantage over arrays here.

Any ideas?? Does this seem like the right direction?

Thanks for your help!


Brian

XML SendAndLoad
I'm trying to use sendAndLoad to pass an Xml object to a cgi (coldfusion or tango) and get some XML back. Exactly what it is allegedly designed to do.
Problem is, its not passing the xml object, hence I'm getting nothing back. The code for doing this currently looks like this:
-----
function loadresults () {
_root.output = "Loading the results xml...";

requestdate = "<requestdate>21/09/00</requestdate>";
requesttime = "<requesttime>19:00</requesttime>";
requestcovers = "<requestcovers>2</requestcovers>";
XMLString = "<request>"+requestdate+requesttime+requestcovers+ "</request>";

requestXML = new XML(XMLString);
requestXML.sendAndLoad("fields.cfm", this);
}
-----

SendAndLoad()
afternoon/morning/evening...
Has anyone had any problems with the sendAndLoad function on a Mac with IE5 and the flash 6 plugin?

I'm sending XML data to a php script to interpret. This works fine in a PC envrionment, but when viewed on a mac the XML data doesn't seem to reach the php file. The data disapears or gets deleted when the sendAndLoad function is carried out.

loginXML = new XML();
receiveXML = new XML();
login = loginXML.createElement("login");0
login.attributes.version = "";
loginXML.appendChild(login);
loginName = loginXML.createElement("loginName");
loginNameValue = loginXML.createTextNode("flash");
password = loginXML.createElement("password");
passwordValue = loginXML.createTextNode("flashkit");
loginName.appendChild(loginNameValue);
password.appendChild(passwordValue);
login.appendChild(loginName);
login.appendChild(password);

receiveXML.onLoad = resultXML;
loginXML.sendAndLoad("xmlscript.php",receiveXML);

can anyone help.
thanks.

SendAndLoad...how?
I am trying to set up an on-line schedule for a lab that is included in a Flash website. Is there any way to pass a variable from Flash to a text file that is sitting on the server, and then have the new variable reload into Flash?

I understand some of the sendAndLoad code, but I haven't seen anything on how to actually send more than one variable at a time to any sort of external file, much less a text file. Coldfusion files seem to be the order of the day.

So, I have a visual calender, and I want to be able to click on a day, and then select a time and input my name and then have that show up on the calender. Any ideas on how to pass a variable to a TXT file?

SendAndLoad Help...please
I am building a Flash MX site where a section of the site will have Bios of people.
I have a database built out using MySQL and PHP.
I created this button function in my Flash movie

randall.onRelease = function() {
getBio = new LoadVars();
getBio.memberName = this._name;
getBio.send("php/bios.php", "_blank", "POST");
};

This works perfectly! My PHP echoes the info exactly how I need it. URL encoded and all!

randallBio=Randy+was+born+and+raised+in... etc

Now that I know the info is being interpreted correctly, I need to get it back into Flash.
Can anyone help me with converting my current send function into sendAndLoad?
That would be SWEEEEEET!

Thanks in advance!
- Patrick

SendAndLoad();
Hi,

I have some variables that I want to send to a database via an ASP page. Then I want to retrieve the same updated values from the database and show these values in Flash. I'm using the sendAndLoad() method but I'm not getting the values back correctly. (I'm always getting the same values that I originally sent)Can anyone help? Thanks.


Code:
on (release) {
var postVars = new LoadVars();
postVars.p = b1.rating;
postVars.s = b2.rating;
postVars.o = b3.rating;
postVars.q = b4.rating;
postVars.c = id; // contestant id

postVars.sendAndLoad("../interact/PostAndGetRatings.asp",postVars,"POST");
postVars.onLoad = function (success) {
if (success) {
status = "success";
trace("returned")
trace("p="+postVars.p);
trace("s="+postVars.s);
trace("o="+postVars.o);
trace("q="+postVars.q);
} else {
status = "error";
}
}
}

SendAndLoad Help
Soon i was planning on doing some mySQL work with flash and decided to learn the new sendAndLoad. I'm a little confused on this and there's not much i could find on the topic. What i'm trying to do as a test is submit a variable to a php page, have it read it and then have flash read back the value.

test link: .http://maximohosting.com

Here's what i have for a php page. It checks for a name and then prints out a URL encoded type variable answer:

<?php
$formData = (strcmp($REQUEST_METHOD,'GET') == 0)? $HTTP_GET_VARS:$HTTP_POST_VARS;

if(isset($formData['name'])) {
$text = $formData['name'];
}else {
$text = "noname";
}
echo "text=".$text;
?>

then for flash i use two variables. one called "name" and the other "text" with a button containing this action.

on (release) {
function doIt() {
max = new LoadVars();
max.name = name;
response = new LoadVars();
response.onLoad = getResponse();
max.sendAndLoad("test.php", response, "post");
}
function getResponse() {
text = "this should display: " + response.text;
}
doIt();
}

anyways, nothing happens. Can someone tell me what i'm doing wrong? Thanks - Max

MX: SendAndLoad
Hi,

I'm completely new to Flash and thus far I am finding things a little difficult. I am writing an application which lists a bunch of divisions from the database into a combo box, and when a division is selected the data is sent to a php script, a query is performed, and a list of firstnames and surnames are "supposed" to be returned. Eventually on the output as it reads each record I want to create objects such as a checkbox and text fields dynamically (not a problem), but for now I'd do with just being able to get the data into flash.

The combo box is working fine, and by using c.send I can get the correct query return code back into the browser. However no matter what I try I simply cannot work out how to get the new data into flash so it is accessible. Could someone please help me with how this is done structurally.

The following code returns nothing in the statement.. not even a failure:


Code:
var c = new LoadVars();
c.returnTeam=returnTeam;
c.sendAndLoad("http://localhost/getClients.phtml","_self","POST");

c = new LoadVars();
c.onLoad = function(success){
if(success){
getURL("java script:alert('"+ firstname0 + " " + lastname0 + "');");
} else {
getURL("java script:alert('something went wrong');");
trace("something went wrong...");
}
}


I am not getting the sucess or the failure comments, which has left me scratching my head in confusion.

However, if I change the sendAndLoad comment to just send then a new IE window is opened with the information which is to be imported into Flash. This appears to be okay.

PLEASE HELP! Thanks.

SendAndLoad?
Hi,

I need to send some variables to a php script which returns an xml output depending on the initial variable sent. Is this the correct way to do this? thank you for reading!


code:
var Data = new LoadVars();
Data.a = "test";
Data.b = "testing";

var dataXML = new XML();
dataXML.onLoad = parseXML;
dataXML.sendAndLoad("http://sendxml.php", Data, "POST");



PHP Code:




if ($_POST[a] != null) {
    call xmlfunction($_POST[a]);
}

SendAndLoad Is Going Nowhere ...
Code:
Login = new LoadVars();

Login.username = username;
Login.pword = pword;

Login.sendAndLoad(_global.URLString + "signin.asp", this, "POST");

Login.onLoad = function(){
trace("loaded");
/*
if(Login.signedin=="true"){
_global.isSignedIn = true;
_global.Account = Login.name;
_global.Username = Login.username;
_root.user_forms.gotoAndStop("s_success");
} else {
_global.isSignedIn = false;
_global.Account = "";
_global.Username = "";
_root.user_forms.gotoAndStop("s_failed");
}
*/
}

stop();


Hi guys,

this is doing *nothing* for me. I'm getting nothing returned on the sendAndLoad, no reaction that it's doing anything at all....

username and pword traces return the appropriate value.

_global.URLString + "signin.asp" returns http://carey.srv/signin.asp as it should .. and the asp script is error-free.

I'm running out of excuses for why it's not working anyone got any suggestions?

Cheers,
Ben

Sendandload
Im using ...

receiveVars.onLoad = function(success) {
if (success) {
trace("SENT STUFF DONE!!!!!!!!!!!!!");
savedstatus = "level saved";
} else {
savedstatus = "error, try again";
}

whats happening is my file is saving correctly, but its still displaying "error, try again" in the savedstatus variable, why is this? does my php file have to send something back to the flash, so sendandload knows its been a success??

thanks
boombanguk

SendAndLoad
hi,

im using this line, in a movieclip, which itself is loaded into another movie (using loadmovie), this is the line

sendVars.sendAndLoad("http://www.website.com/scores.php", receiveVars, "GET");

strange thing is, when i run the movie clip by itself, that above line loads in the data fine, but when i run it from the parent movie, it doesn't..any ideas??

thanks
boombanguk

HELP WITH SendAndLoad()
Hello all, I know this has probably been brought up before, but I am trying to make a login page for my site. In flash I have created 2 input text boxes with the vars username & password, and a button with the following code:

on (release) {
var lv = new LoadVars();
lv.sendAndLoad("test.php",lv,"POST");
lv.onLoad = function() {
success = lv.success;
gotoAndPlay(2);
}
}

on frame 2 I have a dynamic text box, with the var success

test.php contains:

<?php

$username = $HTTP_POST_VARS['username'];
$password = $HTTP_POST_VARS['password'];

if ( $username == 'admin' && $password == 'admin' ) {
echo 'success=true';
exit;
}
else {
echo 'success=false';
exit;
}
?>

The problem is, everytime I click the button, no matter what is entered in the input boxes, I always recieve false back. Can anyone help me out please? Thanks in advance, Nonexistant

SendAndload Php
I can't get the sendAndload() function to execute my php values.
The code I'm using appear below.
I triple checked the syntax etc but still no success.
Any help will be greaatly appreciated.
Thank You
iaustin

//my test.php3 file
<?
$newvar= 10;
echo "&newvar=" . urlencode($newvar);
?>

//my flash 5 code
function fsendandload(){
ioc1 = new LoadVars();
ioc2 = new LoadVars();
ioc1.newvar = 3;
ioc1.sendAndLoad("http://www.toMySite.com/test.php3", ioc2);

returnvar = ioc2.newvar; //text field
}

SendAndLoad To Asp
Hi

I am trying to send a bunch of form fields to an asp page which then writes them to a db

here is some of the code
code:
var targetObject = new LoadVars();
//
targetObject.onLoad = function(success) {
if (success == true) {
outputie.htmlText = targetObject.toString();
} else {
outputie.htmlText = outputie.htmlText+"<br>"+"no success";
}
};
//
function sendData() {
myVars.sendAndLoad(targURL, targetObject);
}


outputie is just a text box for testing
myVars is the list of variables 'name=craig&address1=ma+hoose' etc
targURL is the full url, do I have to put a '?' at the end of it eg targURL = "http://www.mysite.com/myscripts/myfile.asp?"

also is the targetObject setup properly, ie am I using it in the right way?, I dont want the page to refresh when a response comes back.

Any help?

SendAndLoad
why is this not function :
submittedData = new LoadVars();


submittedData.inputData = "text";


submittedData.sendAndLoad("http://localhost/exercise/careTaker.php","post");

the php file is ok i test it aside
is the last line true

Sendandload With PHP
Hi All,

This is my actionscript :

function imageDone() {
uploadstatus = this["errormsg"];
}

function imageDone1(){
var h = new LoadVars();
h.onLoad = imageDone;
h.username = _global.username;
h.gallerynum = _global.setNum;
h.imagenum = _global.imageNum;
h.imageload = infos_txt.text;
h.sendAndLoad("scripts/setimage.php", h, "POST");
_global.browserused = "1";
}

This is my PHP:

<?php
include("MYonnect.php");

$username = $_POST['username'];
$gallerynum = $_POST['gallerynum'];
$imagenum = $_POST['imagenum'];
$imageload = $_POST['imageload'];
$imagefrom = "../img/".$imageload;

$errormsg1 = "File Uploaded";

$qr = mysql_query("SELECT userdir FROM users WHERE username='$username'");

$row = mysql_fetch_array($qr);

$rString .= "&errormsg=".$errormsg1;

$userdir = $row['userdir'];

system("/usr/local/bin/mogrify -format jpeg $imagefrom");

$file_name = current(explode('.', $imageload));

$imageload1 = $file_name.".jpeg";
$newimage = "../img/".$file_name.".jpeg";
$newimage1 = "../users/".$userdir."/images/".$file_name.".jpeg";

copy($newimage, $newimage1);

system("/usr/local/bin/mogrify -resize 400x300! $newimage1 ");

mysql_query("UPDATE userimages SET imagefile='$imageload1' WHERE username='$username' AND setnum='$gallerynum' AND imagenum='$imagenum'");

unlink($imagefrom);
unlink($newimage);

echo $rString."&";

mysql_close($conn);
?>

My problem is that whilst i can get this to work with SEND only, it outputs to a new browser window which i don't want it to do.
I want to be able to use sendandload and therefore not have a new window opened and thus not cause problems for customers who have popup blockers.

Any help the experts out there can give would be appreciated.

Thanks

lawrence

SendAndLoad
hello,

I want to get data of an MySQL database. How do I get the data into flash. I want to know that because I don't fully understand the way they use onLoad en Load functions( new LoadVars() );

for example what is onLoad for an Load, and how do I get new information. Create another loadvars, or can I use the one I created first..

thanx...

Need An Example Of SendAndLoad.
I need an example of how to use sendAndLoad.

I've looked up the help in the Flash files, but am not getting anywhere.

I have on stage a movie called mainOrderReviewMovie that contains simple bits used to try and send data and receive data back.

I have the following code (adapted from the Flash help files):code:
mainOrderReviewMovie.onRelease = function()
{
submitListener();
}

function submitListener()
{
var send_lv:LoadVars = new LoadVars();
var result_lv:LoadVars = new LoadVars();

send_lv.email = mainOrderReviewMovie.email.text;
send_lv.sendAndLoad("http://www.myDomain.com/email/cdontsExample.asp", result_lv, "POST");

result_lv.onLoad = function(success:Boolean)
{
if (success)
{
mainOrderReviewMovie.resultsText.text = result_lv.welcomeMessage;
// How do I send back variables!!?
}
else
{
mainOrderReviewMovie.resultsText.text = "Error connecting to server.";
}
};
};


All I seem to be getting is "Error connecting..."

My asp code is as follows:
code:
<% @language="VBSCRIPT" %>

<%
Set objMail = Server.CreateObject("CDONTS.Newmail")
objMail.To = request.form ("email")
objMail.Subject = "Testing the system"
objMail.From = "me@mydomain.com"
objMail.Body = "nothing here"
objMail.Send
Set objMail = Nothing
%>

I can't figure out where I'm going wrong.

I've attached my Fla... if that's any help.

ANY help would be greatly appreciated.

Thanks.


OM

(This post is an extentsion of my last one - apologies if this is repeat posting.)

XML.sendAndLoad()
How do I send a variable with XML object to a php script which will then make a query and return the data to the same XML object!
this is the code for an array of buttons:

_root.erey[i].onRelease = function () {
portfolio_xml.clan=this._name;
portfolio_xml.sendAndLoad("gallery.php", portfolio_xml, "POST");

}
}

The PHP script is set to query the data from a mySQL table where clan = '$_POST[clan]'

How do I fix it!

SendAndLoad
Hi

Does anyone know why sendAndLoad doesn't work in the webpage but works fine when I test in flash??

I'm publishing as flash 6 from flash mx on a pc.

when i test in flash the database is filled with the correct data.

when I put it in a web page and test it there then nothing goes in the database?? any reason why this is happening?

any clues anyone?

Cheers
B

SendAndLoad Php Vs Asp
Ok, I've done this many times before in php, but am having problems doing the same with asp. I have some code like so...


Code:
loginVars = new LoadVars();
loginVars.onLoad = function() {
_parent._parent._parent._parent.openPop(100, 100, loginVars);
};
loginVars.checkLog = "yes";
loginVars.idSent = currentUser;
loginVars.passSent = currentPass;
loginVars.sendAndLoad(loginScript, loginVars, "POST");
where loginScript is the asp script I'm trying to connect to, and the openPop() function just opens up a window I made that spits out the text of the loginVars object for debugging.
Now, if I try this script with a script.php file, it works as expected when uploaded to the server, however trying it with a script.asp file doesn't work once uploaded. If I access the .asp page directly I see the appropriate "variable=something&anothervariable=somethinge lse" being spit out on the page, however the information is not being shown in the debugging pop-up, although it is with the php test.
A couple more things on this. I have tested it locally through my server and doesn't work with asp, and have also tested it on two other remote servers with same results..php script works, asp doesn't. However, if I test it withing Flash MX 2004, it will spit out all of the asp code in the script when tracing the loginVars object. I understand asp is not being parsed when just doing a control-test movie within flash, however the fact that it spits out the code tells me I'm spelling the file right at least and it knows it's there. So, is there something special I have to do to get this to work with an asp script as opposed to php?

SendAndLoad HELP...please :)
Hello there!

Please help I'm going insane. I'm trying to sendandLoad some XML with my server. I've got the load bit working sweet. But I can't send the data I want (some XML, or an XML type string)

I'll list the different strings that I've got working/sending and the ones that I haven't.

Please can someone take alook and tell me why when I use the login_str that doesn't work I get -
Error opening URL "http://www.sharebox.co.uk/kaan/kaan.aspx"

The one listed as '!!!this doesn't' is the syntax I really want to get it workin. Basically be able to compile the string over multiple lines, as I'm going to need to compile it from an Array (i.e. use a FOR Loop)


this works
var login_str:String = "<login username="test" password="me" />";

this doesn't
var login_str:String = "<login username="test" password="me" />"<login username="test" password="me" />";

this doesn't
var login_str:String = "<game><name>jen</name><score>77</score></game>";

this works
var login_str:String = "<meta name="firstName" value="bob" xmlns="buildingbox-co-uk:assessment" />"

this doesn't
var login_str:String = "<meta name="firstName" value="bob" xmlns="buildingbox-co-uk:assessment" /> <meta name="lastName" value="smith" xmlns="buildingbox-co-uk:assessment" />"

!!!this doesn't - THIS IS ACTUALLY WHAT I WANT TO WORK
var login_str:String = "<meta name="firstName" value="bob" xmlns="buildingbox-co-uk:assessment" />"
login_str += "<meta name="lastName" value="smith" xmlns="buildingbox-co-uk:assessment" />"


-------------------
var my_xml:XML = new XML(login_str);
//my_xml.parseXML(login_str);
var myLoginReply_xml:XML = new XML();
myLoginReply_xml.ignoreWhite = true;
myLoginReply_xml.onLoad = myOnLoad;
my_xml.sendAndLoad("http://www.sharebox.co.uk/kaan/kaan.aspx", myLoginReply_xml);
function myOnLoad(success:Boolean) {
trace(this);
if (success) {
trace("success")
} else {
trace("Fail")
}
}

Thanks Loads!!!

Kaan.

SendAndLoad() With ASP
Hey everyone,

I am trying to get my flash to properly communicate with my asp site via sendAndLoad...simply because I hate it when the entire site reloads after every send. Here's my FLA code and ASP code.

Actionscript:

Code:
stop();
t_password.password = true;
loginAccess = false;
var loginSend = new LoadVars();
var loginLoad = new LoadVars();

_global.login = function() {
loginLoad.onLoad = function(success:Boolean) {
if (success) {
t_warning.text = "";
} else {
t_warning.text = "Failure to connect to server...";
}
};
loginSend.strPassword = t_password.text;
loginSend.strUserID = t_username.text;
loginSend.sendAndLoad("index.asp", loginLoad, "POST");
};
this.onEnterFrame = function() {
if (loginAccess == true) {
gotoAndStop(2);
} else {
}
};


Button:

Code:
on (release) {
if (t_username.text == "") {
t_warning.text = "Please Enter a Username";
} else if (t_password.text == "") {
t_warning.text = "Please Enter a password";
} else {
login();
}
}


ASP Code:

Code:
<%
Dim loginAccess, strUserID, strPassword

strUserID = Request.Form("strUserID")
strPassword = Request.Form("strPassword")

if (strUserID = "bob") AND (strPassword = "hello") Then
Response.Write("&loginAccess=true")
end if
%>


I have no idea why this isn't working...can anyone help?

SendandLoad()
within my flash movie i can't get the
sendandLoad("http://www.myurl.com/doc.asp",lvo,"GET")
to work. if i change the sendandLoad below to the one above, and i make my website using a header name in IIS, i can access my home page, but it seems it cant find my . asp file so that the "GET" works as well as "POST"


If i have
sendandLoad("doc.asp",lvo,"GET")
and i have my homepage with embedded swf movie in it, and i navigate to
http://localhost..... then it works fine.

XML.sendAndLoad
Hi,
Any one, please guide me how to handle the request sent by XML.sendAndLoad in ASP.NET using c#

For example:
If I have sent the xml Object <User name="xyz"/>

I would need a response from server as <User name="xyz">Valid</User>

Thanks,

SendAndLoad XML In AS3
Can anyone tell me what replaced XML.sendAndLoad in AS3 - i can see the URLRequest.load method allows for sending data and receiving a response as

"text, raw binary data, or URL-encoded variables"

but nothing about receiving XML responses - and the XML class doesn't seem to offer anything.

Any ideas?

[F8] SendAndLoad + Php
Hi,

I have a Flash movie that uses sendAndLoad to send data to a PHP file, which then loops through a series of tasks (creates an image from lines of pixels) and then when it is all finished i have it 'echo' a status variable to be true, so that Flash then knows it can continue...this all works great, but my problem is that I want some kind of 'progress indicator' which shows how far along the PHP is in building the image. Since a loop is used in the PHP file, I thought I could simply add an 'echo' at the end of the loop to show which 'step' it is currently on (since I know the total number). However, my Flash file isn't picking up that echo... it seems that the onLoad function that receives the variables in Flash isn't called until the entire PHP code has been executed--is this true?

If it is, is there a way to continually send an updated variable from PHP to Flash, while the PHP code is still running?

If more clarification is needed, please just let me know.

Thanks!
-b.

SendAndLoad
Code:
var sender:LoadVars = new LoadVars();
var receiver:LoadVars = new LoadVars();
sender.fname = "bigtestname";
sender.sendAndLoad("handle_form.php",receiver,"POST");
receiver.onLoad = function ()
{controller.newXmlFile_txt.text = this.result;}

PHP Code:



<?php

print "&result=success";

?>




tried to keep this as simple as possible but i dont receive anything back - not so sure on the php stuff but the as looks fine to me - any ideas on what i am doing wrong?

thx

SendAndLoad() Help Please
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.

SendAndLoad Help
I am having trouble utilizing the send and and load function in flash. The msg text field is returning as undefined when I click my button.

Flash Code:

Code:
on(release){
var enterChat = new LoadVars();
enterChat.action = "test";
enterChat.message = "go";
enterChat.sendAndLoad("myurl/test.php", _blank, "POST");
msg = this.work;
}

PHP Code:



<?PHP
echo "&work=yes";
    if($_POST['action'] == "test"){
        echo "&go=yes&msg=";
        echo $_POST['message'];
    }
?>




Every variable I try echoing returns as undefined.

Any suggestions?

e39m5

SendAndLoad....
simple question, there is
Code:
(url:string, targetobject, method)
, so can i put 2 urlīs to send to? i mean
Code:
(1.php and 2.php, targetobject, method)
, thanks in advance

Xml.sendAndLoad
Hello,

Banging my head against a wall. Trying to send an XML object out of flash to a php script which will save it to a file. Only problem is that nothing happens. The onLoad handler is never invoked.

Here is my code:


Code:
public function saveToXML():Void{
savedXML.contentType="text/xml";
savedXML.onLoad = Delegate.create(this, saved);
savedXML.onHTTPStatus = Delegate.create(this, myStatus);
savedXML.sendAndLoad(saverScript, returnedXML);
trace("IS LOADED"+savedXML.loaded);//Traces true
}

private function myStatus(code:Number):Void{
trace(code);
}

private function saved(success:Boolean):Void{
if(success){
trace("SAVED"+returnedXML);
}else{
trace("FAILED");
}
}
Thanks a lot

Xml SendAndLoad
Im not seeing anything in php after doing the first half of an xml sendAndLoad

what post variable should it be in php? I thought it was the name of the sendAndLoad object in flash.
eg

xmlOUT.sendAndLoad(this.path, xmlRTN);

do we check the variable xmlOUT in php ? I think yes.

SendAndLoad :-(
i want to check if a user is logged using sendandload from flash to php.this is code i'm using


Code:
var obj:Object = new Object();
function getLoggedStatus() {
//Impelement XML SendAndLoad/////
varSender = new LoadVars();
varReceiver = new LoadVars();
varSender.osCsid = _global.s_id;
varReceiver.onLoad = function(success) {
if (success) {
trace("returning "+this.islogged);
obj.islogged = this.islogged;//returned from main.php
obj.username = this.username;//returned from main.php
return (obj);
} else {
trace("failed");
}
};
varSender.sendAndLoad("http//path/main.php", varReceiver, "GET");

}

saveImage_btn.onRelease = function() {
var logStatus = getLoggedStatus();
trace(logStatus.islogged);
}
when i test the code
trace("returning "+this.islogged); which is inside the onload function traces after trace(logStatus.islogged); which is inside onRelease of the button
so logStatus is undefined...

how can i eleminate this

thanks

SendAndLoad Can It Be Done?
Hi,

I am trying to automatically post new messages of a consistanly updated XML file that is on my local drive to a php file on a server that submitts the message to a mysql database. From my understanding I am unable to read the XML file if the flash movie is on my server, so i have resorted to running a local flash movie that will read the XML. I have this far.

I got this working using getURL sending values to a php page on my server and storing it in a database. The problem is that this method opens windows which i have to avoid.

Because sendAndLoad can pass variables to php files without opening a web page i am wondering if it is possible to pass a variable from my local computer where the flash movie is running and where the XML file is stored to an online php file on my server?

I have spent most of the evening trying to get this done, but than realized that it may not even be possible,is it? should i look for alternative methods of doing this process? or am i on the right track and should continue with this problem using sendAndLoad?

Thanks so much for the help

SendAndLoad Help
Hi
I am trying to pass two variable to a php page and then the page return to say if it has been processed. I would have used the sendAndLoad in the past but a little confused now.


ActionScript Code:
var one:uint = 16
var two:uint =22;
var sendingData:URLVariables = new URLVariables();

sendingData.one = one;
sendindData.two - two;

I get a little confused after this any suggestions? I am not sure how the URL request works and the data is returned.

SendAndLoad
Hey guys..

when receiving data from php, MUST it be in variables ?.. like var1=something&var2=somethingelse& ..or can i read "raw" data, like with LoadVars

?

SendAndLoad() With .ASP And XML
Happy Friday everyone!

OKOK, here is what i am 'trying' to do. I have a flash menu which is currently loading its contents via a ever-changing XML file... well this has always been a good thing and worked just fine... until the release of AOL 9.0, which for some reason causes the XML to stop loading.

So I found a workaround for this... rather than calling "menu.xml" I have this sript called "proxy.asp" which loads the "menu.xml" file into it via some sort of crazy .asp tunneling and object creation. Here is the proxy.asp file::


Code:
<%@ LANGUAGE=VBScript%>
<%
Response.Buffer=True
Dim MyConnection, TheURL

' Specifying the URL
TheURL = "http://www.mywebsite.com/flash/menu.xml"

Set MyConnection = Server.CreateObject("Microsoft.XMLHTTP")
' Connecting to the URL
MyConnection.Open "GET", TheURL, False

' Sending and getting data
MyConnection.Send
TheData = MyConnection.responseText

'Set the appropriate content type
Response.ContentType = MyConnection.getResponseHeader("Content-Type")
Response.Write (TheData)

Set MyConnection = Nothing
%>

Ok?

NOW...since I run in literally hundreds of websites I need it to be dynamic. Is there a way for me to use the sendAndLoad() in Flash to pass the "proxy.asp" file a couple variables that will return the XML as an XML Object back into Flash? I know it can return Strings, but I need to learn how to send 2 variables out - ID and progID - and then based on that I will have the "theURL" variable in the proxy.asp file load the appropriate menu.xml file.

So the jist of my question is how do I set up a sendAndLoad() with the LoadVars() and return XML from the proxy.asp??

Lol.... I just read through that and even I am confused -- sorry!

Thanks for any help guys!

SendAndLoad
I want to sent data to php. Here my code, and this works for getting data from php but I don't understand how I can send data to php with sendandload

on (release) {
test=new LoadVars();
test.onLoad = function(success)
{
if(success) { trace(test.var1);} // var1 is send from php to AS :
// this works

else { trace("didn't work");}
}
test.sendAndLoad("save.php?kill="+new Date().getTime(), test, "POST");
}

Can anyone help me ??? thanks alot

SendAndLoad Pop Up
Hello,

I am making a site which has a flash based CMS system where the admin needs to be able to upload image files. Until we get our hands on the next version of flash I am doing the uploads via an html/php pop up box. I am calling the page using sendAndLoad so that I can pass variables to the php script. However I would like to set the size of the resultant pop up box.

Any ideas?

Copyright Đ 2005-08 www.BigResource.com, All rights reserved