luka66_6
07-23-2008, 01:38 PM
here is my code
// gumb start
start_btn.addEventListener(MouseEvent.MOUSE_UP, startGame)
function startGame(event:MouseEvent):void
{
// gumb start izgubi listener in izgine iz odra
start_btn.removeEventListener(MouseEvent.MOUSE_DOW N, startGame)
removeChild(start_btn);
// napadalec začne napad
napadalec.play();
// tarča postaneš ti
tarca.addEventListener(Event.ENTER_FRAME, followMouse)
function followMouse(event:Event):void
{
tarca.x = mouseX;
tarca.y = mouseY;
Mouse.hide();
}
// life se začne prikazovati
lifeCounter.lifeCounter_txt.text = lifeCount + " Lives Left ";
}
// nisi več tarča
tarca.addEventListener(MouseEvent.MOUSE_UP, tarcaOff)
function tarcaOff(event:MouseEvent):void
{
tarca.removeEventListener(MouseEvent.MOUSE_UP, tarcaOff)
tarca.removeEventListener(Event.ENTER_FRAME, followMouse)
tarca.x = 10;
tarca.y = 10;
Mouse.show();
}
i am trying to acess
followMouse
from
tarcaOff
how do i do that?
as at the moment i get an error undefinf property followMouse. I know it is so becouse i have closed startGame function but how do i access a function inside function from some outside function.
hope i did not complicate too much.
regards
// gumb start
start_btn.addEventListener(MouseEvent.MOUSE_UP, startGame)
function startGame(event:MouseEvent):void
{
// gumb start izgubi listener in izgine iz odra
start_btn.removeEventListener(MouseEvent.MOUSE_DOW N, startGame)
removeChild(start_btn);
// napadalec začne napad
napadalec.play();
// tarča postaneš ti
tarca.addEventListener(Event.ENTER_FRAME, followMouse)
function followMouse(event:Event):void
{
tarca.x = mouseX;
tarca.y = mouseY;
Mouse.hide();
}
// life se začne prikazovati
lifeCounter.lifeCounter_txt.text = lifeCount + " Lives Left ";
}
// nisi več tarča
tarca.addEventListener(MouseEvent.MOUSE_UP, tarcaOff)
function tarcaOff(event:MouseEvent):void
{
tarca.removeEventListener(MouseEvent.MOUSE_UP, tarcaOff)
tarca.removeEventListener(Event.ENTER_FRAME, followMouse)
tarca.x = 10;
tarca.y = 10;
Mouse.show();
}
i am trying to acess
followMouse
from
tarcaOff
how do i do that?
as at the moment i get an error undefinf property followMouse. I know it is so becouse i have closed startGame function but how do i access a function inside function from some outside function.
hope i did not complicate too much.
regards