Well, In my case, a found a similar issue. When I changed my Flex sdk from 3 to 
3.5, my app began to fire an error about a null intance reference in the 
centerPopup method, but it only happens the second time second time onwards 
when I create the popup. The thing is, the method is called from a module 
loaded inside the popup:

appRoot
 PopupComponent
   ModuleLoader
     Module
       "PopUpManager.centerPopUp(IFlexDisplayObject(parent.parent))"
            
>From this level al call de centerPopUpMethod and i get "Can not access a 
>property or method of a null object reference" error.

And every time that I remove the popup I use:

"PopUpManager.removePopUp(IFlexDisplayObject(parent.parent))"

And, when I return my project to SDK 3, the issue disappears.

Anyone have an idea?


--- In [email protected], "Guilherme Blanco" <guilhermebla...@...> 
wrote:
>
> Perfect!
> 
> I have enough info to solve everything by myself.
> 
> 
> Thanks a lot!
> 
> On Wed, Sep 17, 2008 at 9:29 PM, Alex Harui <aha...@...> wrote:
> > The ModuleInfo.factory should be valid.
> >
> >
> >
> > From: [email protected] [mailto:[email protected]] On
> > Behalf Of Guilherme Blanco
> > Sent: Wednesday, September 17, 2008 5:06 PM
> > To: [email protected]
> > Subject: Re: [flexcoders] Multiple requests to load module do weird
> > behaviors in app
> >
> >
> >
> > Ok.
> >
> > But how would I instantiate another objects without knowing its name then?
> >
> > Currently I rely on event.module.factory.create(), which is called on
> > READY event.
> > By not calling the load() method, it'll never reach the READY event
> > again, so I'll be unable to use it.
> >
> > Hm... maybe storing the Class in the Registry item?
> >
> > Best regards,
> >
> > On Wed, Sep 17, 2008 at 8:49 PM, Alex Harui <aha...@...> wrote:
> >> I looked at your code a bit more. I guess it makes sense. The
> >> ModuleManager should be preventing double load() calls and what not, but I
> >> would check ModuleInfo.ready and not call load() again if it is ready just
> >> to be safe.
> >>
> >>
> >>
> >> Also make sure you aren't unloading a module that isn't fully loaded and
> >> ready.
> >>
> >>
> >>
> >> Posting the stack traces you get might also help
> >>
> >> -Alex
> >>
> >>
> >>
> >> From: [email protected] [mailto:[email protected]] On
> >> Behalf Of Guilherme Blanco
> >> Sent: Wednesday, September 17, 2008 3:57 PM
> >> To: [email protected]
> >> Subject: Re: [flexcoders] Multiple requests to load module do weird
> >> behaviors in app
> >>
> >>
> >>
> >> Hi Alex,
> >>
> >> I never meant to get a ready to use code, I hate that. We only learn
> >> something by doing things by yourself. I just want ideas, that's what
> >> I asked for.
> >>
> >> I don't understand one point and maybe you can highlight me.
> >> In the case I do not have the module loaded and I click twice (for
> >> example), I have 2 requests to me called later (only when module is
> >> ready).
> >>
> >> Suppose I decide to stack a method call and the module read event just
> >> instantiate the class and call it each time it was scheduled in pipe.
> >> In this situation, I'll have to instantiate through the class name (ie
> >> var foo:* = new my.ns.ClassFoo();), which schedules module to load it
> >> and the idea of module loading/unloading does not work.
> >>
> >> Another idea is to try to avoid the ModuleInfo.load() call.
> >> In this situation, the module ready is never called again, so I'll be
> >> unable to call again. This idea is not acceptable, since I may want to
> >> open 2 tabs for example of the same module (for example... Create
> >> Company tab).
> >>
> >> In all situations I've imagined, I still rely on ModuleEvent.READY.
> >> Which means I must have to use the event to be able to not load the
> >> module during compilation (only possible through
> >> e.module.factory.create();).
> >> So, it must call ModuleInfo.load() and also only instantiate instances
> >> through e.module.factory.create().
> >> By adding these restrictions... I cannot imagine any other
> >> implementation except the one I wrote.
> >>
> >> What does my idea do?
> >> It only has a single ModuleInfo for each module to be loaded and
> >> attach various READY listeners (once per click) to be called when load
> >> is completed.
> >>
> >> Hum.... maybe looking at source now I can understand my issues.
> >> I always attach my listeners to READY event and at the end of READY
> >> event I dispatch the same event again. Maybe I'm in a recursive loop?
> >>
> >> Anyway, I'll try to address that....
> >> but if you have any other ideas, please share with me. I do not want
> >> code ready, just the concept behind the code. Leave me to implement
> >> it.
> >> That's how I like to work. =)
> >>
> >> Thanks in advance,
> >>
> >> On Wed, Sep 17, 2008 at 5:29 PM, Alex Harui <aha...@...> wrote:
> >>> I would try to build some way so you only request a module once
> >>>
> >>>
> >>>
> >>> From: [email protected] [mailto:[email protected]] On
> >>> Behalf Of Guilherme Blanco
> >>> Sent: Wednesday, September 17, 2008 7:11 AM
> >>> To: [email protected]
> >>> Subject: [flexcoders] Multiple requests to load module do weird behaviors
> >>> in
> >>> app
> >>>
> >>>
> >>>
> >>> Hi,
> >>>
> >>> I'm currently working in an extremely big application written in Flex
> >>> + PHP + Oracle.
> >>> It's entirely controlled by modules and events dispatching and
> >>> listenings to reduce memory overhead.
> >>> Each app piece is a module which is loaded when requested to be viewed
> >>> and unloaded when closed.
> >>>
> >>> To support this modules dependency, I have this small class that
> >>> controls the Module loading in my application:
> >>>
> >>> http://pastebin.com/f73a59279
> >>>
> >>> Static method Environment.getModuleURLFromPackage does something like:
> >>> return module.replace( /\./gi, "/" ) + ".swf";
> >>> And I implemented a wrapper to DRY module load calls:
> >>>
> >>> public static function loadModule(module:String, handler:Function,
> >>> showProgressInfo:Boolean = false):void
> >>> {
> >>> // Registry to prevent multiple instances of same module
> >>> var m:AdvancedModuleLoader = AdvancedModuleLoader.create(module);
> >>>
> >>> m.showProgressInfo = showProgressInfo;
> >>> m.addEventListener(ModuleEvent.READY, handler);
> >>> m.load();
> >>> }
> >>>
> >>> The code to get it working is really simple:
> >>>
> >>> Environment.loadModule("modules.company.dialogs.CreateCompanyWindow",
> >>> function (e:ModuleEvent):void
> >>> {
> >>> // Dialog creation
> >>> var dialog:* = e.module.factory.create();
> >>>
> >>> PopUpManager.addPopUp(dialog, Environment.getApplication(), true);
> >>> PopUpManager.centerPopUp(dialog);
> >>> }, true);
> >>>
> >>> In this example, it opens a module based TitleWindow, but there're a
> >>> lot of other situations, like Canvas based Modules, FormItem based,
> >>> etc.
> >>> What's the issue here?
> >>> If I keep calling this execution (for example click a lot of times in
> >>> a button), there're different behaviors:
> >>>
> >>> 1- It freezes my application
> >>> 2- It loads the first one and start to open alert messages "SWF is not
> >>> loadable" (one per click)
> >>> 3- It never finishes to load the module and fails silently
> >>> 4- It loads the first one (but not the others), but never removes the
> >>> progress bar
> >>>
> >>> The most reproduceable ones are numbers 2 and 4.
> >>>
> >>> Can someone please give me any idea how do I fix this?
> >>>
> >>> Thanks in advance,
> >>>
> >>> Best regards,
> >>>
> >>> --
> >>> Guilherme Blanco - Web Developer
> >>> CBC - Certified Bindows Consultant
> >>> Cell Phone: +55 (16) 9166-6902
> >>> MSN: guilhermebla...@...
> >>> URL: http://blog.bisna.com
> >>> Rio de Janeiro - RJ/Brazil
> >>>
> >>>
> >>
> >> --
> >> Guilherme Blanco - Web Developer
> >> CBC - Certified Bindows Consultant
> >> Cell Phone: +55 (16) 9166-6902
> >> MSN: guilhermebla...@...
> >> URL: http://blog.bisna.com
> >> Rio de Janeiro - RJ/Brazil
> >>
> >>
> >
> > --
> > Guilherme Blanco - Web Developer
> > CBC - Certified Bindows Consultant
> > Cell Phone: +55 (16) 9166-6902
> > MSN: guilhermebla...@...
> > URL: http://blog.bisna.com
> > Rio de Janeiro - RJ/Brazil
> >
> > 
> 
> 
> 
> -- 
> Guilherme Blanco - Web Developer
> CBC - Certified Bindows Consultant
> Cell Phone: +55 (16) 9166-6902
> MSN: guilhermebla...@...
> URL: http://blog.bisna.com
> Rio de Janeiro - RJ/Brazil
>


Reply via email to