views:

1360

answers:

1

I have an MXML file, which references an external script file for all its event handlers:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script source="LoginExample.as" />
    <mx:Button id="btnGoodLogin" click="btnGoodLogin_onClick()"  label="Good Login" enabled="true" y="28"/>
    <mx:Button id="btnBadLogin" click="btnBadLogin_onClick()"  label="Bad Login" enabled="true" y="28" x="112"/>
    <mx:Button id="btnLogout" click="btnLogout_onClick()"  label="Logout" enabled="true" y="28" x="219"/>
    <mx:Button id="btnCheck" click="btnCheck_onClick()"  label="Check" enabled="true" y="28" x="325"/>
    <mx:Text id="txtResult"  y="58" width="263"/>
</mx:Application>

The external file defines the handlers:

// LoginExample.as
import flash.events.*;
import flash.net.*;
function btnGoodLogin_onClick():void
{
   // ...
}
function btnBadLogin_onClick():void
{
  // ...
}
// etc. for other handlers

Every single one of these handlers, plus every other function defined in the script, results in a warning message from the compiler:

1084: function 'btnBadLogin_onClick' will be scoped to the default namespace: LoginExample: internal. It will not be visible outside of this package. LoginExample/src LoginExample.as line 27 1225162212118 189

What's the best way to get rid of these warnings?

+3  A: 

Stick a private, protected, internal or public before the function declaration:

private function btnBadLogin_onClick():void

That should do the trick.

Theo