嘿,程序员们....首先我想说的是,在我尝试将它导入到我的主类之前,我已经开始工作了,但现在它坏了....我只是想把这个productselection class
联系起来,barrelbuilder class
谢谢您非常提前寻求任何帮助,因为我只是循环尝试修复它的不同错误。
BarrelBuilder.as
package {
import flash.net.*;
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Loader;
import flash.xml.*;
import utils.ProductSelection;
public class BarrelBuilder extends MovieClip{
var PSelection:ProductSelection;
public function BarrelBuilder():void
{
PSelection.ProductSelection();
}
}
}
ProductSelection.as
package utils
{
import flash.net.*;
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Loader;
import flash.xml.*;
public class ProductSelection extends MovieClip{
private static var columns:Number;
private static var my_x:Number;
private static var my_y:Number;
private static var my_thumb_width:Number;
private static var my_thumb_height:Number;
private static var my_images:XMLList;
private static var my_total:Number;
private static var container_mc:MovieClip;
private static var myXMLLoader:URLLoader = new URLLoader();
public static function ProductSelections(stage:Object){
init(stage);
}
public static function init(stage:Object)
{
myXMLLoader.load(new URLRequest("resources.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML(stage));
function processXML (e:Event):void{
var myXML:XML = new XML(e.target.data);
columns = myXML.@COLUMNS;
my_x = myXML.@XPOSITION;
my_y = myXML.@YPOSITION;
my_thumb_width = myXML.@WIDTH;
my_thumb_height = myXML.@HEIGHT;
my_images = myXML.IMAGE;
my_total = my_images.length();
createContainer(stage);
callThumbs();
}
}
public static function createContainer(stage:Object):void{
container_mc = new MovieClip();
container_mc.x = my_x;
container_mc.y = my_y;
//container_mc.height = 50;
//container_mc.width = 140;
stage.addChild(container_mc);
}
public static function callThumbs():void{
for (var i:Number = 0; i < my_total; i++){
var thumb_url = my_images[i].@THUMB;;
var thumb_loader = new Loader();
thumb_loader.load(new URLRequest(thumb_url));
thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumb_loader.x = (my_thumb_width+10)*i;
}
}
public static function thumbLoaded(e:Event):void{
var my_thumb:Loader = Loader(e.target.loader);
container_mc.addChild(my_thumb);
//my_thumb.addEventListener(Mouse.CLICK, thumb_Clicked);
}
//thumbClicked()
//{
//}
}
}