View Single Post
11-16-12, 06:36 AM   #16
Elderin
A Deviate Faerie Dragon
Join Date: Nov 2012
Posts: 17
Sorry, guys, I was just looking at the specific code in the example. I was just referring to the mix of tags and functions. I just confused things with my statement about changing the Onload (magenta colored) to OnUpdate (green colored). My bad. I apologize.

Originally Posted by SDPhantom View Post
If you really want XML code to be inaccessible to the global environment, you can clean up after it in an OnLoad handler. Furthermore, the following XML structure can be rewritten to use one less stack position in its script handlers.

Code:
<Frame>
	<Scripts>
		<OnUpdate>
			MyAddonFrame_OnUpdate(self,elapsed);
		</OnLoad>
	</Scripts>
</Frame>
Rewritten to:

Code:
<Frame>
	<Scripts>
		<OnUpdate function="MyAddonFrame_OnUpdate"/>
	</Scripts>
</Frame>
This takes the pointer set to the global MyAddonFrame_OnLoad and directly sets it as the OnLoad handler instead of creating a function wrapper. After that, you may erase the global variable and the frame will still run the function.
Thanks for the link to the Widget Handlers. Sigh. So much to learn, so little time.

Last edited by Elderin : 11-16-12 at 06:39 AM.
  Reply With Quote