Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
The step where I have to set the result textfield value. Do i set the textfield value immediately from the computecommand class or do i have to do something else?
<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:TextInput x="172" y="161" id="get1"/> <s:TextInput x="172" y="204" id="get2"/> <s:Button x="172" y="234" label="Button" id="btn" click="btn_clickHandler(event)"/> <s:TextInput x="172" y="263" id="result"/> <s:Button x="172" y="101" label="Button" id="starten" click="starten_clickHandler(event)"/> <fx:Script> <![CDATA[ import lindsey.ApplicationFacade; public static const NAME:String = 'calcView'; public static const BTN_CLICKED:String = NAME + 'btnclicked'; private function init():void{ ApplicationFacade.getInstance().startup( this ); } protected function btn_clickHandler(event:MouseEvent):void { dispatchEvent(new Event("BTN_CLICKED", true, false)); // TODO Auto-generated method stub } protected function starten_clickHandler(event:MouseEvent):void { // TODO Auto-generated method stub } ]]> </fx:Script></s:Application>
package lindsey{ import flash.events.DataEvent; import flash.events.Event; import flash.events.MouseEvent; import flash.ui.Mouse; import org.puremvc.as3.interfaces.IMediator; import org.puremvc.as3.interfaces.INotification; import org.puremvc.as3.patterns.mediator.Mediator; public class calcViewMediator extends Mediator implements IMediator { public static const NAME:String = 'calcViewMediator'; private var calcView:LS; public function calcViewMediator(viewComponent:Object=null) { trace('class urlsviewmediator function urlsviewmediator'); super( NAME, viewComponent); } override public function onRegister():void { trace('class urlsviewmediator function onregister'); calcView = new LS(); calcView.addEventListener("BTN_CLICKED", clickHandler); //calcView.addEventListener(MouseEvent.CLICK, clickHandler ); //sendNotification( ProgressView.HIDE ); } override public function listNotificationInterests():Array { trace('class urlsviewmediator function listnotificationinterests'); return [ //URLsView.SHOW ]; } override public function handleNotification(notification:INotification):void { /* trace('class urlsviewmediator function handlenotification, notification: ' + notification.getName()); var name:String = notification.getName(); var body:Object = notification.getBody(); switch ( name ) { case URLsView.SHOW: urlsView.show(); break; }*/ } private function clickHandler(e:Event):void { trace('class urlsviewmediator function handleurlsviewclicked'); calcView.result.text = (int(calcView.get1.text) + int(calcView.get2.text)).toString(); //sendNotification( URLsView.CLICKED, { index: e.data } ); } private function get proxy():CalcProxy { trace('class urlsviewmediator function proxy'); return facade.retrieveProxy( CalcProxy.NAME ) as CalcProxy; } }}
override public function onRegister():void { trace('class applicationmediator function onregister'); facade.registerMediator(new ApplicationMediator(viewComponent)); facade.registerMediator( new ProjectsViewMediator( viewComponent ) ); facade.registerMediator( new CIViewMediator( viewComponent ) ); facade.registerMediator( new SettingsViewMediator( viewComponent ) ); facade.registerMediator( new RatingSystemsViewMediator( viewComponent ) ); }