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

20.3. Event Classes

You will need event classes for both types of search and one additional event class to clear the search results.

Start with the event for the keyword search. In the com.FlexBlog.events package create a new event class named KeyWordSearchEvent. Edit the class to match the following:

package com.FlexBlog.events
{
    import com.adobe.cairngorm.control.CairngormEvent;
    public class KeyWordSearchEvent extends CairngormEvent
    {
        public static const KEYWORD_SEARCH:String = 'keyWordSearchEvent';
        public var keyWords:String;
        public function KeyWordSearchEvent(keyWords:String, bubbles:Boolean=false,
cancelable:Boolean=false)
        {
            super(KEYWORD_SEARCH, bubbles, cancelable);
            this.keyWords = keyWords;
        }
    }
}

This event simply takes in a string containing the keywords to use in the search so that they can be passed to the command class.

Next, create the event for the category search. In the com.FlexBlog.events package create a new event class named CategorySearchEvent. Edit the class to match the following:

package com.FlexBlog.events
{
    import com.FlexBlog.valueobjects.CategoryVO;
    import com.adobe.cairngorm.control.CairngormEvent;
    public class CategorySearchEvent extends CairngormEvent
    {
        public static const CATEGORY_SEARCH:String = 'categorySearchEvent';
        public var category:CategoryVO;
        public function CategorySearchEvent(category:CategoryVO,
        bubbles:Boolean=false, cancelable:Boolean=false)
        {
            super(CATEGORY_SEARCH, bubbles, cancelable);
            this.category = category;
        }
    }
}

This event takes ...

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