View Single Post
  #1  
Old 05-02-2008, 03:53 PM
Robin Robin is offline
The secret of NIMH
Robin's Avatar
Join Date: Apr 2005
Location: Wales, UK
Posts: 515
Robin will become famous soon enough
Send a message via AIM to Robin
addEventListener

Like in javascript, subscribe to events using code.

PHP Code:
  function onCreated() {
    
this.addEventListener("this.onWeaponfired", function() {
      
player.chat = "Hi!";
    });
    
showGUI();
  }
  function 
showGUI() {
    new 
GuiBitmapBorderCtrl("this.radiogui") {
      
profile = GuiBitmapBorderProfile;
      
canmove = false;
      
canresize = false;
      
height = 50;
      
width = 385;
      
x = screenwidth - width - 20;
      
y = -50;
      
visible = true;
      new 
GuiButtonCtrl("PlayButton") {
        
x = 25;
        
y = 5;
        
alpha = 1;
        
width = 50;
        
height = 20;
        
text = "Play";
      }
      new 
GuiButtonCtrl("MuteButton") {
        
x = 25;
        
y = 25;
        
alpha = 1;
        
width = 50;
        
height = 20;
        
text = "Mute";
      }
    }
    
this.addEventListener("MuteButton.onMouseDown", function(MouseEvent) {
      echo(@
MouseEvent.mousescreenx);
    });
  } 
etc. What say thee Stefan?
Reply With Quote