Dan, I'd set the components dataprovider to an XML variable, and initialise that variable as either empty or whatever the minimum xml information needs to be to prevent the component getting upset about null values. make that variable bindable. Then, when you get the http service results, convert that to xml and put it into the variable that the component is bound to, the binding should result in the component updating. If binding isn't working (for whatever reason), then just reset the dataprovider to the new xml from the http result (and think about binding later if you have to). Hopefully that should get you started on something that works, at least.
-----Original Message----- From: [email protected] on behalf of Dan Vega Sent: Fri 15/02/2008 20:55 To: [email protected] Subject: Re: [flexcoders] Flex Book Rob, Great tip on using http instead of xml. The problem I am having now is I think the component is trying to load before the service is completed. I don't think the dataSet is filled when the component is setting up. I tried to create the component in AS but it would not let me. Any help is appreciated, I am racking my brain over this. Dan [SWF] /********/bin-debug/********.swf - 925,285 bytes after decompression TypeError: Error #1009: Cannot access a property or method of a null object reference. at ********/loadContent()[C:\Program Files\Apache\htdocs********\src\********.mxml:62] at ********/__book_turnEnd()[C:\Program Files\Apache\htdocs\********\src\********.mxml:85] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent ()[E:\dev\flex_3_beta3\sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:9041] at qs.controls::FlexBook/dispatchEventForPage()[C:\Program Files\Apache\htdocs\********\src\qs\controls\FlexBook.as:733] at qs.controls::FlexBook/commitProperties()[C:\Program Files\Apache\htdocs\********\src\qs\controls\FlexBook.as:777] at mx.core::UIComponent/validateProperties ()[E:\dev\flex_3_beta3\sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:5660] at mx.managers::LayoutManager/validateProperties ()[E:\dev\flex_3_beta3\sdk\frameworks\projects\framework\src\mx\managers\LayoutManager.as:517] at mx.managers::LayoutManager/doPhasedInstantiation ()[E:\dev\flex_3_beta3\sdk\frameworks\projects\framework\src\mx\managers\LayoutManager.as:637] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2 ()[E:\dev\flex_3_beta3\sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:8450] at mx.core::UIComponent/callLaterDispatcher ()[E:\dev\flex_3_beta3\sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:8393] here is my code <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:l="*" layout="absolute" xmlns:controls="qs.controls.*" creationComplete="initApp();" xmlns:containers="qs.containers.*" xmlns:effects="qs.effects.*" width="720" height="430"> <mx:Style> FlexBook { color: #000000; textRollOverColor: #000000; border-thickness: 0; border-style: none; page-slope: .6; active-grab-area: page; page-shadow-strength: 1; curve-shadow-strength: 1; auto-turn-duration: 1500; } Application { color: #F1F1CC; textRollOverColor: #000; backgroundColor: #ffffff; } SuperImage { border-thickness: 0; border-style: none; } </mx:Style> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import qs.caching.ContentCache; import qs.controls.flexBookClasses.FlexBookEvent; import mx.core.UIComponent; //variables private var loader:URLLoader; private function initApp():void { dataSet.send(); dataSet.addEventListener(ResultEvent.RESULT,onResult); } private function onResult(e:Event):void { var thumbs:XMLList = [EMAIL PROTECTED]; for(var i:int =0;i<thumbs.length();i++) { ContentCache.getCache().preloadContent(thumbs[i]); } } private function loadContent(event:FlexBookEvent):void { var page:ImagePage = ImagePage(event.renderer); page.load(); } private function next():void { if(book.currentPageIndex+1 < book.pageCount) book.turnToPage(book.currentPageIndex + 1); } private function previous():void { if(book.currentPageIndex > 0) book.turnToPage(book.currentPageIndex -12); } ]]> </mx:Script> <mx:HTTPService id="dataSet" url="data/images.xml" resultFormat="e4x" /> <controls:FlexBook id="book" width="720" height="430" horizontalCenter="0" backgroundColor="#000000" animateCurrentPageIndex="true" showCornerTease="true" edgeAndCornerSize="150" itemRenderer="ImagePage" content="{dataSet.lastResult..image}" turnStart="loadContent(event)" animatePagesOnTurn="true" turnEnd="loadContent(event)" /> </mx:Application> ______________________________________________________________________ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. ______________________________________________________________________
<<winmail.dat>>

