Hi Maria, thanks for the response. That code was after a long frustrating day, I included the MVC just to see if anything responded.
Here’s what I have been working on. My problem is with object to object communication. You can check it out here. http://www.rootmodelsolutions.com/ARootModelJS/index.html I thought that the [EventHandler] metatag will automatically be added to a crux event list and then automatically respond to the object using the defined method. I seem to be getting couple weird behaviors I can’t track down. Maybe something in my initial setup – missing containerbinding. Thanks for looking. I’ve included my project. You can see it’s simple basic code. The Header has 1 listner that should listen to itself for the break reminder but it does not respond – it should dispatch 2 events sleep and break. [Bindable] [EventHandler( event="UserEvent.BREAK.REMINDER")] public function handleBreakEvent( event:UserEvent ):void { Alert.show( 'appHeader catch', 'Success' ); } public function breakClick():void { var event:UserEvent= new UserEvent( UserEvent.BREAK_REMINDER ); event.user = new User(); event.bubbles = true; this.dispatchEvent(event); } public function sleepClick():void { var event:UserEvent= new UserEvent( UserEvent.SLEEP_REMINDER ); event.user = new User(); event.bubbles = true; this.dispatchEvent(event); } the HomeLeftSide has a break and sleep and both work. however the alerts just before dispatching the events don’t. The Listener for AppHeader should have caught this as well but didn’t. [Bindable] [EventHandler( event="UserEvent.BREAK_REMINDER")] public function handleLogonEvent( event:UserEvent ):void { Alert.show( 'Break Reminder', 'Success' ); } [Bindable] [EventHandler( event="UserEvent.SLEEP_REMINDER")] public function handleSleepEvent( event:UserEvent ):void { Alert.show( 'Sleep Reminder', 'Success' ); } public function sleepClick():void { Alert.show( 'Button Clicked', 'Success' ); <<<< doesn’t open var event:UserEvent= new UserEvent( UserEvent.BREAK_REMINDER ); event.bubbles = true; this.dispatchEvent(event); } public function breakClick():void { Alert.show( 'Break Clicked', 'Success' ); <<<< doesn’t open var event:UserEvent= new UserEvent( UserEvent.BREAK_REMINDER ); event.bubbles = true; this.dispatchEvent(event); } The HomeMainFrame just has 2 listeners. – Neither of them catch the dispathes from the header or the HomeLeftSide [Bindable] [EventHandler( event="UserEvent.SLEEP_BREAK")] public function handleSleepEvent( event:UserEvent ):void { Alert.show( 'Sleep Event from HMF', 'Success' ); } [Bindable] [EventHandler( event="UserEvent.BREAK_REMINDER")] public function handleBreakEvent( event:UserEvent ):void { Alert.show( 'Break Event from HMF ', 'Success' ); } From: Maria Jose Esteve Sent: Sunday, March 20, 2022 12:15 PM To: users@royale.apache.org Subject: RE: Really need some help here Hi, I can't help you with the configuration with Moonshine but I've done some tests... - I compiled the project with asconfigc and it gives an error in UserEvent. It must extend from "org.apache.royale.events.Event", you are missing the import. - I think you have a misconception... in the mvc pattern: the view should not be the destination of a call to an event that is directed to the controller. If you want the view to act on the result of a call to the controller you will have to bind the model and act on its changes. VIEW à CONTROLLER à MODEL à VIEW The view is not going to hear from the view dispatcher to the controller. - In Testing.mxml, when configuring crux you must indicate the "views", you have only defined the events: <crux:CruxConfig eventPackages="code.event.*"/> - You also have to pay attention and put the correct bead "binding" to each container... In the xml Application the correct bead is "ApplicationDataBinding" and not "ConainerDataBinding". - I see that you are relying on the crux basic example,..., maybe you should check also todomvc-jewel-crux. It will help you to understand a little better the mvc pattern. Hiedra De: Mark <m_hartn...@comcast.net> Enviado el: sábado, 19 de marzo de 2022 15:08 Para: users@royale.apache.org Asunto: Really need some help here I’m having a hard time understanding why these eventHandlers will not respond. I must be missing something very fundamental here. I’m using Moonshine 3.3.1 I’ve attached the project. Any help would be greatly appreciated . This is a very simple app Heading - button that dispatches a LOGON_REQUESTED event. All these have a listner with an alert but do not respond. AppContent listner for LOGON_REQUESTED event UserController listner for LOGON_REQUESTED event Testing.mxml listner for LOGON_REQUESTED event
SampleSystem.as3proj
Description: Binary data