1 Reply Latest reply on May 22, 2013 5:15 AM by moccamaximum

    addEventListener Problem

    teeronline

      Hi,

       

      Please take a look at my codes, the script ask for elements from an XML file.

       

      the problem is 'newloader' at the script end would start off 100% original file size, then gradually size down to .width = 55 and .height=55. Let's I have 5 'Listitem' in the XML, the first 'newloader' appear on screen would be 100X100px (original size), then the next 'newloader' appear 85X85, then smaller and smaller and finally on the fifth would appear 55X55.

       

      personally I think the problem is on addEventListener, but I don't know how to resolve it.

       

      for each (var Listitem:XML in myXML..ListItem) {

                 

                  var listImage:String = Listitem.itemImage.toString();

                  var listLabel:String = Listitem.itemLabel.toString();

                  var listName:String = Listitem.itemName.toString();

                 

                 

                  //-------------Adding mc's to stage---------

                  var leftBar:MovieClip = new barLeft();

                  leftBar.x = 0;

                  leftBar.y = 1;

                  //----------------------

                  var bigBorder:MovieClip = new border();

                  bigBorder.x = 14;

                  bigBorder.y = 0;

                  //----------------------

                  var rightBar:MovieClip = new barRight();

                  rightBar.x = 80;

                  rightBar.y = 1;

                  //----------------------

                  var vBar:MovieClip = new vbar();

                  vBar.x = 105;

                  vBar.y = 12;

                  //--------------------------------

                  var myImage:TextField = new TextField();

                  var fileRequest:URLRequest = new URLRequest(listImage);

                  var newLoader:Loader = new Loader()

                  newLoader.load(fileRequest);

                 

                 newLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderReady);           

                 

                  function onLoaderReady(e:Event) {

                  newLoader.x = 18;

                  newLoader.y = 5;

                  newLoader.width = 55;               <<both set at 55

                  newLoader.height = 55; }