Cara, este exemplo está escrito em ActionScript 2.0 que era usado no
Flex 1.5. No Flex 2 a versão do ActionScript é a 3.0. Segue a classe
corrigida para você:

package
{

public class CalculatorHandlers
{
        // properties
        // object to hold a reference to the view object
        public var calcView:Object;
        // registers to hold temporary values pending operation
        private var reg1:String="";
        private var reg2:String="";
        // result of an operation
        private var result:Number;
        // the name of the register currently used
        private var currentRegister:String="reg1";
        // the name of the next operation to be performed
        private var operation:String="none";
        // for convenience, holder for numerical equivalents
        // of the register string values
        private var r1:Number;
        private var r2:Number;
        // constructor
        public function CalculatorHandlers()
        {}

        // methods
        // perform the current operation on the 2 registers
        public function doOperation():void
        {
                // cast the register values to numbers
                r1=Number(reg1);
                r2=Number(reg2);
                switch (operation)
                {
                        case "add":
                                result=r1+r2;
                                resetAfterOp();
                                break;
                        case "subtract":
                                result=r1-r2;
                                resetAfterOp();
                                break;
                        case "multiply":
                                result=r1*r2;
                                resetAfterOp();
                                break;
                        case "divide":
                                result=r1/r2;
                                resetAfterOp();
                                break;
                        default:
                                // do nothing
                }
        }
        // concatenate number to the value of the current register
        public function addNumber(n:String):void
        {
                if (operation=="none" && currentRegister=="reg2")
                {
                        reg1="";
                        setCurrentRegister();
                }
                this[currentRegister]+=n;
                setDisplay(currentRegister);
        }
        // clear the current register
        public function clearEntry():void
        {
                this[currentRegister]="";
                setDisplay(currentRegister);
        }
        // clear both registers and the current operation
        public function clearAll():void
        {
                reg1="";
                reg2="";
                setCurrentRegister();
                setOperation("none");
                setDisplay(currentRegister);
        }
        // set the current operation
        public function setOperation(operation:String):void
        {
                this.operation=operation;
                setCurrentRegister();
        }
        // set the value shown in the display
        private function setDisplay(register:String):void
        {
                calcView.calcDisplay.text = this[register];
        }
        // set which register is current
        private function setCurrentRegister():void
        {
                if (reg1=="")
                {
                        currentRegister="reg1";
                }
                else
                {
                        currentRegister="reg2";
                }
        }
        // reset values after an operation
        private function resetAfterOp():void
        {
                reg1=String(result);
                reg2="";
                setDisplay("reg1");
                setOperation("none");
        }
}

}

Para não ter mais este problema eu sugiro começar por aqui:
http://livedocs.adobe.com/flex/201/html/Part3_Tutorials_015_1.html

[]'s
Beck Novaes



On 23 maio, 20:42, alezinho <[EMAIL PROTECTED]> wrote:
> Amigos, tudo bem?
>
> Sou iniciante no Flex e estou aprendendo bastante com esse grupo.
> Gostaria de poder contar com a ajuda de vocês no meu primeiro email
> para o grupo.
>
> Estou tentando fazer o projeto Calculadora funcionar, mas, no painel
> de erros mostra a seguinte mensagem:
>
> "A file found in a source-path must have an externally visible
> definition. If a definition in the file is meant to be externally
> visible, please put the definition in a package."
>
> Link com os fonts desse projeto:
> - calculator.mxml:http://www.adobe.com/devnet/flex/articles/calculator_12.html
> - 
> CalculatorHandlers.as:http://www.adobe.com/devnet/flex/articles/calculator_13.html
>
> Estou usando o Eclipse com Flex 2 SDK.
>
> Abraço à todos
>
> Alessandro Costa


--~--~---------~--~----~------------~-------~--~----~
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para [email protected]
Para sair da lista, envie um email em branco para [EMAIL PROTECTED]
Mais opções estão disponíveis em http://groups.google.com/group/flexdev
-~----------~----~----~----~------~----~------~--~---

Responder a