I had tried moving my statements in just about every sequence I could
think of and always the same issue.  I realize it had to be some sort
of timing issue since about one out of every 5th or 6th time it would
work on the first click.

I decided to move my implementation to use ModuleManager instead as it
gave a bit better control and actually dispatched a ready event that I
could listen to, unlike ModuleLoader.  Once I move to ModuleManager I
still had the same issues though.  In simply taking guesses and trying
different things here is what solved the issue and I have no idea why.
 My original class name that held loading code was:

public class ModuleHelper {....}

I simply changed the definition to:

public class ModuleHelper extends Sprite {...}

And for some reason completely unknown to me, that change worked.  I
have yet to reproduce my problem when the class is defined this way. 
Take the extends off and I go back to the same issue.  I'm not sure if
there is a rule that the modules have to be loaded inside of some sort
of ui object or not, but this is what fixed my issue.

If anyone has any information as to why this worked, I'd love to know why.

Thanks for your help and suggestions,
Dale


--- In flexcoders@yahoogroups.com, "Gaurav Jain" <[EMAIL PROTECTED]> wrote:
>
> It sounds like in the first load the eventListener is not getting
> registered before the loadModule() method. 
> 
> Subsequent calls work because of the event listener added from the
> first attempt.
> 
> I suggest you move 
> moduleLoader.id = moduleName;
> moduleLoader.url = moduleName;
> 
> to the very end. 
> 
> Thanks,
> Gaurav
>


Reply via email to