WHAT'S NEW?
Loading...

Pengenalan mouse event as3


kali ini Pustaka Flash mencoba memberikan scripth dasar Pengenalan mouse event as3
  1. Mouse event klick  
  2. scripth yang dipergunakan
    tombol.addEventListener(MouseEvent.CLICK,mousediklik);
    function mousediklik(e:MouseEvent):void{
     //keadaan yang diinginkan
    
    }
    
    contoh penerapan
    tombol.addEventListener(MouseEvent.CLICK,mousediklik);
    function mousediklik(e:MouseEvent):void{
     isiteks.text="mouse diklik";//keadaan yang diinginkan
    
    }
    
    hasil:
  3. Mouse event down  
  4. scripth yang dipergunakan
    tombol.addEventListener(MouseEvent.MOUSE_DOWN,mousedown);
    function mousedown(e:MouseEvent):void{
     //keadaan yang diinginkan
    
    }
    
    contoh penerapan
    tombol.addEventListener(MouseEvent.MOUSE_DOWN,mousedown);
    function mousedown(e:MouseEvent):void{
     isiteks.text="tombol ditekan";
    }
    
    
    hasil:
  5. Mouse event down plus up  
  6. scripth yang dipergunakan
    tombol.addEventListener(MouseEvent.MOUSE_DOWN,mousedown);
    function mousedown(e:MouseEvent):void{
     //keadaan yang diinginkan
    }
    tombol.addEventListener(MouseEvent.MOUSE_UP,mouseup);
    function mouseup(e:MouseEvent):void{
     //keadaan yang diinginkan
    }
    
    
    contoh penerapan
    tombol.addEventListener(MouseEvent.MOUSE_DOWN,mousedown);
    function mousedown(e:MouseEvent):void{
     isiteks.text="tombol ditekan";
    }
    tombol.addEventListener(MouseEvent.MOUSE_UP,mouseup);
    function mouseup(e:MouseEvent):void{
     isiteks.text="tombol dilepas dr tekanan";
    }
    
    
    
    hasil:
  7. Mouse event Rollover dan Rollout  
  8. scripth yang dipergunakan
    tombol.addEventListener(MouseEvent.ROLL_OVER,rollover);
    function rollover(e:MouseEvent):void{
     //keadaan yang diinginkan
    }
    tombol.addEventListener(MouseEvent.ROLL_OUT,rolout);
    function rolout(e:MouseEvent):void{
     //keadaan yang diinginkan
    }
    
    
    contoh penerapan
    tombol.addEventListener(MouseEvent.ROLL_OVER,rollover);
    function rollover(e:MouseEvent):void{
     isiteks.text="tombol dirolover";
    }
    tombol.addEventListener(MouseEvent.ROLL_OUT,rolout);
    function rolout(e:MouseEvent):void{
     isiteks.text="tombol dirolout";
    }
    
    hasil:
  9. Mouse event double cick  
  10. scripth yang dipergunakan
    tombol.doubleClickEnabled = true;
    tombol.addEventListener(MouseEvent.DOUBLE_CLICK,onMouseDoubleClick);
    function onMouseDoubleClick(e:MouseEvent):void{
    
     //keadaan yang diinginkan
    }
    
    
    contoh penerapan
    tombol.doubleClickEnabled = true;
    tombol.addEventListener(MouseEvent.DOUBLE_CLICK,onMouseDoubleClick);
    function onMouseDoubleClick(e:MouseEvent):void{
     isiteks.text="tombol diklik 2 kali";
    }
    
    
    hasil:

5 Halaman yang sering dikunjungi: 

0 komentar:

Post a Comment