concept event in category rails

This is an excerpt from Manning's book Flexible Rails: Flex 3 on Rails 2.
Listing 3.22. app\flex\com\pomodo\events\AccountCreateEvent.as
package com.pomodo.events { import flash.events.Event; public class AccountCreateEvent extends Event { public static const ACCOUNT_CREATE:String = "accountCreate"; public var user:XML; public function AccountCreateEvent(user:XML) { super(ACCOUNT_CREATE); this.user = user; } } }
Once the service returns, the result triggers the handleAccountCreateResult event handler. Inside it, we access the event.result. If it’s the text error, we show an Alert dialog displaying a terse error message. Otherwise, we assume success, so we dispatch a new event called AccountCreateEvent with the result, cast to XML. The XML(result) cast is necessary because the user variable is typed in the Event.
We realize that what these all have in common is that things go wrong because the user variable in the PomodoModelLocator isn’t set. So, rather than dispatching the events in the handleCreationComplete() function in MainBox, we decide to make the user variable a property with set/get methods, and fire off the events in the set method. We could take other approaches, but this is the one we’ll take because it’s fairly simple.