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 :)
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);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.