DisplayPic = function (Pic:String, MC:MovieClip) {
var frame_W = 70;
var frame_H = 70;
var pic_loader:MovieClipLoader = new MovieClipLoader();
var pic_Listener:Object = new Object();
pic_Listener.onLoadInit = function(target_mc:MovieClip) {
var WidthRatio, HeightRatio, maxRatio, newWidth, newHeight;
WidthRatio = target_mc._width/frame_W;
HeightRatio = target_mc._height/frame_H;
maxRatio = Math.max(WidthRatio, HeightRatio);
newWidth = target_mc._width/maxRatio;
newHeight = target_mc._height/maxRatio;
target_mc._width = newWidth;
target_mc._height = newHeight;
};
pic_loader.addListener(pic_Listener);
trace(MC);
pic_loader.loadClip(Pic, MC);
};
var picXML:XML = new XML;
picXML.load("pic.xml");
picXML.ignoreWhite = true
picXML.onLoad = function(){
var Sum:Number = picXML.firstChild.childNodes.length;
for(var i=0;i<Sum;i++)
{
var tmpImage:Object = picXML.firstChild.childNodes[i];
var tmpMC:MovieClip;
// tmpMC.onRelease = function(){
// trace("hey");
// };
tmpMC = this.createEmptyMovieClip("pic_MC"+i, this.getNextHighestDepth());
tmpMC._x=50+70*i
_root.DisplayPic(tmpImage.attributes.file, tmpMC);
trace(tmpImage.attributes.file);
}
//pic_MC0._x=10+50*i;
//pic_MC0._y= 100;
};
הקטע של ה-XML עובד, אבל משום מה, כשאני שולח את זה לפונקציה desplay הוא פשוט לא מציג!
אם אתם רוצים אני יכול לשים את כל הקבצים פה....