Mailing List
Home
Flash Pro
Extending Flash
Flash Macromedia Developer
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Creating variables from XML

Creating variables from XML

2004-02-19       - By Sanjeev J Singh

 Back
Reply:     1     2     3     4     5     6  

Hi,

I am trying to read an XML and create variables at _level0. Here 's my code
(in the first frame of the main timeline):

thisXML = new XML();
thisXML.ignoreWhite = true;
thisXML.onLoad = DoOnLoad;
thisXML.load( "navstate.xml ");
function DoOnLoad () {
   level1Child = this.firstChild;
   var varname1;
   var varname2;
   var varvalue;
   for (i=0; i <level1Child.childNodes.length; i++) {
      for (j=0; j <level1Child.childNodes[i].childNodes.length; j++) {
         varname1 = level1Child.childNodes[i].nodeName.toLowerCase();
         varname2 =
level1Child.childNodes[i].childNodes[j].nodeName.toLowerCase();
         varvalue = level1Child.childNodes[i].childNodes[j].firstChild.nodeValue;
         set( "_level0. "+ varname1 add varname2, varvalue);
      }
   }
}

This creates variables (as displayed in the debug variables window) such as:
_level0.menuvisible = "1 "
_level0.menuenabled = "1 "
_level0.menuurl = "javascript:ShowMenu() ";
...etc.

The problem: If I trace these variables from within the DoOnLoad() function
I get the values but I cannot access these variables outside this function
from other functions (which is what I want to do).

What should I do to be able to create global variables as described above?
I 'm talking Flash 5.

Thanks,
Sanjeev


=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104685
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)