Question

Hey everybody) I need help with the understanding of the framework Cairngorm for flex.

I code a simple application slider. I have a main class in which I have a tag

<fx:Declarations>
    <control:AppController id="appController" />
</fx:Declarations>

Class itself AppController extends FrontController with constructor function:

public function AppController()
    {
        addCommand(SliderEvent.BUILD, SliderBuildCommand);
        addCommand(SliderEvent.TRANSITION, SliderTransitionCommand);
    }

and finally the code of SliderBuildCommand class:

 public function SliderBuildCommand(){}

    public function execute(event:CairngormEvent):void
    {
        config.loadSlides(this);
    }

Unfortunately, in debugging, I see that the addition of the command didn't work out. This can be seen if set a breakpoint in "сonfig.loadSlides(this)" line. However, the command (addCommand) is processed. Any idea why this is happening? Maybe I am a noob and I don't see the obvious :)

No correct solution

OTHER TIPS

Instead of adding/mapping commands in AppController's constructor. Declare it in initialize() function. Example is given below for your reference.

public class AppController extends FrontController
    {
        public function AppController()
        {
            super();
        }

        public function initialize():void
        {
            this.addCommand(SliderEvent.BUILD, SliderBuildCommand);
            this.addCommand(SliderEvent.TRANSITION, SliderTransitionCommand);
        }
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top