Thanks for that. executeBindings() didn't work though, it just didn't
seem to fire the event. :-(
My original mail below has me doing:
> > 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));
> > }
> > }
which I think is the same as your other suggestion. This gives me a
null error.
Any more ideas appreciated, or is this a bug?
ta,
Tim.
--- In [email protected], Carolyn Cole <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I know this may not be the "right" way, but you can call
> myCategories.executeBindings()
> or
> I found if I made a new Object added the data to that and then set the
> bound object to that:
> var tmpArray = new ArrayCollection();
> var lResults : ArrayCollection = new
> ArrayCollection(event.result);
> var lIndex:int;
> for (lIndex = 0; lIndex < lResults.length; lIndex++)
> {
> tmpArray.addItem(lResults.getItemAt(lIndex));
> }
> tabsDataProvider = tmpArray;
> I'm not sure if the above will work some times it did, other times I
had to
> call executeBindings.
>
> -- Carolyn
>
> At 11:24 AM 3/8/2006, you wrote:
> >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" <lists@> 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]>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]>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>http://www.macromedia.com/2005/flex/mx/internal::d
> > > > ispatchRpcEvent()
> > > > at
> > > >
> > >
>
>mx.rpc::AbstractInvoker/<http://www.macromedia.com/2005/flex/mx/internal::res>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>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>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > > Search Archives:
> > >
> >
<http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www.mail-archive.com/flexcoders%40yahoogroups.com
> >
> > > > Yahoo! Groups Links
> > > >
> > >
> >
> >
> >
> >
> >
> >
> >--
> >Flexcoders Mailing List
> >FAQ:
>
><http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> >Search Archives:
>
><http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www.mail-archive.com/flexcoders%40yahoogroups.com
> >
> >
> >
> >
> >SPONSORED LINKS
>
><http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ>Web
> >site design development
>
><http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw>Computer
> >software development
>
><http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ>Software
> >design and development
>
><http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZI36cYzBjw>Macromedia
> >flex
>
><http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw>Software
> >development best practice
> >
> >
> >----------
> >YAHOO! GROUPS LINKS
> >
> > * Visit your group
> > "<http://groups.yahoo.com/group/flexcoders>flexcoders" on the web.
> > *
> > * To unsubscribe from this group, send an email to:
> > *
> >
<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
> >
> > *
> > * Your use of Yahoo! Groups is subject to the
> > <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
> >
> >
> >----------
>
--
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/