vendredi 10 mars 2017

Importing pictures from XML doc into Flash using Actionscript3

I am having troubles with understanding how to get a picture in an XML file to import into Flash using actionscript3. Here is the code I have so far:

stop();

import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.display.MovieClip;
import flash.display.*;

var myXML:XML = new XML();
myXML.ignoreWhite=true;
myXML.load("graphics.xml");
myXML.onLoad = function(success) {
if (success) {
var myImage = myXML.firstChild.childNodes;
for (i=0; i<myImage.length; i++) {
var imageNumber = i+1;
var imageName = myImage[i].attributes.title;
var imageURL = myImage[i].firstChild.nodeValue;
trace ("My image number "+imageNumber+" is titled "+imageName+" and its URL is "+imageURL+".")
}
}
};

This is the errors I get:

Scene 1, Layer 'Content', Frame 3, Line 14, Column 6 1120: Access of undefined property i.

Scene 1, Layer 'Content', Frame 3, Line 15, Column 19 1120: Access of undefined property i.

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

Scene 1, Layer 'Content', Frame 3, Line 17, Column 24 1120: Access of undefined property i.

Scene 1, Layer 'Content', Frame 3, Line 14, Column 29 1120: Access of undefined property i.

Scene 1, Layer 'Content', Frame 3, Line 14, Column 11 1120: Access of undefined property i.

I will be very grateful for a solution to this as I am trying to get to grips with Actionscript3. Thankyou for any help!

Aucun commentaire:

Enregistrer un commentaire