Hey guys,
currently I’m working on a tag-driven interactive image cube. It’s almost done, but one thing doesn’t work. I can’t load my images onto the cube.
I’ll give you the code:
var externalXML:XML;
var picList:XMLList;
var bilder:Array = new Array();
picHolder = new Array("face", "face2", "face3", "face4", "face5", "face6");
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("bilder.xml");
loader.load(request);
loader.addEventListener(Event.COMPLETE, onComplete);
function onComplete(event:Event):void
{
if (loader != null)
{
externalXML = new XML(event.target.data);
picList = new XMLList(externalXML.bild);
}
externalXML.ignoreWhitespace = true;
loadbilder()
}
function loadbilder():void
{
while(numChildren>0) removeChildAt(0);
for(var i:uint = 0; i < picList.length() ; i++)
{
var target:DisplayObject = picHolder.getChildByName(picList*.@position);
var imgLoader:Loader = new Loader();
var obj_source = picList*.quelle;
imgLoader.load(new URLRequest(obj_source));
imgLoader.addEventListener(MouseEvent.CLICK, onClick);
// id der eigenschaft name zuweisen
imgLoader.name = picList*.@id;
imgLoader.x = target.x;
imgLoader.y = target.y;
trace(picList);
addChild(imgLoader);
}
}
The Problem might be that’s not possible to load DisplayObjects from an Array or smth. There are six MovieClips on the stage which are building the cube.
The problem is in this line:
var target:DisplayObject = picHolder.getChildByName(picList*.@position);
Do you know any possibility to bring the thing on the cube?
Here’s my complete code (including the xml)