WHAT'S NEW?
Loading...

Piano part2 As3




Tutorial Details
  • Judul:
  • Difficulty: Beginner
  • Platform: Flash (Flash Player 10)
  • Bahasa Scripth: AS3
  • Software : Flash Professional CS4/Flash Professional CS5
  • Estimated Completion Time: 15 minutes
  • Created:Ricko Nada (Pustaka Flash)





live demo :



Scripth yang digunakan :
var clipArray:Array = [qing.dor,qing.bro,qing.caca,qing.dada,qing.ee,qing.ff,qing.gg,qing.hh,qing.ii,qing.jj,qing.kk,qing.ll,qing.mm,qing.nn,qing.oo,qing.pp,qing.qq,qing.rr,qing.ss,qing.tt,qing.uu,qing.vv,qing.ww,qing.xx,qing.yok,qing.zeta];
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, myKeyup);
for (var i:int = 0; i < clipArray.length; i++)
{
 clipArray[i].buttonMode = true;
 clipArray[i].addEventListener(MouseEvent.MOUSE_DOWN, clickdown);
 clipArray[i].addEventListener(MouseEvent.MOUSE_UP, clickup);

}

function clickdown(e:MouseEvent):void
{
 e.currentTarget.gotoAndStop(3);
}
function clickup(e:MouseEvent):void
{
 e.currentTarget.gotoAndStop(1);
}

function myKeyDown(e:KeyboardEvent):void
{
 for (var i:int = 0; i <clipArray.length; i++)
 {
  var keyboardku = i+64;
  if (e.keyCode == keyboardku)
  {
   clipArray[i-1].gotoAndStop(3);
  }

 }
}
function myKeyup(e:KeyboardEvent):void
{
 for (var i:int = 0; i <clipArray.length; i++)
 {
  var keyboardku = i+64;
  if (e.keyCode == keyboardku)
  {
   clipArray[i-1].gotoAndStop(1);
  }

 }
}





0 komentar:

Post a Comment