ActionScript 1/2 :: Xml.onLoad Variables Undefined Outside?
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
Similar Posts:
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
var myXML:XML = new XML();
myXML.ignoreWhite=true;
var nav1Text:String;
[code].....
View 3 Replies
Aug 5, 2004
I have 2 loadVars - myVars, myPictures
basically i have defined their onLoad functions
so in myVars, i call for
Code:
myPictures.load("http://www.fakedevil.com/lurgee/pictures2.php?id="+this._parent.link2.text+"&time=" add getTimer(), "");
pictures2.php is working cos I just check so by rite the variables loaded should change.. but somehow each time I check those variables in myPictures.onLoad, the variables are always the same.
View 5 Replies
Nov 7, 2005
I'm trying to pass a variable out of the 'XML.onLoad = function() {', but the variable keeps coming up undefined. This is what my actionscipt looks like:
Code:
XMLData.onLoad = function() {
_global.variable = ......
} trace(variable)
View 6 Replies
Jan 20, 2004
I've created a multi-framed flash file that's calling multiple variables from an external php (text) file. I'm using an onload command to do this and for some reason the variables seem to "disappear" once I leave the first frame (where the onload and load commands are)I'm figuring that my problem has to do with 'variables scope'. I've read the article on this site but I don't know actionscript well enough to proceed.I ultimately want to do away with using multiple frames by using multidemsional arrays and for...next loops, but this is what I have to work with (for now). I'm going crazy trying to get THIS to work.
[AS]
// ##################################
// FRAME 1
[code]......
View 4 Replies
Sep 26, 2004
Is it possible to retain variable information after exiting an onLoad event?I have a variable declared outside the onLoad event which a function called from within the onLoad event populates. The problem is, after leaving the onLoad event the variable gets cleared
View 1 Replies
Jan 29, 2008
i have a list cranked out from an XML file (movieclips attached to empty clip). currently it loads as the SWF launches. i can't get it to scroll because the variables won't travel outside the xml.onLoad process. what i'm wondering is once i bury this process into a button activated function, will i be able to access the list's properties? (sweet Buddha i hope that made sense...)
it seems the fundamental principle i'm struggling with is var/scope issues: how and where variables/properies can travel. i can't seem to find an explanation that makes sense from a C++ perspective. everytime i think i get it, something like this kicks me in the nuts. for those who want to dig, i'm using Kirupa's custom scrollbar modified (seemingly unsuccessfully) to my own setup. if you can recommend a different one more suited to this sort of thing, i'm open to it. if this doesn't make sense, i can attach the FLA but its a bit of a read and i'm in need of an answer before Thursday. methinks once this project is done, i'm going to hire someone for a week to fill in the gaps in my knowledge!
View 4 Replies
Jun 15, 2010
I'm writing code that takes data from mysql that's processed by a PHP script. It's actually a bit bizarre, at least to me. Anyway, here's some basic AS3 code that's moving toward what I want to do:
var loader:URLLoader = new URLLoader();
var urlRequest:URLRequest=new URLRequest("receive.php");
urlRequest.method=URLRequestMethod.GET;[code]....
For some reason, the statement "trace(evt.target.data);" produces a whole pile of garbled text before the actual stuff that it's supposed to show Because of problem #1, I've had to include a throwaway variable at the beginning, otherwise the first variable I try to pass into AS3 comes back as undefined. This causes errors when I run my flash movie in the IDE, but when I run it from the browser it doesn't seem to have any effect.But this is the strangest thing of all whenever I make any changes to the database (and subsequently try to load data from different variables), the new variables come back as undefined. For example, let's say that I add another entry to the database, and decide to load students 2, 3, and 4 instead of 1, 2, and 3. When I do that, any new data I've added comes back as undefined, even though when I view the PHP output in my browser, it looks just fine.
And now for the REALLY bizarre part: I'll copy that output, paste it into my PHP script as an echo statement, comment everything else out, and my flash movie runs fine. Even though the output from the PHP script is exactly the same, it gives me errors.
View 9 Replies
Aug 24, 2011
Im trying to fetch some data from PHP and use it in a link in flash AS3. flash code:
[Code]...
View 3 Replies
Jul 18, 2011
I can't seem to find the solution. Just a newbie in AS3 and trying to pass data from mysql to flash. Here's my code.
[code]...
View 9 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
Mar 7, 2010
[Code]....
I do not understand why i am getting undefined on the last trace.
View 7 Replies
Oct 11, 2009
I have a class like this..
public class Doc {
public function Doc():void {}
public var myVar:Boolean;
}
How can I know if the value held by myVar is default false, or someone has assigned false to it? Isn't there an undefined state? How can I achieve such a thing?
View 2 Replies
Nov 15, 2010
Trying to load some variables into flash I've done it before and it's work fine for some reason it's not working with this project.I get undefined values.Here's the embed code:
Code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="650" height="650" id="Roulette" align="middle">
<param name="movie" value="roulette.swf" />
<param name="quality" value="high" />[code]......
View 5 Replies
Jan 29, 2011
I get this error 1120: Access of undefined property OtherClass.
Ths is the code:
Code:
public class SomeClass extends MovieClip {
function SomeClass():void {
} public function SomeFunction():void {
var i:int = OtherClass.myVar;
trace(i);
}}
Code:
public class OtherClass {
public static var myVar:int = 2;
public function OtherClass():void {
}}
View 4 Replies
May 10, 2011
I have a function that once called creates some new variables
function createPane(event:Event):void
{
var manager:IPaneManager = map.getPaneManager();
[code].....
View 3 Replies
Jul 2, 2009
I loaded and then trace my _global variables for three screens and they follow me fine until,. then on the the screen i have tiny bit of code:
[Code]...
Could it be the level 99 I use. I tried using 0 and it did not work? I have tried doing this for way too long,
View 0 Replies
Feb 13, 2010
I have a PHP file located at http:[url]....which looks like
Code:
<?php
$one = 40;
$two = 60;[code]........
which is basically the code to create a pie chart.Is it possible to use the variable "onev" in frame 1 for the value in my movieclip "share_value[0]",and use the variable "twov" in frame 1 for the value in my movieclip "share_value[1]",so basically my PHP variables are used to control the values on
Code:
share_value[0] = 40;
share_color[0] = "0x82b1cf";
share_value[1] = 60;
share_color[1] = "0xb4cfe2";
I have been hacking around with this for days and tried so many things, such as setting global variables etc, but nothing seems to work and I either nothing or I get "undefined" in my output box.
View 1 Replies
Mar 6, 2009
When I don't include the "www" in the URL, the variables do not populate. When I do include it, they populate just fine... CHeck it out
[URL]
I talked to the hosting company and they claim that the problem isn't something on their end. They tell me its something in my code. Would it be in the html, php or my actionscript. I'm using AS 2.0.
View 1 Replies
Oct 12, 2010
im having problems getting some as3 generated (not drawn on stage) movie clips moving across the screen.
Code:
package {
import flash.geom.ColorTransform;
import flash.display.MovieClip;
import fl.motion.Color;
import flash.display.*;
[code]....
View 7 Replies
Jul 12, 2007
i am using flash, .Net, and MySQL and have elements (text fields) posting in flash.Question is, if the table in the data base is not holding the var char how can I set the text field in flash to not show undefined and just be blank?
View 6 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