markus
markus

Reputation: 1011

Actionscript read XML and write on List write

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.

Upvotes: 0

Views: 137

Answers (2)

Jonatan Hedborg
Jonatan Hedborg

Reputation: 4432

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.*;

Upvotes: 2

Vladimir Tsvetkov
Vladimir Tsvetkov

Reputation: 3013

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

Upvotes: 0

Related Questions