Interesting.

This code:

      tabsDataProvider = new ArrayCollection(event.result);
      var lCollectionEvent : CollectionEvent = new CollectionEvent();
      lCollectionEvent.kind = CollectionEventKind.REFRESH;
      tabsDataProvider.dispatchEvent(lCollectionEvent);

causes the same 

TypeError: Error #1009: null has no properties.
        at mx.core::Repeater/mx.core:Repeater::getIndexForFirstChild()
        at mx.core::Repeater/mx.core:Repeater::recreate()
        at mx.core::Repeater/mx.core:Repeater::execute()
        at mx.core::Repeater/mx.core:Repeater::sort()
        at mx.core::Repeater/mx.core:Repeater::collectionChangedHandler()

as before.

Tim.

--- In [email protected], "Tim Sawyer" <[EMAIL PROTECTED]> wrote:
>
> Good plan, but I think I need to be more specific with the event.  I get
> 
> Error: Repeater.collectionChangedHandler: unhandled collectionEvent
> kind, 500
>       at
>
mx.core::Repeater/mx.core:Repeater::collectionChangedHandler()[C:\dev\beta1\sdk\frameworks\mx\core\Repeater.as:1000]
>       at flash.events::EventDispatcher/dispatchEvent()
>       at
>
mx.collections::ListCollectionView/dispatchEvent()[C:\dev\beta1\sdk\frameworks\mx\collections\ListCollectionView.as:701]
>       at
>
components::DashBoardTabList/components:DashBoardTabList::populateCategoryList()[C:\dev\HEAD\PRODUCT\websites\MisDashboard\dev\components\DashBoardTabList.mxml:27]
>       at
>
()[C:\dev\HEAD\PRODUCT\websites\MisDashboard\dev\services\category\FetchCategoryList.as:24]
>       at flash.events::EventDispatcher/dispatchEvent()
>       at
>
mx.rpc::AbstractService/dispatchEvent()[C:\dev\enterprise_beta1\frameworks\mx\rpc\AbstractService.as:144]
>       at
>
mx.rpc::AbstractOperation/http://www.macromedia.com/2005/flex/mx/internal::dispatchRpcEvent()[C:\dev\enterprise_beta1\frameworks\mx\rpc\AbstractOperation.as:162]
>       at
>
mx.rpc::AbstractInvoker/http://www.macromedia.com/2005/flex/mx/internal::resultHandler()[C:\dev\enterprise_beta1\frameworks\mx\rpc\AbstractInvoker.as:175]
>       at flash.events::EventDispatcher/dispatchEvent()
>       at
>
mx.rpc::Producer/acknowledge()[C:\dev\enterprise_beta1\frameworks\mx\rpc\Producer.as:69]
>       at
>
C:\dev\enterprise_beta1\frameworks\libs\framework.swc(mx/validators/Validator)$132::DirectHTTPMessageResponder/completeHandler()[C:\dev\enterprise_beta1\frameworks\mx\messaging\channels\DirectHTTPChannel.as:277]
>       at flash.events::EventDispatcher/dispatchEvent()
>       at flash.net::URLLoader/flash.net:URLLoader::onComplete()
> 
> Tim.
> 
> --- In [email protected], "Geoffrey Williams" <yahoo@> wrote:
> >
> > Try:
> > 
> > tabsDataProvider = new ArrayCollection(event.result);
> > tabsDataProvider.dispatchEvent (new CollectionEvent ());
> > 
> > -----Original Message-----
> > From: [email protected]
[mailto:[EMAIL PROTECTED] On
> > Behalf Of Tim Sawyer
> > Sent: Wednesday, March 08, 2006 7:25 AM
> > To: [email protected]
> > Subject: [flexcoders] Repeater and Web Services (Flex 2b1)
> > 
> > I'm having a problem trying to get a set of tabs generated from a web
> > service.  Full code for my component is pasted at the end of the
> message.
> > 
> > The problem is down to getting the results from the web service and
> > getting the tabs to rebuild from that list.
> > 
> > If I do:
> > 
> > tabsDataProvider = new ArrayCollection(event.result);
> > 
> > then the tabs aren't rebuilt, presumably because the Repeater doesn't
> > notice the list has changed.
> > 
> > If I add individual objects to the tabsDataProvider, which is an
> > ArrayCollection, using a for loop (see code later) then the event does
> > fire as expected and I get a runtime error:
> > 
> > TypeError: Error #1009: null has no properties.
> >     at mx.core::Repeater/mx.core:Repeater::getIndexForFirstChild()
> >     at mx.core::Repeater/mx.core:Repeater::recreate()
> >     at mx.core::Repeater/mx.core:Repeater::execute()
> >     at mx.core::Repeater/mx.core:Repeater::collectionChangedHandler()
> >     at flash.events::EventDispatcher/dispatchEvent()
> >     at mx.collections::ListCollectionView/dispatchEvent()
> >     at
> >
>
mx.collections::ListCollectionView/mx.collections:ListCollectionView::addIte
> > msToView()
> >     at
> >
>
mx.collections::ListCollectionView/mx.collections:ListCollectionView::listCh
> > angeHandler()
> >     at flash.events::EventDispatcher/dispatchEvent()
> >     at
> >
>
mx.collections::ArrayList/mx.collections:ArrayList::internalDispatchEvent()
> >     at mx.collections::ArrayList/addItemAt()
> >     at mx.collections::ListCollectionView/addItemAt()
> >     at mx.collections::ListCollectionView/addItem()
> >     at
> >
>
components::DashBoardTabList/components:DashBoardTabList::populateCategoryLi
> > st()
> >     at MethodInfo-2275()
> >     at flash.events::EventDispatcher/dispatchEvent()
> >     at mx.rpc::AbstractService/dispatchEvent()
> >     at
> >
>
mx.rpc::AbstractOperation/http://www.macromedia.com/2005/flex/mx/internal::d
> > ispatchRpcEvent()
> >     at
> >
>
mx.rpc::AbstractInvoker/http://www.macromedia.com/2005/flex/mx/internal::res
> > ultHandler()
> >     at flash.events::EventDispatcher/dispatchEvent()
> >     at mx.rpc::Producer/acknowledge()
> >     at
> >
>
C:\dev\enterprise_beta1\frameworks\libs\framework.swc(mx/validators/Validato
> > r)$132::DirectHTTPMessageResponder/completeHandler()
> >     at flash.events::EventDispatcher/dispatchEvent()
> >     at flash.net::URLLoader/flash.net:URLLoader::onComplete()
> > 
> > Can someone give me a pointer in the right direction?
> > 
> > ta,
> > 
> > Tim.
> > 
> > Full component code:
> > 
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:HBox xmlns:mx="http://www.macromedia.com/2005/mxml";
> > xmlns:comp="components.*"
initialize="callWebServiceForCategoryList()">
> >   <mx:Script>
> >     <![CDATA[
> >      
> >     import services.category.FetchCategoryList;
> >     import services.category.FetchCategoryListCallParameter;
> >     import mx.rpc.AbstractService;
> >     import mx.collections.ArrayCollection;
> >     import mx.rpc.events.ResultEvent;
> >     [Bindable] public var tabsDataProvider : ArrayCollection = null;
> >   
> >     private function callWebServiceForCategoryList():void
> >     {
> >       var lService : AbstractService = FetchCategoryList.getService();
> >       var lCallParam : FetchCategoryListCallParameter = new
> > FetchCategoryListCallParameter();
> >       lCallParam.SecurityToken = "Blah";
> >       var lCall : Object = lService.FetchCategoryList(lCallParam);
> >       lCall.resultHandler = this.populateCategoryList;
> >     }
> >     
> >     private function populateCategoryList(event : ResultEvent) : void
> >     {
> >       tabsDataProvider = new ArrayCollection();
> >       var lResults : ArrayCollection = new
> ArrayCollection(event.result);
> >       var lIndex:int;
> >       for (lIndex = 0; lIndex < lResults.length; lIndex++)
> >       {
> >         tabsDataProvider.addItem(lResults.getItemAt(lIndex));
> >       }
> >     } 
> >     ]]>
> >   </mx:Script>
> > 
> > 
> >     <mx:TabNavigator width="100%" height="100%" >
> >             <mx:Canvas label="Home" width="100%" height="100%">
> >                     <comp:FrontPage/>
> >             </mx:Canvas>
> >             <mx:Repeater id="myCategories"
> > dataProvider="{tabsDataProvider}"
> > startingIndex="0">
> >               <mx:Canvas label="{myCategories.currentItem.Description}"
> > width="100%" height="100%" >
> >                             <comp:DashBoardPage/>
> >                     </mx:Canvas>
> >             </mx:Repeater>
> >             
> >             <mx:Canvas label="Control Panel" width="100%" height="100%"
> > >
> >                     <comp:AdminFrontPage/>
> >             </mx:Canvas>
> >     </mx:TabNavigator>
> > </mx:HBox>
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> > Yahoo! Groups Links
> >
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to