Problem with loading xml (outside variable issue)


hi, greetings on forum..

 

i m newbie flash/as2.. need load xml file so, search google , found link:

http://www.republicofcode.com/tutorials/flash/xml/

 

and using following code:

var myxml:xml = new xml();

myxml.ignorewhite=true;

myxml.load("oman3d.xml");

myxml.onload = function(success)

{

    if (success)

    {

        //trace (myxml);

        var imagelink1 = myxml.firstchild.childnodes[2].firstchild.nodevalue;

        trace (imagelink1);

 

    }

}

 

trace(imagelink1);

 

stop();

 

but there problem, here output:

undefined

image3.jpg

 

as may noticed need use variable outside of success function.. need use variable else

 

but when try use variable outside,it says undefined

 

i hope 1 can me out on issue

 

best regards

var myxml:xml = new xml();

var imagelink1="";

myxml.ignorewhite=true;

myxml.load("oman3d.xml");

myxml.onload = function(success)

{

    if (success)

    {

        //trace (myxml);

        imagelink1 = myxml.firstchild.childnodes[2].firstchild.nodevalue;

        trace (imagelink1);

    }

}

 

 

trace(imagelink1);

 

 

stop();



More discussions in ActionScript 1 and 2


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support