<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Nope - didn't work for me like that, got this error:<div><br></div><div><div>&nbsp;&nbsp; The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code, in line: &nbsp; public var globalthis = this;}</div><div><br></div><div>The line compiles into its own file globalthis.as:</div><div><br></div><div><div>&nbsp;&nbsp;package {</div><div>&nbsp;&nbsp;public var globalthis = this;}</div><div><br></div></div><div>You can use 'this' as long as it isn't in a var initializer however.</div><div>You can use this to indirectly set the global variable if you want.</div><div>For example, this works:</div><div><br></div><div><div>&nbsp;&nbsp;var&nbsp;globalthis;</div><div>&nbsp;&nbsp;function setThis(thisvar) {</div><div>&nbsp;&nbsp; &nbsp;globalthis = thisvar;</div><div>&nbsp;&nbsp;}</div><div>&nbsp;&nbsp;setThis(this);</div><div><br></div><div>&nbsp;&nbsp;function stuff(foo) {</div><div>&nbsp;&nbsp;}</div><div>&nbsp;&nbsp;stuff(globalthis); // I can use the globalthis now.</div><div><br></div><div><br></div></div><div><div>On Jul 29, 2008, at 9:20 AM, P T Withington wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>As a way to create an alias to the global object, like we have in every other runtime.<br></div></blockquote></div><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br class="Apple-interchange-newline">--</div><div><br>Don Anderson<br>Java/C/C++, Berkeley DB, systems consultant<br><br>voice: 617-547-7881<br>email:&nbsp;<a href="mailto:dda@ddanderson.com">dda@ddanderson.com</a><br>www:&nbsp;<a href="http://www.ddanderson.com/">http://www.ddanderson.com</a><br></div></div></span></span><br class="Apple-interchange-newline"></div></span></div></span><br class="Apple-interchange-newline"> </div><br></div></body></html>