View Single Post
  #7  
Old 08-06-2010, 12:04 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
If you destroy and create a GUI in the same function callstack, exceptions occur not every time but eventually they do.

Work-around:

PHP Code:
//#CLIENTSIDE
function onCreated() {
  if (
isObject("awesomeGUI")) {
    
awesomeGUI.destroy();
  }
  
this.scheduleevent(0.05"CreateGUI"""); // Should be able to use trigger as well, but the difference would be neglible.
}

function 
onCreateGUI() {
  new 
GuiWindowCtrl("awesomeGUI") {
    
10;
    
width height 100;
  }

As for your "this." variable situation, you were probably accessing it at the wrong level of scope.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.value 5;
  new 
GuiButtonCtrl(testButton) {
    
width height 100;
    
= (screenwidth width) / 2;
    
= (screenheight height) / 2;
    
this.other "lol";
    
text "Value: " thiso.value// Would show Value: 5
    
text "Other: " this.other// Would show Other: lol
  
}

__________________
Quote:
Reply With Quote