Jump to content

xml not showing


andylord

Recommended Posts

xml not showing confused

 

So heres what i have

 

package
{
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.events.Event;
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    import flash.net.URLLoaderDataFormat;

    public class XMLtester extends Sprite
    {

var counter:uint = 1;   // a loop counter

                // Display a list of tracknames

                for each ( var myElement:XML in myXML.elements() )
                {
                  Names.appendText(counter + " " + myElement.trackname + "\n");
                  counter++;  // increment the counter by 1
                } 
               
                // Demo of selecting a particular track filename, e.g. the first track is indexed using the index number zero (as in arrays)

                _displayTXT.appendText("\n\n" + myXML.track[0].filename + "\n");
    var myXMLFile:String = "playlist.xml";
            var myRequest:URLRequest = new URLRequest(myXMLFile);             // Create a new URLRequest object to specify the name of the XML file
           
            var myLoader:URLLoader = new URLLoader();                                    // Create a new loader object
            myLoader.dataFormat = URLLoaderDataFormat.TEXT;                        // Tell the loader object to load the file as plain text.

            myLoader.addEventListener( Event.COMPLETE, onComplete );  // Register the event handler which will be automatically triggered when the loader object has fully loaded the external XML file.

            myLoader.load(myRequest);  // Load the XML file into memory.  The onComplete event handler will be triggered when the loading of the XML file is complete.
    private function onComplete( e:Event ):void             
        {
                var myXML:XML = new XML( e.target.data );  // Pass the event target data to the XML class constructor to create a new XML object named myXML.
                trace( myXML );                                                  // Display the content of the myXML object to the output window (not the stage) for checking.
       
   
   }
}
}

 

now i have a dynamic text called Names

and i have a playlist.xml file

am slightly new to actionscript and this has just been thrown together really i think im missing something but not sure what can anyone help me plz

Link to comment
https://forums.phpfreaks.com/topic/224030-xml-not-showing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.