Hi all I have created a file which has one mc named mycontent and into it there are a TextField and another mc. I have also a xml file from which I get my information. My XML structure is simple I have info tag and into it opisanie in which I have a description and a pic tag in which I have my pictures path. I created one simple class
package {
import flash.events.*;
import flash.filters.*;
import flash.text.*;
import flash.net.*;
import flash.display.*;
import flash.geom.*;
import flash.display.MovieClip;
import mycontent;
public class MultipleWork extends Sprite {
public var _contentXML:XML;
public var _contentList:XMLList;
public var _first:String;
public var _second:String;
public var _third:String;
public var _content:mycontent;
public var _label:String;
public var _request:String;
public var _opisanieList:String;
public var _requestList:String;
public var _imageLoader:Loader;
public var _info:Boolean;
private var _boxX:Number;
private var _boxY:Number;
public function MultipleWork():void {
var loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onContentLoaded);
loader.load(new URLRequest("multiple.xml"));
}
private function onContentLoaded(e:Event):void {
_contentXML = new XML(e.target.data);
_contentList = new XMLList(_contentXML.info);
trace(_contentList);
// tyk shte zadadem k1de da sa razpolojeni
_boxX = 45;
_boxY = 31;
// tyk pravim obhoda na dannite
for (var c:Number=0; c < _contentList.length(); c++) {
var _content = new mycontent();
addChild(_content);
// sega shte vzemem stionostite koito shte sa ni nujni
_opisanieList = new XMLList (_contentList[c].opisanie.toString());
_requestList = new XMLList (_contentList[c].pic.toString());
trace (_opisanieList);
trace (_requestList);
// v content label
_content.label.text = _opisanieList;
_content.x = _boxX;
_content.y = _boxY;
_boxX += _content.width + 50;
// v request zadavame p1tq do snimkata!!!
_request = _requestList;
_imageLoader = new Loader();
_imageLoader.load(new URLRequest(_request));
trace (_request);
_imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
function imageLoaded(e) {
trace("image is loaded");
// do stuff
//_content.pic.addChild(_imageLoader);
_content.setType(_imageLoader);
_content.pic.width = 132;
_content.pic.height = 120;
// etc.
}
}
}
}
}
This is MultipleWork class which is the main class of the movie. I also have a mycontent class.
package
{
import flash.display.MovieClip;
import flash.events.*;
import flash.text.*;
public class mycontent extends MovieClip
{
public var _type:*;
public function mycontent()
{
this.buttonMode = true;
this.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(event:MouseEvent):void
{
trace ("bot");
}
public function setType(type:*):void
{
_type = type;
pic.addChild(_type);
}
}
}
All this is working except one thing. I multiply my main mc and I show the info into the TextField but I canβt load the image into the mc. It only loads image to the last of these mc. Where is the mistake? Please help