Hello,
I have a problem that is not so easy to expose so please bare with me.
I have a Component class written is AS3 which extends the Canvas Class. I then
have a weather component written in mxml that uses as a base the the Component
class. ie my weather component.mxml looks something like this:
<components:Component
xmlns:components="net.zzzzzz.components.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
verticalScrollPolicy="off" horizontalScrollPolicy="off"
preinitialize="onPreInitialize()">
...
...
<script .........>
<mx:HBox id="hbxBackground" width="256" height="120" />
<mx:HBox id="hbxInnerFrame" x="15" y="15" width="226" height="50"/>
<mx:HBox id="hbxBottom" x="15" y="65" width="226" height="40"/>
<mx:HBox id="hbxMiddle" x="15" y="40" width="226" height="40"/>
<mx:Label id="lblLocation" x="15" y="12" width="226"/>
<mx:Image id="meteoImg" x="56" y="63" /> -----> this causes the error !
<mx:Label id="lblTemperature" x="132" y="40" width="100"/>
<mx:Label id="lblDayTitle" x="15" y="78" width="226"/>
</components:Component>
This weather component is compiled into a swf seperatly from my main app.
In my main app I load the weather component definition from the swf with a
loader. I instantiate this weather component (by extracting it's definition
through the loader) and add it to the stage.
When adding it to the stage i get the following error:
TypeError: Error #1009: Cannot access a property or method of a null object
reference.
at
mx.controls::SWFLoader/addedToStageHandler()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1990]
at flash.display::DisplayObjectContainer/addChildAt()
at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$addChildAt()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5083]
at
mx.core::Container/addChildAt()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\Container.as:2215]
at
mx.core::Container/addChild()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\Container.as:2140]
at
mx.core::Container/createComponentFromDescriptor()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\Container.as:3681]
at
mx.core::Container/createComponentsFromDescriptors()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\Container.as:3493]
at
IDSWeather/init()[/Users/bounce/Documents/IdScreen/Components/src/IDSWeather.mxml:375]
This error happens when flex is trying to add the Image component that i
defined in the mxml of the weather component. Specifically this error happens
in SWFLoader in the following function:
private function addedToStageHandler(event:Event):void
{
systemManager.getSandboxRoot().addEventListener(InterManagerRequest.DRAG_MANAGER_REQUEST,
mouseShieldHandler, false, 0, true);
}
Here 'systemManager' is null and i don't understand why.
Any help would be very much appreaciated.
Many thanks,
Bounce.