Re: [問題] 奇怪...

看板Flash作者 (ETREX)時間19年前 (2006/04/29 16:53), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
※ 引述《etrexetrex (ETREX)》之銘言: : 我用下面四行來使用鍵盤控制影片位置 : if ( Key.isDown( Key.UP ) && this._y > 0 ) this._y -= speed ; : if ( Key.isDown( Key.DOWN ) && this._y < 400 ) this._y += speed ; : if ( Key.isDown( Key.LEFT ) && this._x > 0 ) this._x -= speed ; : if ( Key.isDown( Key.RIGHT ) && this._x < 400 ) this._x += speed ; : 這四行是可行的 : 但是如果我將 400 改成 _root._height : 或 _root._width : 實際測試的時候卻可以跑出畫面外 : 之後 trace ( _root._height ); 顯示400沒錯.. : 問題到底出在哪裡呢?(我使用的是FLASH MX) 整個程式碼 // 鍵盤控制移動函數 MovieClip.prototype.keyMove=function(speed) { if ( Key.isDown( Key.UP ) && this._y > 0 ) this._y -= speed ; if ( Key.isDown( Key.DOWN ) && this._y < 400 ) this._y += speed ; if ( Key.isDown( Key.LEFT ) && this._x > 0 ) this._x -= speed ; if ( Key.isDown( Key.RIGHT ) && this._x < 400 ) this._x += speed ; } 我的問題點在於 為什麼 _root._height 是 400 卻不能取代上述程式碼的 400 呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.228.124.45
文章代碼(AID): #14KobjN4 (Flash)
討論串 (同標題文章)
本文引述了以下文章的的內容:
3
5
完整討論串 (本文為第 2 之 3 篇):
4
6
3
5
文章代碼(AID): #14KobjN4 (Flash)