View Single Post
  #4  
Old 07-20-2008, 06:29 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
That's what catchevent() is for.

objectA.catchevent(objectBName, eventNameToCatch, newEventName);
PHP Code:
function blah() {
  new 
GuiButtonCtrl("SpecialButton" number) {
    
//stuff
    
thiso.catchevent(this.name"Action""ButtonAction");
  }
}
function 
onButtonAction(objectname) {
  echo(
"Button Action from " objectname);

The new event will always have the name of the object you're catching from as the first parameter.

The following script does the exact same as the above.
PHP Code:
function blah() {
  new 
GuiButtonCtrl("SpecialButton" number) {
    
//stuff
  
}
  
this.catchevent("SpecialButton" number"Action""ButtonAction");
}
function 
onButtonAction(objectname) {
  echo(
"Button Action from " objectname);

__________________
Reply With Quote