29.11.10

Switching to Classes

I just tested these name changes in the original Jump program and they worked, so that part is done. I remembered to change then name both in the event listener and at the function.

Red.addEventListener(MouseEvent.CLICK, RedLeft);

function RedLeft(event:MouseEvent):void
{
Green.x -= 60;
}

Blue.addEventListener(MouseEvent.CLICK, BlueRight);

function BlueRight(event:MouseEvent):void
{
Green.x +=60;
}


Yellow.addEventListener(MouseEvent.CLICK, YellowDown);

function YellowDown(event:MouseEvent):void
{
Green.y +=60;
}

Orange.addEventListener(MouseEvent.CLICK, OrangeUp);

function OrangeUp(event:MouseEvent):void
{
Green.y -= 60;
}

Now there won't be any confusion at all when I go to connect the two with the functions that will be contained in the external class files. Which reminds me, I will have to re-create the class files for this project so that they match the new class names. 

No comments:

Post a Comment