O'Reilly logo

Professional Cairngorm™ by Jeremy Wischusen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

22.2. Revising Registration

Registration is currently accomplished with the following classes:

  • RegisterUserEvent

  • RegisterUserDelegate

  • RegisterUserCommand

The RegisterUserEvent will become a type of the new UserEvent class.

The register function of the RegisterUserDelegate will move to the UserDelegate class.

The execute function of the RegisterUserCommand will be updated to use the new UserEvent and UserDelegate classes.

Start by creating the user event class. In the com.FlexBlog.events package create a new event class named UserEvent. Edit the class to match the following:

package com.FlexBlog.events
{
    import com.FlexBlog.valueobjects.UserVO;
    import com.adobe.cairngorm.control.CairngormEvent;
    public class UserEvent extends CairngormEvent
    {
        public static const REGISTER:String = 'registerUserEvent';
        public var user:UserVO;
        public function UserEvent(type:String, user:UserVO = null,
        bubbles:Boolean=false, cancelable:Boolean=false)
        {
            super(type, bubbles, cancelable);
            this.user = user;
        }
    }
}

Now create the new user delegate class. In the com.FlexBlog.delegates package create a new delegate class named UserDelegate. Edit the class to match the following:

package com.FlexBlog.delegates { import com.FlexBlog.valueobjects.UserVO; import flash.errors.SQLError; import mx.rpc.IResponder; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import sql.FlexBlogDatabaseManager; public class UserDelegate { private var responder:IResponder; public function UserDelegate(responder:IResponder) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required