ActionScript 2.0 :: Returning Values Out Of XML OnLoad?
Feb 10, 2005
I'm trying to take an xml object, parse through it, turn the appropriate elements in object properties. Then, finally, pushing each object an array. Then I need this array accessible outside of the XML.onLoad() function (since it returns nothing, I lose my array).
Here's the code from my timeline:
#include "functions.as"
XML.prototype.ignoreWhite = true;
var top_nav:Array = new Array();
var my_xml:XML = new XML();
var xml_url:String = "nav/top_nav.xml";
[Code] .....
How I can get needed values out of the onLoad function?
View 1 Replies
Similar Posts:
Feb 10, 2005
I'm trying to take an xml object, parse through it, turn the appropriate elements in object properties. Then, finally, pushing each object an array.
Then I need this array accessible outside of the XML.onLoad() function (since it returns nothing, I lose my array).
Here's the code from my timeline:
#include "functions.as"
XML.prototype.ignoreWhite = true;
var top_nav:Array = new Array();
[Code]....
how I can get needed values out of the onLoad function?
View 1 Replies
Oct 12, 2005
I need to load data from a database, so I created the following function and placed it in frame 2 on the main timeline.
Code:
getQuestionSet = function (category:String, subject:String, level:Number, count:Number):Array {
var questionSet:Array = new Array();
var writeV:LoadVars = new LoadVars();
[Code]...
Whenever I try to call the function, it fails to set the value of the questions array. It always appears empty(questions[0]-questions[10] have the value undefined). But, if I check the values from within the function after I have set them, it works, so I know that it is receiving the values. What am I doing wrong?
Code:
questions = getQuestionSet("Art and Music", "Art", 1, 10);
Here is an example of how I have would call the function.
View 7 Replies
Feb 3, 2009
I am getting variaables from a mysql database and then returning them back to the main file. However, the script is going faster than the query. is there a function that can make the file wait until it has finished loading in the variables.
Code below:
practiceIntroScreen.as
Code:
[code]....
View 2 Replies
Feb 20, 2011
I'm running some script using the charAt() function, that is supposed to return the character at specific indexes in a string, however for some reason it is returning ASCII values.
View 2 Replies
Feb 24, 2012
I have a project made in flex, using php data services to access a sql server database, and I need to convert it to mysql, I have changed all my php services from sqlsrv to mysqli. Something like this:
$this->connection = mysqli_connect(SERVER,USERNAME,PASSWORD,DATABASE); // Start Connection
$ssqlstring = "select * from Users";
$runssql = mysqli_query($this->connection, $ssqlstring);
while($user = mysqli_fetch_array($runssql)) {
$users[$user["ID"]] = $user;
} return $users;
It worked fine on sqlsrv but with mysqli it returns to flex the INT, BIT or DATE values as string the main Datatypes on mysql are INT,VARCHAR,BIT(1),DATETIME,DATE (same as sqlsrv)
and on the flex the return types are mainly as object[]
View 1 Replies
Jun 9, 2010
Let's start with the following XML:
Code:
<swatches>
<swatch>
<swatchName>Plaid</swatchName>
<swatchColors>
<color>black</color>
[Code] .....
I want to return a list of the <color> values without having any duplicates.
View 2 Replies
Jul 15, 2009
I'm making an activity that involves measuring the depth of a fictitious river at various points. I have an array containing those depths at the various points and a slider for traversing through the depths and outputting to a textfield.
As the user moves the slider up and down, they can see the depth of the river at that point and plot it onto a graph. What I would like to do is be able to figure out the depths inbetween the explicitly defined values.
here is the code, it's pretty simple:
[Code].....
How would I go about figuring out the values inbetween?
View 2 Replies
Apr 12, 2010
In C you can pass a reference to a data item as a parameter to a function. then within the function you can write to that address thus passing back a value to the caller. Can you do anything similar in AS3?
I know you can use the return statement but I want to return a status by that mechanism plus a value in a parameter.
View 10 Replies
Jun 5, 2011
I am developing in Flash Builder 4.5 using as3.
I have created a class to connect, write and read to a TCP Socket using 'import flash.net.Socket;'
Within this class is an event listener which reads the incomming data:
Code:
socket.addEventListener(ProgressEvent.SOCKET_DATA, readSocketData);
private function readSocketData(progressEvent:ProgressEvent):void {var response:String = socket.readUTFBytes(socket.bytesAvailable);
trace response;}
My problem is how to output this data back to my main application. Ultimately I want to process the data and output it in a text box.
View 4 Replies
May 26, 2010
I am trying to connect to an FMS application without flash (no SWF). To the best of my knowledge,the only way to accomplish this is thru the admin APIs, is that correct? If so, how do I return meaningful values from the admin API? I can call functions and stuff using the broadcastMsg API call but I can't seem to get back any values. All that is returned is a useless "Success" type message. I have tried using shared objects and the getSharedObjects API call, but the call doesn't return any info on the contents of the shared objects, just their names and some info on their persistance.
Is there another way of accomplishing my goal outside of the Admin API? If not how do I return meaningful variables from the Admin API? Is there a way to hack or extend the admin API?
View 2 Replies
Nov 20, 2006
I am writting an image gallery that loads one intial xml file named galleries.xml.From this point each xml node loads a XMl file for that gallery that holds all the images.The problem arises in the fact that to do this I need a onload function within an onload function.Onload functions dont accept parameters so I can pass down the variable that shows what loop the gallery loop is on as I need that in the function that holds the images.
View 4 Replies
Dec 6, 2010
I've gotten these sliders to work but can't get the output values to add up. For instance, depending on the values for slider 1, 2 and 3, I need the total to show up in a separate text box. I keep getting a NaN message in the text box.Here's the code I have so far:
//item 1
sliderOne.width = 600;
sliderOne.value = 0;[code].....
View 3 Replies
Oct 28, 2009
I am loading an XML file and when I run a trace inside the onLoad event the results show.When I put the same trace outside that event, the trace returns undefined because it runs before the XML is Loaded.I don't know how to assign the results of the XML to a variable being used outside the XML unless I call that through another event.For example. I want to preload some images if the user has been to the movie before. I call XML which has the image array. But I can't tap into that array because my function is outside the XML Load event and my function is not tied to an event.
View 2 Replies
Mar 25, 2005
look at this code, what's wrong?
_parent.unit['bullet'+openbullet].onLoad = bulletload;
function bulletload() {
this.range = 5;[code]...
my mc.enterfame works but this doesn't. I think it's because it's on load and for this to be implemented it has to be called after load so how do i use it? I tried to call it on the original but it didn't work.
View 6 Replies
Sep 5, 2006
With the following code I get an output of:
true
true
It seems that the onLoad method fires twice ?? I know the .load method has to come after the .onLoad function for the function to work but that doesn�t seem to be the problem in this case.
[AS]xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function(loaded) {
[Code]....
View 5 Replies
May 10, 2007
How do I send a variable from the url [URL] to an embedded swf in that php?In other words, how do I get the embedded swf to load the variable from the URL. It needs to pass it, which I'm trying to accomplish via Javascript.
View 1 Replies
Feb 23, 2009
Is there a way that I can run a function when it first loads, as if it wasn't inside of the function, but still be able to call that block of code as a function later on? For example if I did...
Code:
someFunction();
function someFunction():void{
//do this
}
It wouldn't work correctly.. I need it to do what is inside the function as if it wasn't in the function, which it loads, but also be able to call it again later on.
View 2 Replies
Mar 9, 2009
I am loading one xml file and onload (or onData) of this file I am calling another function but, this function is not getting called. What can be the issue? Can delegates be used here and how?
Here is the code for reference
Code:
//path for _global.bookXML is defined already.
_global.book_xml = new XML();
_global.book_xml.ignoreWhite = true;
[Code]....
View 2 Replies
Jun 17, 2009
I managed to load data from xml file (at last) and now I faced another problem. I can give value to a variable, but cannot use outside of onLoad function. Lemme show you what I mean:
configXML = new XML();
configXML.ignoreWhite = true;
configXML.onLoad = function(success) {
[Code]....
The first trace(variable) command (inside the onLoad function) returns the correct value, but the second (out of onLoad) returns undefined. I need the values elsewhere, not in onLoad.
View 1 Replies
Feb 9, 2004
This should be easy to answer...
I have 2 swf's:
Section.swf (to be loaded in main) Main.swf
In section.swf, on the first frame I have this:
[AS]
onLoad = function(){
// start doing stuff
When I run the section.swf on its own, the onload function works, and the "doing stuff" code runs. But when I load it into main, this onload (within the section.swf, above) does not run.
View 7 Replies
Oct 8, 2004
load XML data (it parses automatically), parse through the XML tree and assign the values to an array of my choosing for access later in the movie. I can load the XML data, but the only time I can access the XML functions, i.e. XML.firstChild, or XML.getChildNodes(), is when I am within an XML. onLoad function.[code]Shouldn't I be able to call these XML function and properties from anywhere? not just within the XML.onLoad function? I look at other people's scripts and they do it, but I can't?I created a function that parses through the data and puts it into an array. And that works well if I say XMLdata.onLoad = my_array_funtion();But the problem is, if I do it that way I can't get the array out of the function. I can't return the value because the function is being called from an onLoad event and the return value of the function isn't assigned to a variable. So the array I create is worthless.And there is no way to call the function, and have the XML.functions, i.e. XML.firstChild, to work outside of an XML.onLoad event. Is there? Please tell me there is a way.I tried assigning the array to a global variable, but evidently you can't modify _globals within a function.Ultimately, I need this array because later in the script I use the data on the fly, and I want instant access to it.
View 2 Replies
Mar 25, 2005
[Code]...
my mc.enterfame works but this doesn't. I think it's because it's on load and for this to be implemented it has to be called after load so how do i use it? I tried to call it on the original but it didn't work.
View 6 Replies
Jul 8, 2009
I have following code on AS2 . Now I need to convert into AS3.
[Code]...
View 2 Replies
Aug 25, 2009
I've been searching this problem for a while and have tried a number of solutions found on google but nothing has worked so far. I'm sure this is a common problem, but due to my lack of flash knowledge I can't logically work through it as I'm used to windows form development, it makes sense to me that the function could access the variables I have defined but they dissapear after the .onLoad event. Does anyone know the common solution to this problem? I want to be able to pass the xml details into the local variables so I can pass on the details into a dynamic text field when movies are hovered over etc.
[Code]...
View 3 Replies
Sep 9, 2010
Can I write onload function without using EventListener...? Iget boolean value from loader..?
View 1 Replies
Sep 17, 2010
i have this code that load on a keyframe
loadListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
info.text = Math.round((bytesLoaded/bytesTotal)*100)+"%";
[Code]....
Because the swf_loader are mp3 player and if i change page wihout having press the stop button first the music is still playing. I have try to just add swf_loader.unloadMovie(); on every other keyframe but it doesnt work. i guess i have to find out where this swf_loader exist/is included right?
View 5 Replies
Jul 5, 2009
I've been sitting here for the last 2 hours trying to figure this one out.I have an empty movieclip on stage, and I'm loading external images in it using loadMovie()The problem is as following; I want it to resize when the image has fully loaded.I've been googling and googling non-stop, but found nothing that works.
View 1 Replies
Jan 14, 2010
I want to load a function/sound to play ONLY on the first load.eg/I have four pages, one page has a sound that loads every time I click back to that page. Is there a way to make it only load the first time that page is loaded?
View 5 Replies
Feb 2, 2010
Is there a way to fire up a call to a php on my website everytime the .swf file is loaded?
View 1 Replies