Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

addEventListener Problem

Participant ,
May 21, 2013 May 21, 2013

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; }

TOPICS
ActionScript
376
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 22, 2013 May 22, 2013
LATEST

This is Actionscript 3 code. Either you posted in the wrong forum or you need a as1/as2 version of the code above. Decide yourself which one applies.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines