Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.