[flexcoders] Re: Very odd null object RTE on FocusManager

2009-09-15 Thread rob_mcmichael
Hi Alex,

Thanks for the help.

The problem is intermittent, perhaps happening one in three times if I have 
more than three sub applications being loaded in.

I found the bug was related to an MXML component with two states, which is 
being repeated. Only once is the alternate state used (if it's the first item). 
I have therefore removed the state from the repeater, and put it before the 
repeater. This has stopped the problem, but obviously not resolved the RTE from 
potentially happening again somewhere else.

It's interesting what you say about removing the loader. In order to preload 
the sub applications, I add them to a hidden container on the stage momentarily 
to start them loading (If there is a way to do this in AS only please let me 
know). The reference to the sub app swf is still retained for when the user 
chooses to see it, and it is then attached to the stage again. The RTE happens 
when there loading in, so I assume this supports that theory.

This is a section of the MXML component that preloads the swf

...

private function _preLoadSwf(e:PropertyChangeEvent):void
{
if (!e.newValue)
return;

createChildren();
this.preLoader.removeAllChildren(); // Remove the child once 
added 
}

override protected function createChildren():void
{
super.createChildren();

if (this.preLoader  _ds.preloadSwf)
this.preLoader.addChild(SWFLoader(_ds.preloadSwf));
}
]]
/mx:Script

!-- Display Object used for preloading channels --
mx:Canvas id = preLoader
   visible = false/



Obviously this is a bit of a hack to force the swfloader to start loading, but 
I assume it's the cause of the problem.

Please let me know how to report the bug, and I can try and see if I can 
recreate the issue, but it's a bit of a tricky one to recreate ;)

Ta

Rob




RE: [flexcoders] Re: Very odd null object RTE on FocusManager

2009-09-15 Thread Alex Harui
If the bug is caused because you're pulling the object off stage as it gets 
initialized, I don't think we'll spend too much energy on fixing that.  I would 
try to make sure every SWF is really done (sent applicationComplete) or only 
remove the ones that are done.

I'm not sure what you mean by AS-Only way to preload the SWF.  You can add 
SWFLoaders in AS to any container, set its includeInLayout=false and 
visible=false and they should load.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of rob_mcmichael
Sent: Tuesday, September 15, 2009 12:29 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Very odd null object RTE on FocusManager



Hi Alex,

Thanks for the help.

The problem is intermittent, perhaps happening one in three times if I have 
more than three sub applications being loaded in.

I found the bug was related to an MXML component with two states, which is 
being repeated. Only once is the alternate state used (if it's the first item). 
I have therefore removed the state from the repeater, and put it before the 
repeater. This has stopped the problem, but obviously not resolved the RTE from 
potentially happening again somewhere else.

It's interesting what you say about removing the loader. In order to preload 
the sub applications, I add them to a hidden container on the stage momentarily 
to start them loading (If there is a way to do this in AS only please let me 
know). The reference to the sub app swf is still retained for when the user 
chooses to see it, and it is then attached to the stage again. The RTE happens 
when there loading in, so I assume this supports that theory.

This is a section of the MXML component that preloads the swf

...

private function _preLoadSwf(e:PropertyChangeEvent):void
{
if (!e.newValue)
return;

createChildren();
this.preLoader.removeAllChildren(); // Remove the child once added
}

override protected function createChildren():void
{
super.createChildren();

if (this.preLoader  _ds.preloadSwf)
this.preLoader.addChild(SWFLoader(_ds.preloadSwf));
}
]]
/mx:Script

!-- Display Object used for preloading channels --
mx:Canvas id = preLoader
visible = false/



Obviously this is a bit of a hack to force the swfloader to start loading, but 
I assume it's the cause of the problem.

Please let me know how to report the bug, and I can try and see if I can 
recreate the issue, but it's a bit of a tricky one to recreate ;)

Ta

Rob



[flexcoders] Re: Very odd null object RTE on FocusManager

2009-09-15 Thread rob_mcmichael
I think that's fair enough.

As in AS only, I mean do I have to add it to stage? Ideally I would like to say 
swfLoader.startLoading();

I will look for the applicationComplete though, or perhaps load them into the 
view they will eventually be displayed in, and then just show them when 
selected. I am not sure if there will be a performance issue there though. 

Thanks for your help

Rob



--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 If the bug is caused because you're pulling the object off stage as it gets 
 initialized, I don't think we'll spend too much energy on fixing that.  I 
 would try to make sure every SWF is really done (sent applicationComplete) or 
 only remove the ones that are done.
 
 I'm not sure what you mean by AS-Only way to preload the SWF.  You can add 
 SWFLoaders in AS to any container, set its includeInLayout=false and 
 visible=false and they should load.
 
 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.http://www.adobe.com/
 Blog: http://blogs.adobe.com/aharui
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
 Behalf Of rob_mcmichael
 Sent: Tuesday, September 15, 2009 12:29 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Very odd null object RTE on FocusManager
 
 
 
 Hi Alex,
 
 Thanks for the help.
 
 The problem is intermittent, perhaps happening one in three times if I have 
 more than three sub applications being loaded in.
 
 I found the bug was related to an MXML component with two states, which is 
 being repeated. Only once is the alternate state used (if it's the first 
 item). I have therefore removed the state from the repeater, and put it 
 before the repeater. This has stopped the problem, but obviously not resolved 
 the RTE from potentially happening again somewhere else.
 
 It's interesting what you say about removing the loader. In order to preload 
 the sub applications, I add them to a hidden container on the stage 
 momentarily to start them loading (If there is a way to do this in AS only 
 please let me know). The reference to the sub app swf is still retained for 
 when the user chooses to see it, and it is then attached to the stage again. 
 The RTE happens when there loading in, so I assume this supports that theory.
 
 This is a section of the MXML component that preloads the swf
 
 ...
 
 private function _preLoadSwf(e:PropertyChangeEvent):void
 {
 if (!e.newValue)
 return;
 
 createChildren();
 this.preLoader.removeAllChildren(); // Remove the child once added
 }
 
 override protected function createChildren():void
 {
 super.createChildren();
 
 if (this.preLoader  _ds.preloadSwf)
 this.preLoader.addChild(SWFLoader(_ds.preloadSwf));
 }
 ]]
 /mx:Script
 
 !-- Display Object used for preloading channels --
 mx:Canvas id = preLoader
 visible = false/
 
 
 
 Obviously this is a bit of a hack to force the swfloader to start loading, 
 but I assume it's the cause of the problem.
 
 Please let me know how to report the bug, and I can try and see if I can 
 recreate the issue, but it's a bit of a tricky one to recreate ;)
 
 Ta
 
 Rob





RE: [flexcoders] Re: Very odd null object RTE on FocusManager

2009-09-15 Thread Alex Harui
Flex SWFs must be loaded on stage.  I wouldn't even load them up front if you 
don't have to.  Everything costs somewhere.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of rob_mcmichael
Sent: Tuesday, September 15, 2009 1:19 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Very odd null object RTE on FocusManager



I think that's fair enough.

As in AS only, I mean do I have to add it to stage? Ideally I would like to say 
swfLoader.startLoading();

I will look for the applicationComplete though, or perhaps load them into the 
view they will eventually be displayed in, and then just show them when 
selected. I am not sure if there will be a performance issue there though.

Thanks for your help

Rob

--- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Alex 
Harui aha...@... wrote:

 If the bug is caused because you're pulling the object off stage as it gets 
 initialized, I don't think we'll spend too much energy on fixing that. I 
 would try to make sure every SWF is really done (sent applicationComplete) or 
 only remove the ones that are done.

 I'm not sure what you mean by AS-Only way to preload the SWF. You can add 
 SWFLoaders in AS to any container, set its includeInLayout=false and 
 visible=false and they should load.

 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.http://www.adobe.com/
 Blog: http://blogs.adobe.com/aharui

 From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com 
 [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com] On 
 Behalf Of rob_mcmichael
 Sent: Tuesday, September 15, 2009 12:29 PM
 To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com
 Subject: [flexcoders] Re: Very odd null object RTE on FocusManager



 Hi Alex,

 Thanks for the help.

 The problem is intermittent, perhaps happening one in three times if I have 
 more than three sub applications being loaded in.

 I found the bug was related to an MXML component with two states, which is 
 being repeated. Only once is the alternate state used (if it's the first 
 item). I have therefore removed the state from the repeater, and put it 
 before the repeater. This has stopped the problem, but obviously not resolved 
 the RTE from potentially happening again somewhere else.

 It's interesting what you say about removing the loader. In order to preload 
 the sub applications, I add them to a hidden container on the stage 
 momentarily to start them loading (If there is a way to do this in AS only 
 please let me know). The reference to the sub app swf is still retained for 
 when the user chooses to see it, and it is then attached to the stage again. 
 The RTE happens when there loading in, so I assume this supports that theory.

 This is a section of the MXML component that preloads the swf

 ...

 private function _preLoadSwf(e:PropertyChangeEvent):void
 {
 if (!e.newValue)
 return;

 createChildren();
 this.preLoader.removeAllChildren(); // Remove the child once added
 }

 override protected function createChildren():void
 {
 super.createChildren();

 if (this.preLoader  _ds.preloadSwf)
 this.preLoader.addChild(SWFLoader(_ds.preloadSwf));
 }
 ]]
 /mx:Script

 !-- Display Object used for preloading channels --
 mx:Canvas id = preLoader
 visible = false/

 

 Obviously this is a bit of a hack to force the swfloader to start loading, 
 but I assume it's the cause of the problem.

 Please let me know how to report the bug, and I can try and see if I can 
 recreate the issue, but it's a bit of a tricky one to recreate ;)

 Ta

 Rob