# MultipleWork image load problem

**URL:** <https://forum.kirupa.com/t/multiplework-image-load-problem/265789>\
**Category:** flash\
**Created:** [July 12, 2008, 2:36pm UTC](https://forum.kirupa.com/t/multiplework-image-load-problem/265789 "2008-07-12T14:36:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spectator](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@spectator](https://forum.kirupa.com/u/spectator)\
**Post date:** [July 12, 2008, 2:36pm UTC](https://forum.kirupa.com/t/multiplework-image-load-problem/265789/1 "2008-07-12T14:36:45Z")

</div>

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

```auto
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.

```auto
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 🙂

---

<div class="post-metadata">

**Author:** ![Alex\_Lexcuk](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Alex\_Lexcuk](https://forum.kirupa.com/u/Alex_Lexcuk)\
**Post date:** [July 12, 2008, 2:58pm UTC](https://forum.kirupa.com/t/multiplework-image-load-problem/265789/2 "2008-07-12T14:58:24Z")

</div>

[http://dnadillo.dn.ua/fla/XML/img-xml-img.swf](http://dnadillo.dn.ua/fla/XML/img-xml-img.swf)  
[http://dnadillo.dn.ua/fla/XML/img-xml-img.zip](http://dnadillo.dn.ua/fla/XML/img-xml-img.zip)  
[http://dnadillo.dn.ua/fla/XML/img\_xml.xml](http://dnadillo.dn.ua/fla/XML/img_xml.xml)

---

<div class="post-metadata">

**Author:** ![spectator](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@spectator](https://forum.kirupa.com/u/spectator)\
**Post date:** [July 12, 2008, 7:40pm UTC](https://forum.kirupa.com/t/multiplework-image-load-problem/265789/3 "2008-07-12T19:40:03Z")

</div>

10x for the answer I will try to put them together 🙂

---

<div class="post-metadata">

**Author:** ![spectator](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@spectator](https://forum.kirupa.com/u/spectator)\
**Post date:** [July 13, 2008, 8:19pm UTC](https://forum.kirupa.com/t/multiplework-image-load-problem/265789/4 "2008-07-13T20:19:41Z")

</div>

I think I need some help here 🙂
