ActionScript 3.0 :: Variables With URLLoader?
Jul 21, 2009
Recently i got job that finaly includes some AS3, so im getting back into the world of flash again. But as you all can imagen, not without problems... let me explain what i'm trying to get working:
A little background:We are currently recreating a game within flash, the game requires a login to create a sessionid (server side) to retrieve gamedata based on that sessionid. The login page for this, is done with a certain framework (cake), wich we are not going to change, because the existing game is already in production phase.
The problem:The original form sends the username and password with nested variables like this:
<input id="LoginUsername" type="text" value="" maxlength="40" name="data[Login][username]"/>
<input type="password" id="LoginPassword" value="" name="data[Login][password]"/>
AS3Trying to replicate the request in as3 like this:
[AS]
public function login(username:String, password:String):void{
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest(this.baseUrl + this.loginPath);
[code].....
View 9 Replies
Similar Posts:
Sep 6, 2011
How can I get variables from exernal source using URLLoader inside a loop?
As variables are something like this:
n0=val&n1=val&n2=val............&nn=val
View 9 Replies
May 11, 2009
Having trouble get the URLLoader class to work.Unsure but I must be missing something basic.Just trying to send name/value pairs from asp to flash.AS3 Code:
Code:
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
[code]....
View 3 Replies
Mar 24, 2007
i've been setting up a high score table in my game, and everything is working, but i cant work out how to get variables from the URLLoader.data that im retrievingif i trace loadedScores.data, i get this&name1=matt&score1=323250&name2=1234567890123456.. . and so o've tried passing it to a URLVariables constructor, but it says the string doesnt contain the correct name/variable pairs or something, and loadedScores.data.name1 doesnt work.
View 8 Replies
Feb 18, 2010
I am building a simple swf that will load in variables from an asp page using a URLloader and URLRequest. The asp page loads in the current values from a SQL database but these values will change every second. My swf loops every 6 frames and loads the data. How much load this puts on the server? And when the server is busy might this cause a problem with the variables I am reading in?
Does AS3 run all actions on frame 1 before going to frame 2 etc? I don't know if this is the best way but my last variable in the ASP page is called Loaded and I test for it before moving on. My major concern is the load I am putting on the website but is this small? In firefox the status box constantly flickers transferring data from ... and waiting .. but in other browsers you can't see the activity.
View 2 Replies
Jan 19, 2009
I know you can track the progress of URLLoader receiving variables, but has anyone found a way to track the progress of it sending variables?
View 0 Replies
Oct 24, 2011
I am trying to get my PHP variables from my load.php document to my flash-document.That all works fine and I am able to get my data down to flash variables inside my function.But, I would like to be able to access this data from outside of this function which gets the data - unfortunately I cant, or.. Don't know how to. I hope that you are able to shed a light upon my problem. So here goes, this is my code:
Code:
var myLoader:URLLoader = new URLLoader()
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES
[code].....
View 1 Replies
Jul 31, 2009
Is there a easy / good way of getting the url from the URLLoader object? It seems at least two other people (this guy and this this guy) have wondered the same thing. Maybe we can get an answer here on s.o.?
View 2 Replies
Mar 26, 2010
I'm building a portfolio website and I'm using URLloaders to load new content.I want the user to be able to change the content they're loading before it completes. aka, stop the current load and load something else.
Adobe Actionscript 3.0 reference says I can use the following:"Use the unload() method to remove movies or images loaded with this method, or to cancel a load operation that is in progress."
Here's what I have (my attempt to stop the loader is in bold):
button_btn.addEventListener(MouseEvent.CLICK, newPage);
function newPage(e:MouseEvent):void { loaderState=true; newDescription();
if (loading){
[code]....
I'm getting the following error on loader.unload(req); : "1137: Incorrect number of arguments. Expected no more than 0."I've also tried just using loader.unload(); but it doesn't work - the url loader just continues to load and doesn't load the new content.
View 5 Replies
Apr 13, 2011
I'm trying to do a real simple POST HTTP request using URLLoader. I'm following the next steps:
[Code]...
But, actually It does a GET request instead of a POST request. Is it possible to do a POST request without anything in the body of the request??
View 2 Replies
Jun 3, 2010
I am loading multiple xml files with URLLoader.
for (var i=0;i<xmlCount;i++) {
loadXML(xmlFiles[i], i);
}
[code].....
View 1 Replies
Apr 21, 2011
I'm want to use a URLLoader in one line, but I know Internet Explorer has given me problems loading local files when the listener is added after the load call.
new URLLoader(new URLRequest('http://example.com')).addEventListener(
Event.COMPLETE, handleLoadedData
);
[code].....
View 2 Replies
Jul 8, 2009
Everything runs fine in Firefox, but when the SWF tries to make a request in IE, I get an IOError. I've read that it might have something to do with no-cache settings and that a possible solution is to use URLRequestHeaders.
View 0 Replies
Nov 4, 2009
I'm trying to add a name property to the xmlLoader object just as I have successfully done with the photoLoader object. When the last line of code is present the following error is thrown:
1119: Access of possibly undefined property name through a reference with static type flash.net:URLLoader.
I suppose this has something to do with the URLLoader not inheriting from Display Object like Loader does. Is there anything I could do to add a name property to this URLLoader?[code]...
View 4 Replies
Mar 11, 2009
I am having an issue in getting flash to call my PHP script and then get the variables back into flash once the PHP script has queried a mysql database. I have tried to chop things in the php script down to their bare essentials. I am new to AS3 so I am having some trouble integrating the two. I know that my DB info and querying works so it must be something with passing data between flash and PHP.
import caurina.transitions.*;
import fl.controls.DataGrid;
import fl.controls.ScrollPolicy;[code]........
View 1 Replies
Jun 15, 2009
Anyone have any suggestions about unloading an URLLoader. I'm loading xml data and trying to load different data on button click, but it just keeps piling up, I'd like it to replace the old data.
View 7 Replies
Aug 5, 2009
Whats the difference between a URLLoader and just a loader?
and when would you use each one? Just been watching a video tutorial and the guy loaded some XML using the URLLoader but I've seen just the Loader being used for other items such as jpg's.
View 1 Replies
Feb 14, 2010
I am having a problem with my ProgressEvent.PROGRESS handler. It looks like this:
Code:
function handleProgress( event:ProgressEvent ):void {
var percent:Number = Math.round( event.bytesLoaded / event.bytesTotal * 100 );
trace("Uploading %" + percent);
}
It just traces "Uploading %100" every time
I am using a big file so I know its taking several seconds between calling URLLoader.load and complete. There just doesn't seem to be a report in between 0-100..
View 12 Replies
Feb 21, 2010
I am loading a sound file with the URLLoader class passed to the URLRequest class, just as one would load any other external content type.
Code:
var loader:URLLoader=new URLLoader;
loader.load(new URLRequest("file.mp3"));
When the loading is complete I would like to pass the data to a Sound Object.
Code:
var mySound:Sound=e.currentTarget.data
The object returned on the complete event is of type flash.net::URLLoader.
Code:
e.currentTarget
How can I turn this URLLoader into a Sound Object?
View 5 Replies
May 23, 2011
I have encountered an interesting problem when I try to load an .xml file using a URLLoader (within my own custom class). I have several configuration .xml files which I use to configure the application when it launches. For example, in the code below, myCustomLoader is a custom class I wrote that takes an .xml file as a parameter. The myCustomLoader class encapsulates all the instantiation of the URLLoader class and error handling etc. The code below operates as expected, the configuration files load into memory, and they're accessible throughout my App.
[Code]...
View 7 Replies
Oct 9, 2008
I want to instruct a server-side PHP script to generate a dynamic PDF using variables I submit from Flash. I then want to download that PDF back into my Flash application. Can I use "Loader" or "URLLoader" ? If so, how do I structure my code to render the PDF within Flash when it comes back from PHP? ...or do I have to use Flash Remoting or other means to achieve my goal?
View 3 Replies
Dec 17, 2008
I want to use URLLoader to load a textified article from my joomla website [code]...
View 13 Replies
May 7, 2009
I have started creating a panel plugin for Photoshop, but I seem to have run into a road block. I am using a simple URLLoader to grab some info from the internet, but when I load the plugin it never seems to be called nor does it fail. Here is an example of what I am trying to do.
var url:String = "http://www.mySite.com/page.php";var urlR:URLRequest = new URLRequest(url);urlL = new URLLoader();urlR.contentType = "text/plain";urlR.data = "var=something";urlL.addEventListener(Event.COMPLETE,
[Code].....
View 2 Replies
Jul 15, 2009
Say I'm using a URLLoader to access a PHP file.Is there some way to verify, from the PHP file, that it is Flash attempting to connect?Like, does Flash Player send some sort of unique data to the server when requesting the page that I can use to verify the integrety of the data (in order to prevent people sending data to the PHP file from any other souce)?
View 1 Replies
Oct 19, 2009
My flash application seems to run correctly on Windows but not on a mac. It is supposed to retrieve data from a php file with the following code:.
[Code]...
When loaded directly from a browser, the php code works fine both on Windows and Mac. But the flash app throws a Error #2048 on Mac. here's the code for the app:
[Code]....
View 1 Replies
Jun 22, 2010
I'm making a AS3 project which is quite simple. There're some background graphics and some text field, visually that's it! And load a xml which is currenlty being loaded locally and just display the xml in the text field. if I test it, it works absolutely fine. And if just double click the swf, it works fine too! BUT if I drag the swf to Firefox or Safari, it displays notthing, but it works fine on IE. Why is it happening? If I delete this,
[Code]...
View 1 Replies
Jul 4, 2010
I'm loading external logo into my SWF with following code: var request:URLRequest = new URLRequest("logo.swf");var logoloader:Loader = new Loader();logoloader.load(request);addChild(logoloader);logoloader.x = 5;logoloader.y = 5; Everything works fine as long as I have logo.swf in right place. Is there an easy way to improve that code so that it wouldn't matter if there is logo.swf, logo.png or logo.jpg as long as one of those files exists in right place? I just would like to give my clients change to use other formats than SWF if they like, because some of them doesn't have flash or any other software with SWF exporting capability. all of them have Photoshop or some other Image software....
View 3 Replies
Sep 14, 2010
I have an Flex app that loads xml files with URLLoader/URLRequest methods, and works perfectly. The problem is that the .xml files are stored in "Temporary Internet Files" folder of the browser, and we dont want that the user can open or read those .xml files. Do you know any way to prevent that xml files are stored in the user browser cache folder? or any alternative way to load the data of the xml files, or read it directly from the server?
View 6 Replies
Oct 20, 2010
Why you need to actually send some data in order for UrlLoader to send custom request headers.For example this code is working:
var ul:URLLoader = new URLLoader(); var urlRequest:URLRequest = new URLRequest(); ul.addEventListener( Event.COMPLETE, onComplete
[code].....
View 1 Replies
Jul 11, 2011
Here is the thing: I use a URLLoader to load a PHP script, and receive an answer. Ok, fine, but the problem is: sometimes it does'nt work...Yeah, my big problem is the SOMETIMES. I can't figure out why would it only be sometimes, it's killing me. Anyway, it doesn't generate any error, it just stop in the middle of the scriptHere is some code (in french mostly,):
var enveloppe:URLLoader = new URLLoader;
function envoyerCode(event){ //Sending PHP Script to database var variablesLocales:URLVariables = new URLVariables(); var scriptPromo:URLRequest = new
[code].....
View 2 Replies