之前我什麼也沒有,我很高興加入這個偉大的社區。關鍵是,我有一個叫做字一個JavaScript類是這樣的:在JavaScript類中調用父方法
var Character = function()
{
// ..Some previous Properties/Methods (included one called "StareDown()")..
// And this method:
this.GrabDown = function()
{
Context.clearRect(0, 0, CanvasWidth, CanvasHeight);
//Context.fillRect(0, 0, CanvasWidth, CanvasHeight);
Context.drawImage(this.GrabbingDown, CharacterX, CharacterY, SpriteWidth, SpriteHeight);
window.setTimeout
(
function()
{
// Here is where I want to call the parent class method "StareDown()", but I don't know how.
},
250
);
}
}
所以這是我的大問題,我怎樣才能通過該子匿名函數訪問父類的方法?我一直試圖弄清楚整個晚上,但我找不到一些有用的信息,謝謝!
明亮,這是最簡單的方法,只是將我的這個分配給一個名爲Parent的var,然後在您向我展示時通過它調用該方法,非常感謝。 – Neo