I want to extend my function to a better design to where I can pass a canvas object into so I don't have to write N functions.. I'm not sure as how to do this properly I've come up with a naive design with a switch but even then if I add another canvas I still need to write new code for the new canvas.
function fadeCanvasOut(event:TimerEvent):void
{
canvas1.alpha -= 0.1;
}
private function showForm():void
{
var myTimer:Timer = new Timer(20, 10);
myTimer.addEventListener("timer", fadeFormIn);
myTimer.start();
}
what I need is something like:
function fadeCanvasOut(event:TimerEvent, aCanvas:Canvas):void
{
aCanvas.alpha -= 0.1;
}
private function showForm(aCanvas:Canvas):void
{
var myTimer:Timer = new Timer(20, 10);
myTimer.addEventListener("timer", fadeFormIn(timerEvent, canvas1);
myTimer.start();
}
if someone could please enlighten me I would appreciate it.