PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: justSteve on February 24, 2008, 06:26:37



Title: Where'd my argument go?
Post by: justSteve on February 24, 2008, 06:26:37
Very likely, this issue isn't caused by the framework itself but it strikes me as quite strange and Flexcoders hasn't pickup on it.

I've refactored the sample Book App that David Deraedt has posted at: http://www.dehats.com/drupal/?q=node/26. My version sits at http://67.99.17.218/weborb30/CampusWO/Campus4.html?debug=true

The problem is the detail view is never passed a populated current slide - something that should happen at the 'change' event of the datagrid:

       <mx:DataGrid
               selectedItem="{selectedSlide}"
               change="selectSlide(event.target.selectedItem as Slide)"
               dataProvider="{slides}" >

Placing a breakpoint on the change property and observing the
event.target.selectedItem value shows the event is carrying the
expected info. But when execution reaches the handler:

       public var selectedSlide:Slide;
       private function selectSlide(pSlide:Slide):void
       {
               selectedSlide = pSlide ;  // pSlide is now null.
               dispatchEvent(new Event(SELECT, true));
       }

the param is null. If I remove the explicit cast to 'Slide' when calling the handler and change the signature to 'Object' ... again null.

Changing event.target.selectedItem as Slide to event.target.selectedItem.myIdentity   & the handler's signature to accept a Number _will pass the expected value.

Why no compile _or runtime error? I find that if I intentionally misspell the dataField property of one of the DG's columns, that column comes up blank but others render as expected and, again, no error reported.

Is it possible the framework is somehow masking something that prevents an error condition from bubbling high enough?

What could cause the value of 'selectedItem' to show as valid at the point that the event Handler is called but 'null' when that function is hit?

thx