Xml.onLoad variables undefined outside
Hi all,
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 nav1TitleText:String;
var nav1Text:String;
var nav2TitleText:String;
var nav2Text:String;
var nav3TitleText:String;
var nav3Text:String;
var nav4TitleText:String;
var nav4Text:String;
myXML.load("navigation.xml");
myXML.onLoad = function(success){
if (success){
nav1TitleText = myXML.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
trace(nav1TitleText); \\ This one shows the text from the xml file
nav1Text = myXML.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
nav2TitleText = myXML.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
nav2Text = myXML.firstChild.childNodes[1].childNodes[2].firstChild.nodeValue;
nav3TitleText = myXML.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue;
nav3Text = myXML.firstChild.childNodes[2].childNodes[2].firstChild.nodeValue;
nav4TitleText = myXML.firstChild.childNodes[3].childNodes[1].firstChild.nodeValue;
nav4Text = myXML.firstChild.childNodes[3].childNodes[2].firstChild.nodeValue;
trace(nav1TitleText); // This one traces undefined
Hi, thanks for your reply. For some reason I've ended up with two of the same posts.
The other one is here: http://forums.adobe.com/message/2204418#2204418 and has been answered.
Cheers,
Bex
Similar Messages
-
Xml.onLoad variables undefined outside function
Hi all,
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.
Thanks in advance for any help.
var myXML:XML = new XML();
myXML.ignoreWhite=true
var nav1TitleText:String;
var nav1Text:String;
var nav2TitleText:String;
var nav2Text:String;
var nav3TitleText:String;
var nav3Text:String;
var nav4TitleText:String;
var nav4Text:String;
myXML.load("navigation.xml");
myXML.onLoad = function(success){
if (success){
nav1TitleText = myXML.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
trace(nav1TitleText); \\ This one shows the text from the xml file
nav1Text = myXML.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
nav2TitleText = myXML.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
nav2Text = myXML.firstChild.childNodes[1].childNodes[2].firstChild.nodeValue;
nav3TitleText = myXML.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue;
nav3Text = myXML.firstChild.childNodes[2].childNodes[2].firstChild.nodeValue;
nav4TitleText = myXML.firstChild.childNodes[3].childNodes[1].firstChild.nodeValue;
nav4Text = myXML.firstChild.childNodes[3].childNodes[2].firstChild.nodeValue;
trace(nav1TitleText); // This one traces undefinedThanks for your help, I have got it working now by doing as you suggested. In .net programming when you specify something to load, it will run the onload first, and then continue through to the rest of the code. I'm assuming flash runs all of the code (non-functions) regardless of order of code. So it was running the trace below the onLoad before the onLoad, even though I told it to myXML.Load() before the other code...
Seriously doesn't make sense to me.. lol
var myXML:XML = new XML();
myXML.ignoreWhite=true
var nav1TitleText:String;
var nav1Text:String;
var nav2TitleText:String;
var nav2Text:String;
var nav3TitleText:String;
var nav3Text:String;
var nav4TitleText:String;
var nav4Text:String;
myXML.load("navigation.xml");
myXML.onLoad = function(success){
if (success){
nav1TitleText = myXML.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
trace(nav1TitleText);
nav1Text = myXML.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
nav2TitleText = myXML.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
nav2Text = myXML.firstChild.childNodes[1].childNodes[2].firstChild.nodeValue;
nav3TitleText = myXML.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue;
nav3Text = myXML.firstChild.childNodes[2].childNodes[2].firstChild.nodeValue;
nav4TitleText = myXML.firstChild.childNodes[3].childNodes[1].firstChild.nodeValue;
nav4Text = myXML.firstChild.childNodes[3].childNodes[2].firstChild.nodeValue;
loadedValues();
function loadedValues()
trace(nav1TitleText);
navItem1.title1.text = nav1TitleText;
navItem2.title2.text = nav2TitleText;
navItem3.title3.text = nav3TitleText;
navItem4.title4.text = nav4TitleText;
Thank you again for your reply!
Bex -
_global variable lost outside of function?
Vexing riddle: why are my global variables undefined outside
of the functions that use them?
Loading XML file and creating arrays from the child nodes.
Like this:
var modules:Array = this.firstChild.childNodes;
_global.moduleContents = new Array();
for (var i = 0; i<modules.length; i++) {
_global.moduleContents.push(modules
.attributes.contents);
then I have another function that recursively extracts each
index from _global.moduleContents array and pushes them into a
_global. pageContents array. (see attached code)
I made sure to use _global. in front of all global variables.
The code workd flawlessly in itself. I am able to trace the whole
array or single array indices from within the functions.
But they are undefined outside of the functions! I checked to
make sure there is no local variable of the same names - in every
case I use _global before the variable name.
The crazy part of it is I tried testing some simple functions
with global variables in a new movie to understand the scope issues
and they worked fine!
function messages() {
_global.greetings = ["hello", "hi", "how are you?"];
function sayHi() {
_global.greetings.push("how goes it?");
sayHi();
messages();
trace("this is outside: "+_global.greetings);
Why not in this:Gotcha, what is happening is that you call a loading script
that basically works in the background of other scripting
operations, you can call multiple load actions and they will all
execute at the same time, because you have your trace call after
the load action and you are not waiting for that file to be loaded
you are getting an 'undefined' var.
You may want to put something in at the end of all of your if
(success) statements like
_global.docstructureLoaded = true;
checkLoadStatus();
then say this on your next load function;
_global.pageContentsLoaded =true;
checkLoadStatus();
then in your root area
checkLoadStatus(){
if(_global.pageContentsLoaded==true && .... ){
//when all your loads are done do this ...
Just to make sure that you arn't calling any other functions,
or moving your timeline ahead before your data gets to the right
place. -
I am getting followong error
XML Parsing Error: undefined entity
Location: chrome://weave/content/options.xul
Line Number 6, Column 3: <setting id="weave-account" type="string" title="&account.label;" />
--^I had this problem - it appeared to be due to having Firefox 4 with the Firefox Sync installed as an add-on. Firefox 4 has sync included so there is no need to have it as an add-on. I went to the add-on manager and removed Firefox Sync and now appears to be working correctly.
-
I'm having trouble adding an additional account to FireFTP. I keep getting a yellow box with this title:
XML Parsing Error: undefined entity
Location: chrome://fireftp/content/accountManager.xul
Line Number 216, Column 17:
<menu label="&charsetMenuMore1.label;" accesskey="&charsetMenuMore1.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMore1CharsetMenuRoot">
----------------^
Don't understand the problem, can anyone help please?Try updating FireFTP to the latest 2.0.20 version.
''An update for Firefox 32 compatibility.''
https://addons.mozilla.org/en-US/firefox/addon/fireftp/ -
The full error message is the following:
XML Parsing Error: Undefined entity
Location chrome://mozapps/content/downloads/unknown content type.xul
Line Number 30, Column 18In order to use ''nxm://'' links, Nexus Mod Manager must be installed and associated with the ''nxm'' protocol.
* http://www.nexusmods.com/skyrim/mods/modmanager/
In case of problems with this third-party program, please refer to its support forum:
* http://forums.nexusmods.com/index.php?/forum/1413-nmm-code-development-chat -
Mobil.aftonbladet.se results in XML Parsing Error: undefined entity
On Nokia N900.
Was OK before, but now (since friday 27 aug 2010) gives:
XML Parsing Error: undefined entity
Location: http://mobil.aftonbladet.se/
Line number 18, Column 366:
...Hi, thanks for the reply. That site is OK now.
If you have time, check out mobil.dn.se, which gives similar error on my N900:
XML Parsing Error: mismatched tag...
Which sounds like their web-programmers need some basic training. But that site is displayed correctly by Firefox 3.5.6 on my PC. I suppose that version is more tolerant to errors in the web pages? Will the mobile version of Firefox be developed to be more like the PC version in that way? -
SQL Server 2008 XML Datatype variable size limit
Can you please let me know the size limit for XML Data type variable in SQL Server 2008?
I have read some where that the XML data type holds up to 2GB size. But, its not the case.
We have defined a variable with XML data type and assigning the value by using SELECT statement FOR XML AUTO with in CTE and assigning the outout of CTE to this XML type variable.
When we limit the rows to 64 which has a length of 43370(used cast(@XMLvariable AS varchar(max)), the variable returns the XML. However, if i increase the rows from 64 to 65 which is length of 44048, then the variable returns with Blank value.
Is there any LENGTH limit of the XML data type?
Thanks in advance!!Hello,
See MSDN xml (Transact-SQL), the size limit is 2 GB and it is working. If your XML data will be truncated, then because you are doing something wrong; but without knowing table design
(DDL) and your query it's difficult to give you further assistance; so please provide more details.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
-- How can I assign an xml typed variable and take advantage of the automatic escaping of invalid characters?
-- This query escapes the character fine in MSSQLMS
SELECT * FROM (SELECT CAST(0x1B00 AS NVARCHAR(128)) AS TestCharacter) MyTable FOR XML auto
<MyTable TestCharacter="" />
-- This fails in MSSQLMS and in a similar production procedure.
DECLARE @MyXml XML
SET @MyXML = (SELECT * FROM (SELECT CAST(0x1B00 AS NVARCHAR(128)) AS TestCharacter) MyTable FOR XML auto)
Msg 9420, Level 16, State 1, Line 2
XML parsing: line 1, character 30, illegal xml character
Scott MitchellThanks for the reply. I looked at casting to varbinary but didn't want to cast the large strings that have these characters in them. Sorry for not mentioning that. My example above is simplified. The text isn't only in an attribute and can be quite large.
I want to be able to read the text by just looking at the xml.
I really would like the escaped form:
 for all the invalid characters.
Scott Mitchell -
I've just tried to open Auroara and am only getting a small window stating...
XML Parsing Error: undefined entity
Location: chrome://browser/content/browser.xul
Line Number 540, Column 9: <button default="true"Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
*Do not click the Reset button on the Safe mode start window or otherwise make changes.
*https://support.mozilla.org/kb/Safe+Mode
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes -
XML Parsing Error: undefined entity
Location: jar:file:///C:/Users/Lisa/AppData/Roaming/Mozilla/Firefox/Profiles/7x7db74p.default/extensions/[email protected]/chrome/speedtest.jar!/content/netError.xhtml
Line Number 392, Column 33:There have been problems reported with Sync.
They are working on it, so please try again later when those problems are fixed.
*https://services.mozilla.com/status/
*http://twitter.com/#!/mozservices -
Since an automatic update ran I get the message <br />
"XML Parsing Error: undefined entity <br />
Location:chrome://browser/content/browser.xul <br />
Line Number 238, Column 5: <br />
<broadcaster id="devtoolsMenuBroadcaster_ChromeDebugger"----^"<br />
when I try to open Firefox. I have had to go back to using Internet Explorer - Tried everything suggested including deleting then reinstalling Firefox, but still cannot get Firefox to open - help!Hello,
Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
'''Note:''' You might want to print these steps or view them in another browser.
#Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
#After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
#Delete the Firefox installation folder, which is located in one of these locations, by default (your profile folder with bookmarks etc. WILL NOT BE DELETED):
#*'''Windows:'''
#**C:\Program Files\Mozilla Firefox
#**C:\Program Files (x86)\Mozilla Firefox
#*'''Mac:''' Delete Firefox from the Applications folder.
#*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
#Now, go ahead and reinstall Firefox:
##Double-click the downloaded installation file and go through the steps of the installation wizard.
##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
Please report back to see if this helped you!
Thank you. -
Firefox version 4.0.1
Firefox Sync Version 1.7
I have this combination installed on two different machines (one is WinXP, the other Win7).
When I goto the Addons screen to see which addons are installed and I click the "option" button for the Firefox Sync addon I get a popup window that gives me this error message.
The full details are as follows:
XML Parsing Error: undefined entity
Location: chrome://weave/content/options.xul
Line Number 6, Column 3:
<setting id="weave-account" type="string" title="&account.label;" />
--^You don't need the Firefox Sync 1.7 extension with Firefox 4, Sync is a built in feature. Uninstall that extension and that error message shouldn't appear.
-
LoadMovie() & XML.onLoad query(AS2)
Hi all :)
I have a Flash file that uses the loadMovie () to load JPG
files successfully, example:
imageuri = "../images/00_proto" + var1 + ".jpg";
holder_mc.holder0.loadMovie(this["imageuri"]);
Working
Example
'holder_mc' is the container clip and 'holder0' is the clip
that stores the loaded JPG file, this works fine.
I am upgrading the Flash file using an XML database, code
example:
var statesXML:XML = new XML();
statesXML.ignoreWhite = true;
statesXML.load("../XML/USA.xml");
statesXML.onLoad = function(success)
// XML loading excluded
// Problem code
imageuri = "../images/00_proto" + var1 + ".jpg";
_parent.holder_mc.holder0.loadMovie(this["imageuri"]);
The JPG's are not being loaded into the 'holder0' clip from
inside the XML.onLoad() method. Spent hours trying to fix this,
still have not resolved the problem. Any responses much welcomed!
regards
John
www.javono.comHi John,
Its diffcult as I don't know what you've tried before, but my
first stop would be to trace out imageurl to make sure the path to
the image is correct (although usually you'll get an error message
if not). Are you sure you need _parent. on the start of that path?
Have you tried it without that?
Tom. -
Good morning I have a situation wherein during an insert into my database, the variable that I created from an cfif/cfset throws an error. Am I missing something? My code is below...
<cfset gradepoint =VAL('#fcnpoint#') + VAL('#attitudepoint#') +
VAL('#guestpoint#') + VAL('#contactpoint#') + VAL('#attendancepoint#')
+ VAL('#nspoint#') + VAL('#foidpoint#') + VAL('#otherpoint#')>
<cfif "#gradepoint#" GTE "-20.45" AND "#gradepoint#" LTE "11.1"><cfset
maingrade= 'F'></cfif>
INSERT INTO squadreport (squid, squgrade)
VALUES ('00', '#maingrade#')
</cfquery>Agreed. I've never been a fan of using the hashmarks when not necessary.
To fix the issue, you need to cover all bases. You provided only one conditional, but I'm assuming you have more. But if the CF Server is throwing the error message "Variable undefined", then there is an open condition (or, more accurately, a lack of a default condition.)
<cfif gradepoint gte -20.45 AND gradepoint lte 11.1>
<cfset maingrade = "F">
<cfelseif gradepoint gt 11.1 AND gradepoint lte 41.1>
<cfset maingrade = "D">
<cfelseif gradepoint gt 41.1 AND gradepoint lte 72.2>
and so on, until
<cfelse>
<cfset maingrade = "A">
</cfif>
^_^
Maybe you are looking for
-
If I downloaded a trial version on PS Elements 12 and now have a purchased copy of that and Premiere
Do I need to remove the trial version of PS Elements12 before installation of my newly purchased software including Premiere?
-
Hi I am a dev (not a co.) & want to develop plugin for Adobe Reader, I'd like to know licencing policy for developng a plugin for reader. Would request your replies/suggestion at the earliest ?
-
Not getting texts on my new 4s
I am able to send text messages but not receive them
-
Hi all, we have two applications which needs to pass data to each other. APP1 displays a report in a table. when user clicks on the first column it needs to send the corresponding field(FLD1) data to second application APP2. APP2 displays all the i
-
With all the legit problems on this forum it is amazing that Logic Pro -
gets bought. from recording delay to audio instrument faults. score problems and time limitation in the arrange. graphic issues to region snap problems. apple loop limitations to au verifications or lack of delay compensation to beta drivers and (wha