1 Reply Latest reply on Jul 15, 2011 4:28 PM by Flex harUI

    focusManager error on child swf datagrid editedItemPosition - for Alex?

    stickamw Level 1

      Hi Guys,

       

           I have one that is cousin a problem others have seen but one that I've not seen an answer to.  I have a main swf jump page that provides a user with a menu of apps to choose from to run.  The user clicks on an item and I'm simply using a URLRequest and Loader to load that app (a separate swf) to the stage:

                   case 'wrapup':
                      loadSWF("wrapupCodeMgmt.swf");
                      break;

                  .

                  .

                  .

       

                  private var myrequest:URLRequest = new URLRequest();
                  private var myloader:Loader = new Loader();
                 
                  private function loadSWF(path:String):void
                  {
                      myrequest = new URLRequest(path);
                      myloader = new Loader();
                      myloader.load(myrequest);
                     
                      myloader.contentLoaderInfo.addEventListener(Event. COMPLETE, movieLoaded);
                  }
                 
                  private function movieLoaded(event:Event):void
                  {
                      stage.addChild(myloader);
                  }

       

      Within the app is a datagrid that the user can add rows to via an "add" button.  I'm adding the row at 0, scrolling to 0 and setting the editedItemPosition on the dataGrid to column 1, row 0.

       

      When I run the arrangement as abover (i.e. parent swf runs child swf) I'm getting an error on the focusManager for the item editor.


      TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at mx.controls::DataGrid/itemEditorItemEditBeginHandler()[E:\dev\4.0.0\frameworks\projects\f ramework\src\mx\controls\DataGrid.as:5257]

       

      I look at the debugger and sure enough, the focusManager is null.

       

                  var fm:IFocusManager = focusManager;
                  // trace("setting focus to item editor");
                  if (itemEditorInstance is IFocusManagerComponent)
                      fm.setFocus(IFocusManagerComponent(itemEditorInstance));  <------------ this line blows as fm == null;

       

      Two items:

       

           1.)  I'm using spark groups in my child app with an extended mx datagrid (extended the mx:dataGrid to put in filterable columns).

           2.)  This only blows up with the parent running the child setup.  When I run the child stand alone, it works great.

           2.)  I've researched and have seen a number of people having issues with the IFocusManagerContainer on popups with datagrids.  However, I'm not using a popup here and don't know how I can force this.

       

      Any help would greatly be appreciated here...am on a bit of a time crunch.

       

      Thanks,

      Adrian