Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6107965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:14:45+00:00 2026-05-23T14:14:45+00:00

public class loadXML extends Sprite { public var xmlFileName:String; public var urlL:URLLoader = new

  • 0
public class loadXML extends Sprite
{
    public var xmlFileName:String;
    public var urlL:URLLoader = new URLLoader();
    public var urlR:URLRequest;
    public var xml:XML = new XML();

    public function loadXML(xmlS:String):void
    {
        xmlFileName = xmlS;
        urlR =  new URLRequest(xmlFileName);            
        urlL.addEventListener(ProgressEvent.PROGRESS, onProgressAction);
        urlL.addEventListener(Event.COMPLETE, onLoadedAction);
        urlL.addEventListener(IOErrorEvent.IO_ERROR, errorAction);
        urlL.load(urlR);            
    }
    public function onLoadedAction(e:Event):void
    {
        xml = XML(e.target.data);
        //trace(xml);
    }       
    public function onProgressAction(e:ProgressEvent):void
    {
        //trace("loading xml");
    }
    public function errorAction(e:IOError):void
    {
        trace(e.toString());
    }
}
}

//main class

package
{
import com.loadXML;
import flash.display.Sprite;

public class xmlFileView extends Sprite
{
    public var xmlData:loadXML;
    public function xmlFileView():void
    {
        init();
    }
    private function init():void
    {
        xmlData = new loadXML("list.xml");
        var xmlF:XML = XML(xmlData);
        //trace(xmlF.video[0].path);

    }
}

}

Here I instantiate the loadXML class. But I can’t able to access the xml, y? and how can I achieve that?

here is my XML file.

<?xml version="1.0" encoding="iso-8859-1"?>
<videos>
    <video>
        <path>video1.flv</path>
    </video>
    <video>
        <path>video2.flv</path>
    </video>
    <video>
        <path>video3.flv</path>
    </video>
    <video>
        <path>video4.flv</path>
    </video>
</videos>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:14:45+00:00Added an answer on May 23, 2026 at 2:14 pm

    the xml you have there is looking not like xml 🙂
    here how it should look like reffering the trace(xmlF.video.path[0]);

    <?xml version="1.0" encoding="utf-8" ?>
    <data>
        <video>
            <path>video1.flv</path>
            <path>video2.flv</path>
            <path>video3.flv</path>
            <path>video4.flv</path>
        </video>
    </data>
    

    UPDATE

    you can not do like this:

    xmlData = new loadXML("list.xml");
    var xmlF:XML = XML(xmlData);
    

    because loading something takes time, and script is not waiting until the loading has been done.

    If you want to achive this you need to do it following way:
    in the loadXML class edit function:

    public function onLoadedAction(e:Event):void
    {
        xml = XML(e.target.data);
        // dispatch event when the XML has been loaded and xml value is defined.
        dispatchEvent ( new Event ( Event.COMPLETE ) )
    }
    

    in the xmlFileView class edit:

    private function init():void
    {
        xmlData = new loadXML("list.xml");
        // listen for loading completed
        xmlData.addEventListener ( Event.COMPLETE, handleXMLLoaded );
    }
    
    private function handleXMLLoaded (e:Event):void
    {
       var xmlF:XML = xmlData.xml
       trace(xmlF.video.path[0]); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class IdAsync extends AsyncTask<String, Void, Void> { AlertDialog alertDialog = new AlertDialog.Builder(MainClass.this).create(); protected
public class FacebookConnect extends Activity { Facebook facebook = new Facebook(); String FILENAME =
public class TestBL { public static void AddFolder(string folderName) { using (var ts =
public class Order { static Customer cust = new Customer(); string sEmpty = ;
public class Test extends Thread{ public void hello(String s){ System.out.println(s); } public void run(){
public class InterruptedInput { public static void main(String[] args) { InputThread th=new InputThread(); //worker
public class Base{ protected String str; public static final Base ERROR = new Base(error);
public class saveButtonListener implements ActionListener{ public void actionPerformed(ActionEvent ev){ JFileChooser chooser= new JFileChooser(); String
public class HomeActivity extends Activity{ // public ArrayList<User> users1 = new ArrayList<User>(); @Override public
public class PackageTabActivity extends ListActivity{ HashMap<String,Object> hm ; ArrayList<HashMap<String,Object>> applistwithicon ; private static final

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.