I'm running into an issue where I have a SWF created in Flash that adjusts its size according to parameters using Stage.scaleMode = StageScaleMode.NO_SCALE and Stage.align = StageAlign.TOP_LEFT, but for some reason the reference to this.stage is lost when its loaded into Flex. In Flex, I receive an error for Cannot access property or method of a null object reference. Is there some conflict with this.stage inside of Flex?
Make sure you are accessing this.stage property late enough during the initialization of your application.
For instance, if you've got an application event trigger a call to an init() function, make sure the trigger is applicationComplete and not creationComplete.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
In order to access an application's stage property, to add an event listener for instance, you'll need to make use of the applicationComplete event. This event is triggered a little later in the application initialization process.
Let me know if that does/not help.
Thanks Ben. That was pretty much the issue. Because I need to access this information inside a Flash swf, I used this instead:
Then, I was running into an issue because the Flash swf was using the dimensions of the full Flex application rather than the SWFLoader object itself. Is there a way to make the Flash piece target the SWFLoader as its "stage"?