仲間のプログラマーの皆さん....最初に、メインクラスにインポートしようとする前にこれが機能していたと言いたいのですが、今は壊れています....これを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()
//{
//}
}
}