开发者

why asyncHandler in FlexUnit fails in capturing TIMERCOMPLETE event?

I am testing timerevent with flex unit. Follwing is the co开发者_如何学Gode which i tried , it always goes to cmdFailed function (Time out function).I am new to flex unit .any help would be greatly appreciated.

[Before]

    public function setUp():void
    {           

        timer = new Timer(12000);                                           
    }

         [Test(async,order=1)]
    public function teststorapidpresenter():void
    {               

        timer.addEventListener(TimerEvent.TIMER_COMPLETE,Async.asyncHandler(this,cmdHandler,20000,null,cmdFailed));
        timer.start();          
    }

        private function cmdHandler(event:TimerEvent,passThroughData:Object):void
    {           

    }

    private function cmdFailed(event:Event):void
    {
        fail("Event not dispatched");
    }


Yes, classic error here. By default, repeatCount property of a timer is 0. That means the time never stops so the TIMER_COMPLETE is never dispatched.

timer.repeatCount = 1

and it should work

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜