mercredi 8 mars 2017

Flash Actionscript3 - error 1120

I wanted to ask for some help on an error I have in Flash Professional while using AS3.I keep getting a couple of errors and I am not sure how to correct them. Here are the errors below (5 in total):

Scene 1, Layer 'Content', Frame 4, Line 25, Column 3 1120: Access of undefined property grid.

Scene 1, Layer 'Content', Frame 4, Line 8, Column 1 1120: Access of undefined property grid.

Scene 1, Layer 'Content', Frame 4, Line 9, Column 1 1120: Access of undefined property grid.

Scene 1, Layer 'Content', Frame 4, Line 10, Column 1 1120: Access of undefined property grid.

Scene 1, Layer 'Content', Frame 4, Line 11, Column 1 1120: Access of undefined property grid.

Here is my code for this page, I basically wanna place parts of the XML document into a datagrid:

 stop();
//Flash generated imports
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;

//Datagrid added from components menu
grid.addColumn("Title");
grid.addColumn("Genre");
grid.addColumn("Runtime");
grid.addColumn("AgeRating");


var loader:URLLoader = new URLLoader(new URLRequest("movieList.xml"));
loader.addEventListener(Event.COMPLETE, onLoaded);

//Added a loop to handle the multiple movie instances
function onLoaded(e:Event):void
{
    var xml:XML = new XML(loader.data);
    var itemList:XMLList = xml..movie_info;
    var len:int = itemList.length();
    for(var i:int=0; i<len; i++)
    {
        grid.addItem({Title:itemList[i].Title,
                     Genre:itemList[i].Genre,
                     Runtime:itemList[i].Runtime,
                     AgeRating:itemList[i].AgeRating});
    }
}

Any help would be greatly appreciated :)

Aucun commentaire:

Enregistrer un commentaire