I am actually looking at the event called in the Main.mxml file
-----------------------
private function onCreationComplete() : void
{
CairngormEventDispatcher.getInstance().dispatchEvent( new
CairngormEvent( GetProductsEvent.EVENT_GET_PRODUCTS ) );
}
-----------------------
I will look at my code again today and see if I can find the error.
I am getting no error message, the event just doesn't fire.
I have also noticed in the store code, that they store the static
event variable
-----------------------
public static var EVENT_GET_PRODUCTS : String = "getProducts";
-----------------------
in the Event class, while most other Cairngorm examples store this in
the Controller. Is this just personal preference or is there a more
significant reason for this?
- Kevin
On Jan 10, 2007, at 8:30 AM, cardinalflexjeremy wrote:
There actually is a problem in the Cairngorm store code. I found it
when trying to dispatch an event using it.
There are two sections that dispatch events, one works and one does
not. The section with the graphical tile list dispatches a cairngorm
event, but not using the CairngormEventDispatcher to update the
details.
The textual list uses a different method, since I had a grid object
updating the details panel, I used that code, and it does not fire.
The rule of thumb is, if you want to dispatch and event that is not
registered on your controller, you do not use the
CairgormEventDispatcher, but the standard EventDispatcher, regardless
of whether or not your event is a cairngorm event.
If you are using the code that resides in the textual product list to
dispatch an event to update the details it will not work, the code is
wrong. Unless they changed it recently. If you download it, compile
it, and run it, switch to the textual view, it will not update the
details panel. However the visual graphical tile list will work.
Because they use different event dispatching.
Hope this helps. This was a problem for me too. This may not be what
your doing, but at least make sure you did not copy the code from the
textual product list to dispatch the event or it wont work properly.
Jeremy Sanders
Cardinal Solutions Group
Flex Application Developer
[EMAIL PROTECTED]
--- In [email protected], "Stembert Olivier \(BIL\)"
<[EMAIL PROTECTED]> wrote:
>
> What's the description of the error?
> Are you sure the controller has been instantiated?
>
> Olivier
>
> ________________________________
>
> From: [email protected]
[mailto:[EMAIL PROTECTED] On
> Behalf Of Kevin
> Sent: Wednesday, January 10, 2007 12:21 AM
> To: [email protected]
> Subject: [flexcoders] Event calling in Cairngorm 2.1 - Newbie
question.
>
>
>
> I am trying to follow the 2.1 store as a model to understand the
> cairngorm structure and I am getting a constant error in trying to
> dispatch an event. I copied the example code almost exactly, but
i get
> seen to get the even to fire. I don't know if the problem is in my
> FrontController or my event.
>
> Any help you can offer is much appreciated.
>
> Thank, Kevin
>
> -------------------
>
> I have this in my main.mxml file
>
> private function loadGroupList() : void
> {
> CairngormEventDispatcher.getInstance().dispatchEvent( new
> CairngormEvent( GetGroupListEvent.EVENT_GET_GROUP_LIST ) );
> }
>
>
>
> and then in my event file:
>
> import flash.events.Event;
> import com.adobe.cairngorm.control.CairngormEvent;
>
> public class GetGroupListEvent extends CairngormEvent
> {
> public static var EVENT_GET_GROUP_LIST : String = "getGroupList";
>
> //public var position : int;
>
>
>
>
> /**
> * Constructor.
> */
> public function GetGroupListEvent()
> {
> super( EVENT_GET_GROUP_LIST );
> }
>
>
>
>
> /**
> * Override the inherited clone() method, but don't return any
> state.
> */
> override public function clone() : Event
> {
> return new GetGroupListEvent();
> }
> }
>
>
>
>
> and my controller:
>
>
> import com.adobe.cairngorm.control.FrontController;
> //import the command folder
> import com.onefoot.dbocl.command.*
> //import each event
> import com.onefoot.dbocl.event.GetGroupListEvent;
>
>
>
>
> /**
> * @version $Revision: $
> */
> public class DboclController extends FrontController
> {
> public function DboclController()
> {
> initialiseCommands();
> }
>
>
>
>
> public function initialiseCommands() : void
> {
> addCommand( GetGroupListEvent.EVENT_GET_GROUP_LIST,
GetGroupListCommand
> );
> }
> }
>
>
>
>
>
>
>
>
> ---------------------
>
> An electronic message is not binding on its sender.
>
> Any message referring to a binding engagement must be confirmed in
> writing and duly signed.
>
> ---------------------
>
>
>
>
> ---------------------
> An electronic message is not binding on its sender.
> Any message referring to a binding engagement must be confirmed in
writing and duly signed.
> ---------------------
>