It's usually a good idea to put initializations behind a ADDED_TO_STAGE interrupt to ensure that stage et al is setup properly before using it. I've had intermittent bugs before adding this to my swf:s - in particular when using them in a widget container à la ClearSpring.
Please consider the following patch:
- Code: Select all
--- main.as.org 2008-12-10 20:33:05.453125000 +0100
+++ main.as 2008-12-10 20:41:09.906250000 +0100
@@ -70,7 +70,13 @@
private var id:String;
private var chart_parameters:Object;
- public function main() {
+ public function main():void {
+ addEventListener(Event.ADDED_TO_STAGE, main2);
+ }
+
+ public function main2(evt:Event):void {
+ removeEventListener(Event.ADDED_TO_STAGE, main2);
+
chart_parameters = LoaderInfo(this.loaderInfo).parameters;
var loading:String = ( this.chart_parameters['loading'] ) ? this.chart_parameters['loading'] : 'Loading data...';
Best regards,
Marcus
