עבור לתוכן

נתקעתי במהלך בניית slideshow בפלאש

Featured Replies

פורסם

[עריכה]

הבעיה נפתרה, אני אידיוט (כמו שיוצא לי הרבה למצוא את עצמי :P)

[/סוף עריכה]

אני מנסה לבנות slideshow בפלאש AS3 שטוען את התמונות מקובץ XML (שהוא RSS שאני יקבל מהאינטרנט)

אני מצליח למשוך מידע מהXML, ואני מנסה להכניס אותו למערך דו מימדי, אבל קצת נתקע בשגיאה קצת מוזרה שלא עוזבת אותי...

כל פעם שאני מנסה להכניס מידע לתא מסויים למערך (נאמר לתא 0,0), אני מקבל שגיאה בoutput:

TypeError: Error #1010: A term is undefined and has no properties.
at newsTicker_fla::MainTimeline/loadImages()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

השגיאה בעצם לא אומרת לי כלום, ואין לי מושג מה פלאש רוצה ממני...

אשמח לקצת עזרה...

הקוד שלי לבינתיים:

// global variables
var SPEED:int = 3; // time in sec to wait before changing images
var XMLURL:String = "../rss/newsTicker.xml"; // link to the xml of the images
var imageNo:int = 0; // total images number, updated from xml
var currentImage:int = 0; // current image index, updated automaticly further in the code
var images:Array = new Array(); // array to hold the images
// xml variables
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();

xmlData.ignoreWhitespace = true; // make sure we will get no errors
xmlLoader.load(new URLRequest(XMLURL));

// event listeners
next_btn.addEventListener(MouseEvent.CLICK, moveNext);
prev_btn.addEventListener(MouseEvent.CLICK, moveBack);
xmlLoader.addEventListener(Event.COMPLETE, loadImages);

// listener functions
function moveNext(e:MouseEvent):void
{
trace("Next button was clicked");
}
function moveBack(e:MouseEvent):void
{
trace("Back button was clicked");
}
function loadImages(e:Event):void
{
xmlData = new XML(e.target.data);
imageNo = xmlData.image.length(); // count the images

for(var i:int = 0; i < imageNo; i++)
{
//image in the array
var imageElement:XML = xmlData.image[i];

//image properties
images[i][0] = imageElement.url[i]; //image url
images[i][1] = imageElement.title[i]; //image title
images[i][2] = imageElement.description[i]; //image description
if(imageElement.link[i] == "")
images[i][3] = "[url]http://www.inforall.net";[/url] //if link is not set, use the default - homepage
else
images[i][3] = imageElement.link[i]; //use the link provided by the xml
}

}

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים