0

I'm trying to read a XML file and output the values, but i'm getting a 1120: Access of undefined property URLRequest. error. Any ideas? Here's my code:

public class Main extends MovieClip
{

    public function Main()
    {

        var loader:URLLoader = new URLLoader();
        loader.addEventListener(Event.COMPLETE, loadXML);

        function loadXML(e:Event):void
        {
            var xml:XML = new XML(e.target.data);
            trace(xml);
        }

        loader.load(new URLRequest("http://127.0.0.1:8090/NewProj/index.php?tipo=get"));
    }
}

Thanks.

2 Answers 2

2

loader.load(new URLRequest.data("http://127.0.0.1:8090/NewProj/index.php?tipo=get")); That looks weird. It should be

loader.load(new URLRequest("http://127.0.0.1:8090/NewProj/index.php?tipo=get"));

EDIT: You also need to import the relevant packages eg

import flash.net.*;
Sign up to request clarification or add additional context in comments.

Comments

0

You probably already discovered the typo you have in the last line of the code above new URLRequest.data(... It should be new URLRequest(...

1 Comment

A missing import then - import flash.net.URLRequest; Please check if you have this line in your file!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.