看板 Flash 關於我們 聯絡資訊
Flash CS6 AS3 在AS裡物件都是以傳址的方式, 我把class a一個_sprite送到class b去New它 但是trace(_sprite) = NULL. 如果是傳址,是不是應該要_sprite = Object Sprite ? class a extends MovieClip { var _sprite:Sprite; funciton a() { b.NewSprite(_sprite); trace(_sprite);//NULL } } /// class b extends Sprite { function b(){} public static NewSprite(pSprite:Sprite):void { pSprite = new Sprite(); } } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.33.207.109
sayaku0210:因為你的_sprite跟pSprite是指向不同的位置 12/09 21:27
sayaku0210:恩~原來下一篇有人解答了 12/09 21:28