Re: [問題] 關於物件與場景的變數
在每個物件上面寫這個就好了
onClipEvent(press) {
this.startDrag();
}
onClipEvent(release) {
this.stopDrag();
}
不需要那個pnum變數
更進階點的,寫一個class,存成AS檔放在FLA同資料夾
class Draggable extends MovieClip {
public function Draggable() {
this.onPress = function():Void {
this.startDrag();
}
this.onRelease = function():Void {
this.stopDrag();
}
}
}
然後把要拖曳的元件export for ActionScript
接著把class設為Draggable
所有這個元件的實體就都可以拖曳了
以上code未經過測試,可能有打錯字
--
CJ Cat = Croa'J Cat = Cockroach Cat = 西街凱特 = 蜚蠊貓 = 蟑螂貓
Blog http://cjcat.blogspot.com
Gallery http://cjcat2266.deviantart.com
ptt2 Board CJWorkshop - 阿多比閃光(Adobe Flash)研討區
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.228.79.219
※ 編輯: cjcat2266 來自: 61.228.79.219 (05/17 22:30)
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):