0 Replies Latest reply on Jun 18, 2007 12:04 PM by Swirlsky

    EventListener doesn't work

    Swirlsky Level 1
      First of all, here is the script:

      import mx.managers.PopUpManager;
      import mx.containers.Window;
      System.security.allowDomain(" http://www.somewhere.hu");
      var AblakEsemenykezelo:Object = new Object();
      var Ablak:MovieClip;

      AblakEsemenykezelo.complete = function() {
      Ablak.content._width = 120; Ablak.content._height = 90;
      Ablak.setSize(Ablak.content._width, Ablak.content._height + 25);
      }

      function MatrixLetrehozasa(OszlopokSzama:Number, SorokSzama:Number, MiniaturW:Number, MiniaturH:Number, MatrixX:Number, MatrixY:Number, Sorkoz:Number, Oszlopkoz:Number, Album:String, Oldalszam:Number) {
      var c:Number = 1;

      for(var i:Number = 1; i<=SorokSzama; i++) {
      for(var j:Number = 1; j<=OszlopokSzama; j++) {

      Ablak = PopUpManager.createPopUp(_root, Window, false, {closeButton:true, contentPath:" http://www.somewhere.hu/kepek/"+Album+"/kep"+String(c)+".jpg"});
      Ablak.addEventListener("complete", AblakEsemenykezelo);

      Ablak._x = MatrixY-MiniaturW + j*MiniaturW + j*(Oszlopkoz);
      Ablak._y = MatrixY-(MiniaturH+25) + i*(MiniaturH+25) + i*(Sorkoz);

      c++;
      }
      }
      }

      MatrixLetrehozasa(4, 3, 120, 90, 30, 30, 10, 10, "locsolas1", 1);


      The problem is that the EventListener only works well with the last loaded window. I know that it is because the "Ablak" isn't be able to seen from outside of the function, but I don't know how should I do it to be good.
      (sorry for the names of the objects and the variables, I am hungarian.)