2009. február 17., kedd

Actionscript 3.0 - MoveSmiley 2

stage.addEventListener(KeyboardEvent.KEY_DOWN, moveSmiley);

function moveSmiley(event:KeyboardEvent):void
{
switch (event.keyCode)
{
case 37:
smiley_mc.x -= 10;
break;
case 38:
smiley_mc.y -= 10;
break;
case 39:
smiley_mc.x += 10;
break;
case 40:
smiley_mc.y += 10;
break;
default:
break;
}
}

/*
var myNumber:Number = 80;

if (myNumber == 10)
{
trace("myNumber equals 10");
}
else if (myNumber == 8)
{
trace("myNumber equals 8");
}
else
{
trace("myNumber does not equal 10 OR 8");
}
*/

/*var myLetter:String = "b";

switch (myLetter)
{
case "a":
trace("a");
break;
case "b":
trace("b");
break;
case "c":
trace("c");
break;
default:
break;
}*/

Nincsenek megjegyzések: