Re: [問題] 奇怪...
※ 引述《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
討論串 (同標題文章)
Flash 近期熱門文章
PTT數位生活區 即時熱門文章