ActionScript 3.0 :: Dynamically Populating URLvariables?
Oct 2, 2009
I am currently trying to write a simple class that handles form validation with a backend script, how the backend script works is that you POST a variable type and it's value and an XML is returned with any errors. The problem is, I want to be able to dynamically generate the variable names so that they don't have to be hard coded into the class. Is this possible?for example:instead of
ActionScript Code:
var urlVariables:UrlVariables = new UrlVariables();
urlVariables.first_name = "foo";
[code]......
View 2 Replies
Similar Posts:
Oct 9, 2009
Is it possible to assign variables dynamically to URLVariables?
View 6 Replies
Jul 13, 2010
I'm trying to wrap my brain around getting data into my project in a way that I can use.. I want to use MySQL & PHP my Flashbuilder app and I'm not populating a datagrid so......
For simplicities sake, In my database table I have 3 columns "ID, Title & Content". I want to use this to populate the different states in my flashbuilder project.
Normally in a web page I could say in the sql statement "SELECT * FROM table WHERE ID = 1" to get the first row of info and I could put my Title and Content where I want them on my page I can change the query to "SELECT * FROM table WHERE ID = 2" to populate page 2 to get it's title and content.
In flashbuilder it all on the same page and I'm not understanding how to populate a singular text field for a title or content area with a single field from the database.
View 1 Replies
Apr 13, 2003
I want to dynamically create a menu based on an XML file, which will specify the categories and sub-categories.PRoblem is, I'm not sure where to start as far as getting Flash to read the XML, create a menu item, and then move onto the next section.
View 1 Replies
Sep 6, 2009
When I tried to populate an arraycollection dynamically its saying no values found. Code that I used for this is given below:
[Bindable]
private var myARR:ArrayCollection=new ArrayCollection();
private function abc(){
var myStr:String="{year:'2004',Test1:10,Test2:20,Test3 :30}";
myArr.addItem(myStr);
}
View 0 Replies
Mar 15, 2012
been working in Flash using AS2 and loading external XML data into the movie. I am able to load the data into in Flash and parse it, but I haven't been able to figure out how to load the names of buttons from separate nod values into a textfield.Unfortunately, I dont feel I know AS3 well enough and am a little bit rusty on my AS2.I created a movie clip which holds the dynamic textfield and placed 30 instances on the stage. Each instance is successively named "cityName[i]" where i is a number from 1-30. I've tried setting the instances as both buttons and movie clips. I also tried setting both the .text and.htmlText attributes, but neither works. Ive embedded the fonts on the dynamic text field. Ive also tried changing the field to input instead of dynamic but that doesnďwork either. Ive been tracing things to try to debug, but havenď found the issue yet.Here's the code:
ActionScript Code:
//load XML data
var citiesData:XML = new XML();
[code]........
View 1 Replies
Mar 15, 2012
Ive been working in Flash using AS2 and loading external XML data into the movie. I am able to load the data into in Flash and parse it, but I haven't been able to figure out how to load the names of buttons from separate nod values into a textfield.
I created a movie clip which holds the dynamic textfield and placed 30 instances on the stage. Each instance is successively named "cityName[i]" where i is a number from 1-30. I've tried setting the instances as both buttons and movie clips. I also tried setting both the .text and.htmlText attributes, but neither works. Ive embedded the fonts on the dynamic text field. Ive also tried changing the field to input instead of dynamic but that doesnt work either. Ive been tracing things to try to debug, but havent found the issue yet.
Here's the code:
Code:
//load XML data
var citiesData:XML = new XML();
citiesData.ignoreWhite = true;
[Code]....
View 1 Replies
Mar 24, 2009
This is my code to send a multi-dimentional array to a PHP script:
Code:
var sendData:URLVariables = new URLVariables();
var sendRequest:URLRequest = new URLRequest();
[code]....
View 3 Replies
Sep 28, 2011
I like to get the URLvariables from the addressbar. For ex: [URL] i need to get aID and bID values into flash.
View 1 Replies
Apr 6, 2011
I was actually watching a tutorial about how to make a highscore table. The problem is it was done in AS2 and I'm using AS3. I've been searching tutorials for 2 days and so far I've converted what I could. In the AS2 tutorial he uses loadVariables which works for him and I've successfully used URLVariables to pull in my php variables in AS3. But, when he pulls in his variables for instance name1="happy",score1="100", he uses the set command and these variables can automatically be referenced by var1 and var2 respectively and can populate the dynamic text fields of his score board.
Set works differently in AS3 and using URLVariables I see the string of name/value pairs and I've split them up with an array, but, when I try to display them AS3 treats these name/value pairs as a value of the array instead of name/value pairs. I understand that you can load URLVariables as name/value pairs, but, how do you get AS3 to treat them as name/value pairs once the string is loaded?Sample code:
var sumString:String = event.target.data;
var sumArray:Array= sumString.split("&");
trace(sumArray); //this shows the whole array string
[code]....
View 2 Replies
Jul 20, 2006
I get the following errors when I try using URLVariables andURLRequest. Can anyone tell me what I'm doing wrong ?The class or interface 'flash.net.URLVariables' could not beloaded.var params:URLVariables = new URLVariables();The class or interface 'flash.net.URLRequest' could not beloaded.
var request:URLRequest = new
URLRequest("upload_process.php");
View 1 Replies
Jan 4, 2010
I have tried several different ways, but it seems that it never sends the empty array value to the server
_vars["myObject[array_list][]"] = null;
_vars["myObject[array_list][]"] = [];
It only seems to work if I provide a value (which I am trying to avoid). What I would like for it to do is send the url param: myObject[array_list][]=& (i.e. an empty value)
View 1 Replies
Dec 2, 2011
I have a URLVariables object (variables) that I'm setting its properties this way. [code]But the properties differ so I want to just pass an object in the following format and have it set the property names and values correctly.{fname: "fname", lname: "lname", address: "address"}I tried a forloop like this, but it's not working. Not sure exactly how I achieve the same thing as setting the properties manually.[code]
View 1 Replies
Aug 26, 2010
[code]the external swf runs fine. This can only mean that the issue is being caused by trying to send the variables, or am I missing something?
View 3 Replies
Feb 4, 2011
I'm uploading files to my server using File.upload();. My php file looks like this:
[Code].....
View 2 Replies
Mar 2, 2011
I am attempting to make a flash object that receives name/value pairs to a swf that resides inside a LCMS. There is some documentation on the topic from the lcms, but very little support. The documentation says to instantiate the flash class called URLvars (which doesn't exist, so I'm using URLVariables) and says to use this code with the following example if the name/value pair is baseColour = 0x1c617D (essentially, then, the value of the variable baseC would be 0x1c617D):
var thisURL:String = _url;
var vars:URLvars = new URLvars(thisURL);
var baseC:Number = vars.data_obj.baseColour;
I tried to do this in a very simple object, but it will not pull the name/value pairs from the LCMS
View 1 Replies
Mar 13, 2009
I have written up some code following preivous work. And it seems to me like it is correct.ut i am getting the below code when i click on my button to run the function!Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
at Error$/throwError()
at flash.net::URLVariables/decode()
at flash.net::URLVariables()
[code].....
View 2 Replies
Mar 28, 2009
I'm sending some data through an instance of URLVariables. I define it in a loop but basically it goes like this:
Name="blah";
E-Mail="blah@blah.com";
Phone="1223";
[code].....
View 7 Replies
Apr 17, 2009
Is there a way to return URLVariables from a function
eg:
function varsLoaded():URLVariables {
var variables:URLVariables = new URLVariables();
variables.var1 = 'string1';
[Code]....
Now what I would like to do is assign "variables" to a variable:
var theVar = varsLoaded();
trace(theVar.var1);
Obviously the code above isn't correct; just to illustrate what I'm hoping to accomplish.
View 1 Replies
Sep 18, 2009
I got a problem with URLVariablesprobably better to show by example
Code:
for each(var foo:String in fooArray){
variables.foo = foo;
}
this unfortunately doesn't work as intended as the old foo variable in the URLVariables get overridden each time.Thus when I output the variables as suchTried looking around the net for it but couldn't find anything. Also it seems logical enough that the variable gets overridden and I wouldn't really question it if it wasn't that ive been told the querystring should contain multiple definitions of the foo variable...
View 2 Replies
Dec 13, 2009
ActionScript Code:
//request is made to PHP script
function completor(evt:Event):void {
var getor:URLLoader = URLLoader(evt.target);//works
var vars:URLVariables = new URLVariables(getor.data);//doesn't work!
}
getData.addEventListener(Event.COMPLETE, completor);
The first line outputs something like "&var1=something&var2=something_else". I just can't get why when I try to parse the data from the loader object into variables (second line) Flash simply stops and all the code after doesn't get executed.
View 1 Replies
Apr 5, 2011
I have XML I'm dynamically creating and want to pass to a swf via URLVariables. What I have right now is the following:
var urlReq:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.data_file = "us/data.xml"; //data.xml is static/already created
[code].....
View 3 Replies
Aug 4, 2009
Does anyone have a way (or an alternative to) to get code below to work on local, windows if that matters, files (so not served on a http server)?If I use code below, the IOError eventhandler is triggered (it appearantly cannot deal with the ?testing=true trailing the filename)If URLRequestMethod is set to POST, the external file loads but its loaderInfo.parameters do not contain given parameters from the URLVariables object.
Code below does work on localhost so in essence it's OK, right?I can have the loaded file poll the parent or whatever to retrieve variables or push variables after Event.COMPLETE but that does not seem as elegant...
var l:Loader = new Loader();l.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, onError );var u:URLRequest = new URLRequest( "somefile.swf" );u.method = URLRequestMethod.GET;var d:URLVariables = new URLVariables();d.testing = "true";
u.data = d;
l.load( u );addChild( l );
function onError( e:IOErrorEvent ):void{ trace( e );}
View 2 Replies
Jan 9, 2012
Is it possible to use the underscore character in a URLVariables variable name? For instance, the following code outputs "my%5Fusername=foo" instead of "my_username=foo".
import flash.net.URLVariables;
var variables : URLVariables = new URLVariables("my_username=foo");
trace(variables.toString());
Just as in the trace, the "%5F" shows up instead of the underscore in the request. Is there some way I can get the underscore character to show up instead?
View 3 Replies
Dec 8, 2009
I am having trouble creating an email form in Flash. The PHP is working fine and the email sends if I query the php in a browser but when I pass the variables from Flash the email address that is passed gets ****ed up.
For example: the text I enter in the text field: bobloblaw@football.com what is sent to php: bobloblaw%40football%2Ecom
I realise this is probably to do with urlencoding and I have tried escape() on the strings
View 3 Replies
May 29, 2009
I am trying to transistion myself from AS 2.0 to AS 3.0. Everything is going really well except I am so confused about URLLoad & URLVariables.I've been trying to load external data via ASP and it does send back the variable I want, but that variable also has all the HTML of the page too.If someone can tell me what I'm doing wrong that would be great. If they can explain what's going on too, that would be a bonus Here's my code:
public class TestURL {
var MyRequest:URLRequest; var MyLoader:URLLoader ;
public function TestURL() { MyRequest = new
[code].....
View 9 Replies
Jul 15, 2009
I am passing a simple string from a PHP file, that looks like this.[code]I am asking flash to prase this data and display each field in a text field, it seems as it is failing at the myTextLoader.dataFormat = URLLoaderDataFormat.VARIABLES; because when i take it out or switch the dataFormat to TEXT, it does not produce that error.[code]Any Suggestion as to what needs to be changed in order for it to work, i tried to trace stuff, change the variable scope etc.
View 8 Replies
Mar 16, 2011
I'm using a Flash file to make a comments section for my website but every time I hit the button my query only outputs blank fields to MySQL throguh the PHP file.I'm wondering if it's my actionscript or PHP file... and I feel it may be my actionscript because all the rest of the SWL query I put in through PHP functions work.can anybody tell me what's wrong with the way I'm posting variables to my PHP/MySQL?[code]
View 2 Replies
Sep 1, 2010
In the following example (yes, I am coding on my timeline while I try to work this out - I know, I know) I am loading an SWF in an HTML page and then directing the SWF to get the query parameters from the current URL. The query parameter will contain the source for the video to play.
This seems straight forward to me but I cannot get myURL = urlVars.videoloc; to work. More specifically, urlVars.videoloc seems to be undefined rather than holding the query parameter from the URL. All other variables are correct; both wholeURL and urlVars are defined.[code]...
View 1 Replies
Aug 25, 2010
Code:
private function initRecentPics():void
{
[code].....
View 2 Replies