Alex, Thanks for your help! Using mduleFactory.create() worked.
Jeff From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Alex Harui Sent: Friday, December 02, 2011 2:26 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] RE: AIR/Window/DataGrid Issue Basic implementations should be able to use MXML. For example, you cram a bunch of MXML in a <mx:Module> and load that in an <mx:ModuleLoader> and it just works. But it gets trickier when using popups. Usually you have to call PopUpManager from AS anyway and you can choose the moduleFactory to pass in. Is the Window and DataGrid in one MXML file? Maybe instead of calling "new MyWindow()" you can use moduleFactory.create("some.package.MyWindow") and that will get things going in the right direction. I suspect the DataGroups worked because they don't have skins or the skins were in the main app. The DataGrid's styles are probably in the same module SWF as the DataGrid. The problem is that if the DataGrid's moduleFactory is pointing at the main app, it won't find the styles in there. The DataGrid is probably picking up its moduleFactory from its parents. -Alex On 12/2/11 4:00 AM, "Battershall, Jeff" <jeff.battersh...@djindexes.com> wrote: Thanks Alex, It's pretty clear I'm pushing the envelope architecture-wise - I've got a module that opens a popup that opens a window that contains a datagrid. Interestingly though, in my Flex 4.0 version, where I wasn't using a Spark datagrid but instead using my solution using DataGroups (spark datagrid wasn't yet available) I had no issues. Note the first error I get is from that the DataGrid skin cannot be found. Makes me wonder whether it's the styles that are not loaded. I&! #8217;m going to try to get my wits around using moduleFactory. It appears that in order to use it I cannot use MXML but instead using AS? Jeff From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Alex Harui Sent: Thursday, December 01, 2011 5:05 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] RE: AIR/Window/DataGrid Issue That's a very! puzzling stack trace. I have no idea how you can get in! to this situation. Do you have a simple test case? The moduleFactory subsystem relies on instantiating classes in a module via moduleInfo.factory.create(). The children of that class have moduleFactory propagated to them as they are added to their parents. Calling some function on a module that calls PopUpManager.createPopUp() bypasses the subsystem because the popup is added to the systemManager and some class that has its moduleFactory set to the right place. Is that what is going on in your code? There is a moduleFactory parameter to createPopUp you can use. On 12/1/11 10:06 AM, "Battershall, Jeff" <jeff.battersh...@djindexes.com> wrote: Thanks Alex, Here's the stack trace: TypeError: Error #1009: Cannot access a property or method of a null object reference. at spark.components::Group/addElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1342] at spark.components.gridClasses::GridLayout/createTypicalItemRenderer()[E:\dev\4.y\fr! ameworks\projects\spark\src\spark\components\gridClasses\GridLayout.as:748] at spark.components.gridClasses::GridLayout/updateTypicalCellSizes()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\gridClasses\GridLayout.as:883] at spark.components.gridClasses::GridLayout/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\gridClasses\GridLayout.as:444] at spark.components.supportClasses::GroupBase/measure()[E:\dev\4.y\framew! orks\projects\spark\src\spark\components\supportClasses\GroupB! ase.as:1 148] at mx.core::UIComponent! /http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E<http://www.adobe.com/2006/flex/mx/internal::measureSizes()%5bE>: <http://www.adobe.com/2006/flex/mx/internal::measureSizes()%5bE:> ! \dev\4.y \frameworks\projects\framework\src\mx\core\UIComponent.as:8506] at mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8430] at spark.components::Group/validateSize()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1012] at mx.managers::LayoutManager/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:665] at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:816] &! nbsp; at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180] The app is constructed like so: 1) Shell application 2) Modules loaded at runtime 3) The module in question has a pop up wizard (TitleWindow). 4) The popup wizard opens Window. 5) Window contains DataGrid. I! don't understand how the module factory for the datagrid points to the module factory for the module. How's that accomplished? Jeff From: flexcoders@yahoogroups.com [mailto:flexcoders@yaho! ogroups. com] On Behalf Of Alex Harui Sent: Thursday, December 01, 2011 12:51 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] RE: AIR/Window/! DataGrid Issue &n bsp; What is the Group stack trace? If classes are in a module you definitely have to get the moduleFactory pointing to that module because that's probably where the skins are as well. On 12/1/11 5:06 AM, "Battershall, Jeff" <jeff.battersh...@djindexes.com> wrote: My issue sounds similar to this issue: http://forums.adobe.com/message/3910406 What's unclear to me is how to work around it in my circumstance. Clearly I shou! ld be able to declare a datagrid in a Window and have it work without an elaborate workaround. Any advice appreciated. Jeff From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Battershall, Jeff Sent: Wednesday, November 30, 2011 8:58 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] AIR/Window/DataGrid Issue Hi, I'm mid re-factoring a SDK 4.0 AIR app to 4.5 and attempting to take advantage of the Spark DataGrid. In this app (which is built with modules) I'm openin! g a NativeWindow and displaying a datagrid. The fi! rst erro r is that the ! DataGrid Skin class cannot be found. I dealt with this b! y creati ng a new Skin ! from the DataGrid and referencing that. Then when I atte! mpt to p opulate the grid with data, I get RTEs pointing to Group.as with error #1009 null. I can get in to more exhaustive detail about the exact error(s) but I think something more fundamental is happening. Note that the libs are all merged into code. It seems that some of the underlying libraries aren' being included. Does anyone have any experience or theories on what might be happening? ____________________________ Jeff Battersh! all Application Architect T 609 520 5637 F 609 520 5370 C 732 666-8205 jeff.battersh...@djindexes.com Dow Jones Indexes 4300 Route 1 North South Brunswick, NJ 08852 www.djindex! es.com <http://www.cmegroup.com/> &nb! sp;< /p> -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
<<inline: image001.jpg>>