Hi,

I am experiencing an odd problem and I hope someone knows why.  I am loading a 
sub-application using SWFLoader.  I listen for the Event.COMPLETE command. Once 
the swf is loaded, I then add a listener to the SystemManager for the swf and 
listen for the FlexEvent.APPLICATION_COMPLETE event.  At that point, I add the 
application as a child to a Canvas that exists in a view stack (see code 
below).  This is great, the content loads, but it doesn't seem to load 
correctly.  The legends in my charts are not oriented the way they should be 
and whenever I roll over an item with a tooltip, I get errors like the 
following error:

TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
        at mx.managers::SystemManager/get 
toolTipChildren()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1178]
        at 
mx.charts.chartClasses::ChartBase/updateDataTipToMatchHitSet()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\ChartBase.as:3030]


Does anyone have any clue what is going on??????  Thanks,

Jim



!!!!!!!!!! snippet where swf is loaded !!!!!!!!!!!!

                        ......
                        var loader:SWFLoader = null;
                        if (content.contentType == ContentData.SWF)
                        {
                                var uri:String = content.contentUri;

                                var loaderContext:LoaderContext = new 
LoaderContext();
                                loaderContext.applicationDomain = 
ApplicationDomain.currentDomain;
                                loaderContext.securityDomain = 
SecurityDomain.currentDomain;

                                /* Create the swf loader and add it as a child 
to a canvas
                                 * so that it will have a place to display on 
the display list
                                 */
                                loader = new SWFLoader();
                                loader.scaleContent = true;
                                loader.loaderContext = loaderContext;
                                loader.addEventListener(Event.COMPLETE, 
onLoadingComplete);
                                loader.addEventListener(IOErrorEvent.IO_ERROR, 
onModuleLoadError);
                                
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onModuleLoadError);
                                loader.load(uri);
                                .....

                private function onLoadingComplete(event:Event):void
                {
                        var swfLoader:SWFLoader = event.currentTarget as 
SWFLoader;
                        if (swfLoader != null && swfLoader.content != null)
                        {
                                        /* Create an annoymous listener that 
dispatches an event when the module is ready to show */
                                        
sm.addEventListener(FlexEvent.APPLICATION_COMPLETE, 
function(flexEvent:FlexEvent):void
                                                {
                                                        var 
cmEvent:ContentManagementEvent = new 
ContentManagementEvent(ContentManagementEvent.CONTENT_READY_TO_SHOW);
                                                        cmEvent.moduleLoader = 
swfLoader;
                                                        // Grab a reference to 
the module application itself
                                                        if 
(flexEvent.currentTarget.application is IModule)
                                                        {
                                                                
cmEvent.moduleApp = flexEvent.currentTarget.application as IModule;
                                                        }
                                                        dispatch(cmEvent);

                                                });
                                }
                        }
                }
                
!!!!!!!!!! snippet when adding to Canvas !!!!!!!!!!!!
                
                        if (event.moduleApp != null)
                        {
                                Logger.debug("Setting parentInjector and 
starting the RL context for :" + moduleId);
                                
                                // Make sure the content fills the page
                                var subAppComponent:SubAppBase = 
SubAppBase(subApp);                            
                                subAppComponent.percentHeight = 100;
                                subAppComponent.percentWidth = 100;
                                
                                /* Add to contentViewStack here based upon 
position
                                   Simply add as a child to the stub canvas 
that already
                                   exists for the module
                                 */
                                var index:int = _moduleArray.getItemIndex(swf);
                                var canvas:Canvas = 
Canvas(contentViewStack.getChildAt(index));
                                
                                canvas.addChild(subAppComponent);
                        }

Reply via email to