Hmmm. Looks like I misspoke. now I get... Type coercion failed. Cannot convert Model.ValueObjects::detaild...@11c0a941 to Model.ValueObjects.DetailData.
What is the difference between a Model.ValueObjects::DetailData and a Model.ValueObjects.DetailData --- In flexcoders@yahoogroups.com, Alex Harui <aha...@...> wrote: > > Could be a compiler bug. If you look at the generated code you might get a > clue (or the actual SWF bytes) > > 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 valdhor > Sent: Thursday, April 30, 2009 9:18 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Why would "as" keyword not work > > > > > > I have a bit of a perplexing problem (With a workaround). > > In a datagrid I have an itemRenderer that sets one column to a linkButton. In > the constructor I have... > > addEventListener(MouseEvent.CLICK, handleLinkClicked); > > I also have a valueObject imported... > > import Model.ValueObjects.DetailData; > > Now, in my eventListener I try to coerce the event.target.data to a > detailData object like so... > > var currentItem:DetailData = event.target.data as DetailData; > > I have confirmed that event.target.data is an object of type > Model.ValueObjects.DetailData. > > If I set a breakpoint here, then currentItem is null. > > If I try... > > var currentItem:* = event.target.data; > > then currentItem is properly populated as a Model.ValueObjects.DetailData > object. > > The only way to get it to work properly is to do... > > var currentItem:DetailData = event.target.data as > Model.ValueObjects.DetailData; > > Also, there is only one class file named DetailData. > > So, why is it that I import the correct class but it fails to coerce unless I > set the full path to the class file? >