AS2 Attach Movie и LoadMovie - PullRequest
       5

AS2 Attach Movie и LoadMovie

1 голос
/ 17 сентября 2010

У меня есть следующий код:

var theItems:String = "4 3 6 19 20 40 41 4 3 6 19 20 40 41"

var titems = theItems.split(" ");

var nextLine = 0;
var LastSlotID = 0;
var LastX = 0;
var LastY = 0;
var slotsM = 0;
for (var i in titems){
      var thisitem:Number = titems[i];
      ThisSlotID = LastSlotID + 1;
       if(LastSlotID == 0){
            var thisSlot = Slots.attachMovie("InventorySlot", "slot"+ThisSlotID, Slots.getNextHighestDepth(), {itemID:thisitem});// the start slot
          thisSlot._y = LastY;
          thisSlot._x = LastX;
          LastSlotID = ThisSlotID + 1;
          slotsM = slotsM + 1;
        // loadMovie("http://mmysite.com/"+thisitem+".swf", thisSlot);
             //delete mySlot
       } else {
            var thisSlot = Slots.attachMovie("InventorySlot", "slot"+ThisSlotID, Slots.getNextHighestDepth(), {itemID:thisitem});// the start slot
          //thisSlot._y = LastY + ; // do this ONLY if a 4th slot
          if(slotsM == 3){
             // trace("removing" +slotsM)
              thisSlot._y = LastY + 62.9; 
              slotsM = 1;
              thisSlot._x = 0;
              LastY = thisSlot._y
              LastX = thisSlot._x
          } else {
              //trace(slotsM)
              thisSlot._x = LastX + 84.9;
            thisSlot._y = LastY

          LastSlotID = ThisSlotID + 1;
           slotsM = slotsM + 1;

            LastY = thisSlot._y;
            LastX = thisSlot._x;
          }


             //delete mySlot
       } // end of slot if 0 or not
       loadMovie("http://mysite.com/"+thisitem+".swf", thisSlot);
        var mySlot = eval("slot"+ThisSlotID);
        mySlot.onPress = function (){
              trace("" + mySlot['itemID']);
              trace(mySlot)
         }

}

В кадре 0. SWF загружаются, и я вижу их в MC слотов но когда я нажимаю на загруженный SWF-файл в слоте, он ничего не отслеживает

1 Ответ

0 голосов
/ 20 июня 2011

Изменить

 loadMovie("http://mysite.com/"+thisitem+".swf", thisSlot);
 var mySlot = eval("slot"+ThisSlotID);
     mySlot.onPress = function (){ 
          trace("" + mySlot['itemID']);
           trace(mySlot)    
  } 

на

 var mySlot = loadMovie("http://mysite.com/"+thisitem+".swf", thisSlot);
      mySlot.onPress = function (){
           trace("" + mySlot['itemID']);
           trace(mySlot)      
} 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...