Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: question about an assumption behind Operations

  1. #11
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    406

    Default found it

    Yea, found it, check out this class (I'm using the Flex 4 SDK):

    mx.resources.ResourceManagerImpl

    go to line 482 and you'll see the trick they're pulling, I'll implement this in the same way in the LoadModuleOperation, that should negate the need for your IAsyncCommand implementation.

    So, this does indeed turn out to be a bug of sorts, so this thread has definitely been useful!

    cheers,

    Roland

  2. #12
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    406

    Default implemented

    Hey guys,

    I did a quick implementation of the timer trick in the operations that load modules, I don't have time to test it thoroughly though since I have to get on a train ina few hours and also need to work on my project in the mean time.
    If any of you have the chance to test the LoadModuleOperation, to see if the event handlers get called after loading the same module for a second time, that would be great.

    thanks a lot in advance,

    Roland

  3. #13
    Join Date
    Apr 2010
    Posts
    18

    Default it works

    After a quick test, it seems to be working.
    Now just for my culture, concerning the implementation : wouldn't have it been simpler to use the setTimeout function rather than a Timer ? :

    So this :
    Code:
    			setTimeout(function():void {
    				moduleInfo.load(applicationDomain, securityDomain);
    			}, 0);
    Instead of :
    Code:
    			var timer:Timer = new Timer(0);
    			var timerHandler:Function = function(event:TimerEvent):void {
    					timer.removeEventListener(TimerEvent.TIMER, timerHandler);
    					timer.stop();
    					timer = null;
    					moduleInfo.load(applicationDomain, securityDomain);
    				}
    			timer.addEventListener(TimerEvent.TIMER, timerHandler, false, 0, true);
    			timer.start();
    Any difference between the two forms ?

    Thanks for your time !

  4. #14
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    Hi,

    AFAIK the 2 are the same. The docs for setTimeout() state the following though:

    Instead of using this method, consider creating a Timer object, with the specified interval, using 1 as the repeatCount parameter (which sets the timer to run only once).
    Unfortunately, I don't know why that is. Anyone?

    regards,
    Christophe
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •