I built an app used SpringGraph, Yahoo! answer API and Cairngorm,
display questions and answers (data from Yahoo! answer) like a tree,
Cairngorm made the code clearly and easily to debug. 

Demo and source: http://www.moorwind.com/read.php?67

During developing this app I found an interesting error, when i creat
some events in different packages, but super the same type:

//event 1
package com.kono.caringorm.events
{
  import com.adobe.cairngorm.control.CairngormEvent;
  import com.kono.caringorm.control.AnswerController;
  import com.adobe.flex.extras.controls.springgraph.Item;

  public class SearchAnswerOnQuestionEvent extends CairngormEvent
  {
    public var onItem:Item;
    
    public function SearchAnswerOnQuestionEvent(onItem:Item)
    {
      this.onItem = onItem;
      super(AnswerController.SEARCH_ANSWER_ON_QUESTION);
    }
    
  }
}
//event 2
package com.kono.caringorm.events
{
  import com.adobe.cairngorm.control.CairngormEvent;
  import com.kono.caringorm.control.RoamerController;
  import com.kono.caringorm.vo.QuestionItem;

  public class RoamerSOQEvent extends CairngormEvent
  {
    public var onItem:QuestionItem;
    
    public function RoamerSOQEvent(onItem:QuestionItem)
    {
      this.onItem = onItem;
      super(RoamerController.SEARCH_ANSWER_ON_QUESTION);
    }
    
  }
}

If AnswerController.SEARCH_ANSWER_ON_QUESTION and
RoamerController.SEARCH_ANSWER_ON_QUESTION define the same string such
as "search", than when i dispatched these two events, the listerner
will sonsider them  the same event. The following caringorm controls
will both receive the two events.

//Cairngorm control 1
package com.kono.caringorm.control
{
  import com.adobe.cairngorm.control.FrontController;
  import com.kono.caringorm.commands.QuestionGetCommand;
  import com.kono.caringorm.commands.SearchAnswerOnQuestionCommand;
  
  public class AnswerController extends FrontController
  {
    public static const SEARCH_ANSWER_ON_QUESTION:String  =
"searchAnswerOnQuestion";
    
    public function AnswerController()
    {
      this.initialize();
    }
    
    private function initialize():void
    {
      this.addCommand(AnswerController.SEARCH_ANSWER_ON_QUESTION,
SearchAnswerOnQuestionCommand);
    }
    
  }
}

//Cairngorm control2
package com.kono.caringorm.control
{
  import com.adobe.cairngorm.control.FrontController;
  import com.kono.caringorm.commands.RoamerInitializeCommand;
  import com.kono.caringorm.commands.RoamerSOQCommand;
  
  public class RoamerController extends FrontController
  {
    public static const SEARCH_ANSWER_ON_QUESTION:String =
"searchAnswerOnQuestion";
    
    public function RoamerController()
    {
      this.initialize();
    }
    
    private function initialize():void
    {
      this.addCommand(RoamerController.SEARCH_ANSWER_ON_QUESTION,
RoamerSOQCommand);
    }
    
  }
}

Reply via email to