Function within function within function
Hmm, maybe this is possible or not but I have tried and failed, what I would like is to be able to do the following:
Code:
function Player()
{
this.name = "Bob";
this.animate= function(direction)
{
return direction;
stop = function() {
//code here
}
}
}
Then I simply want to do the following:
Code:
var player = new Player();
player.animate("left").stop();
I tried many different ways and the only way I could get it to work is by using:
Code:
player.animate.stop();
I know many will know how to do this but I tried researching and couldn't find any results, thanks if you help...
Joel. :)