Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-03-2007, 06:46 PM   #1
Registered User
Join Date: Oct 2007
Posts: 8
Red face Tracing array from a xml doesn`t work

I`m trying to trace the pics[1] but I just get undefined when it`s out of the doMenu function. Do you know how to fix it?

var xmlDoc:XML = new XML();
System.useCodepage = true;
xmlDoc.ignoreWhite = true;

xmlDoc.onLoad = function(ok:Boolean) {
if (ok) {
} else {
trace("XML did not load");


function doMenu(xml:XML) {
var num:Number = xml.firstChild.childNodes.length;
pics = new Array();
for (var i = 0; i < num; i++) {
pics[i] = xml.firstChild.childNodes[i].attributes.image;
trace(pics[1]); <<< this works
trace(pics[1]); <<< this one doesn`t
ferrarih is offline   Reply With Quote
Old 11-03-2007, 08:16 PM   #2
Holosuit User
wvxvw's Avatar
Join Date: Oct 2006
Location: Tel Aviv
Posts: 4,669
Send a message via ICQ to wvxvw

The code execution and actual event of loading XML are asinchroneous. So, the last trace will be called before xmlDoc.onLoad().
wvxvw is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
xml and css: cant get custom class to work on links roystik ActionScript 2.0 0 08-16-2007 07:37 AM
LOADING XML INTO ARRAY for use in movie AndiG ActionScript 2.0 8 05-17-2007 05:09 PM
Array from XML alflashy ActionScript 2.0 6 05-11-2007 03:02 PM
help with XML structure and tracing in Flash. lariat1997 ActionScript 2.0 0 02-19-2007 07:14 PM
problem creating mc instance names inside a function jasonyen ActionScript 2.0 10 12-08-2004 01:01 AM

All times are GMT. The time now is 07:16 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.