AS2 附加影片和加载影片

发布于 2024-09-19 15:47:49 字数 1840 浏览 0 评论 0原文

我有以下代码:

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 正在加载,我在 Slots MC 中看到它们。但是当我单击插槽中加载的 swf 时,它根本没有跟踪任何内容

I have the following code:

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

}

In the frame 0. The swfs are loading and i see them in the Slots MC. but when i click the loaded swf in the slot it doesn't trace anything at all

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡莣 2024-09-26 15:47:49

更改

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

Change

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

to

 var mySlot = loadMovie("http://mysite.com/"+thisitem+".swf", thisSlot);
      mySlot.onPress = function (){
           trace("" + mySlot['itemID']);
           trace(mySlot)      
} 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文