Object Orientated

This week, we just did some basic coding using ActionScript 3.0. What we basically did was create a shape and every time the mouse hovered over it, the shape will get bigger in size and a message from the code will tell us the function is working. Here is the code I used in Action Script.

shape.addEventListener(MouseEvent.MOUSE_OVER, onOver);

shape.addEventListener(MouseEvent.MOUSE_OUT, onOut);

function onOver(evt:MouseEvent):void {

shape.scaleX = shape.scaleY *= 1.5;

}

function onOut(evt:MouseEvent):void {

shape.scaleX = shape.scaleY = 1;

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: