You have several syntax errors: missing braces, incorrect case, but when I corrected those it worked fine for me.
Tracy -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, February 18, 2005 6:55 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Connecting Action Script pages to MXML pages Ok first this is a calculator.mxml page <?xml version="1.0"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns = "*" > <CalculatorHandlers id="calcHandlers" calcView="{this}"/> <!-- calculator controller --> <!-- calculator view --> <mx:Panel title="Calculator"> <!-- calculator display --> <mx:Label id="calcDisplay" width="150" textAlign="right"/> <!-- calculator controls --> <mx:Grid> <mx:GridRow> <mx:GridItem colSpan="2"> <mx:Button width="70" label="Clear" click="calcHandlers.clearAll()"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="C/E" click="calcHandlers.clearEntry()"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="+" click="calcHandlers.setOperation('add')"/> </mx:GridItem> </mx:GridRow> <mx:GridRow> <mx:GridItem> <mx:Button width="30" label="1" click="calcHandlers.addNumber('1')"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="2" click="calcHandlers.addNumber('2')"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="3" click="calcHandlers.addNumber('3')"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="-" click="calcHandlers.setOperation('subtract')"/> </mx:GridItem> </mx:GridRow> <mx:GridRow> <mx:GridItem> <mx:Button width="30" label="4" click="calcHandlers.addNumber('4')"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="5" click="calcHandlers.addNumber('5')"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="6" click="calcHandlers.addNumber('6')"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="*" click="calcHandlers.setOperation('multiply')"/> </mx:GridItem> </mx:GridRow> <mx:GridRow> <mx:GridItem> <mx:Button width="30" label="7" click="calcHandlers.addNumber('7')"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="8" click="calcHandlers.addNumber('8')"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="9" click="calcHandlers.addNumber('9')"/> </mx:GridItem> <mx:GridItem> <mx:Button width="30" label="/" click="calcHandlers.setOperation('divide')"/> </mx:GridItem> </mx:GridRow> <mx:GridRow> <mx:GridItem> <mx:Button width="30" label="0" click="calcHandlers.addNumber('0')"/> </mx:GridItem> <mx:GridItem > <mx:Button width="30" label="." click="calcHandlers.addNumber('.')"/> </mx:GridItem> <mx:GridItem colSpan="2"> <mx:Button width="70" label="=" click="calcHandlers.doOperation()"/> </mx:GridItem> </mx:GridRow> </mx:Grid> </mx:Panel> </mx:Application> Now this is the CalculatorHandlers.as file I am trying to link the mxml file to // ActionScript Document class CalculatorHandlers { public var calcView:Object; private var reg1:String =""; private var reg2:String = ""; private var result:Number; private var currentRegister:String= "reg1"; private var operation:String= "none"; private var r1:Number; private var r2:Number; public function CalculatorHandlers() {} } public function doOperation():Void { this.r1 =Number(reg1); this.r2= Number(reg2); switch(operation) { case "add": this.result= r1+r2; resetAfterOp(); break; case "subtract ": this.result= r1-r2; resetAfterOp(); break; case "multiply": this.result= r1*r2; resetAfterOp(); break; case "divide": this.result= r1/r2; resetAfterOp(); break; default: // do nothing } public function addNumber(n:String):Void { if (operation=="none" && currentRegister=="reg2") { reg1=""; setCurrentRegister(); } this[currentRegister]+=n; setDisplay(CurrentRegister); } public function clearEntry():Void { this[currentRegister]=""; setDisplay(currentRegister); } public function clearAll():Void { reg1=""; reg2=""; setCurrentRegister(); setOperation("none"); setDisplay(currentRegister); } public function setOperation(operation:String):Void { this.operation= operation; setCurrentRegister(); } private function setDisplay(register:String):Void { calcView.calcDisplay.text = this[register]; } private function setCurrentRegister():Void { if (reg1=="") currentRegister="reg1"; } else { currentRegister="reg2"; } } private function resetAfterOp():Void { reg1=String(result); reg2=""; setDisplay("reg1"); setOperation("none"); } } Yahoo! Groups Links