Well the component needs the data from the httpservice so somehow i need to
call the component when the service is completed.

Dan

On Fri, Feb 15, 2008 at 4:34 PM, Phil Krasko <[EMAIL PROTECTED]> wrote:

> CreationComplete on component call the httpservice
>
>
> Sent via BlackBerry from T-Mobile
>
> -----Original Message-----
> From: "Dan Vega" <[EMAIL PROTECTED]>
>
> Date: Fri, 15 Feb 2008 15:55:24
> 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. <
> http://www.adobe.com/2006/mxml> 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>
>
>
>
>
> --
> 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
>
>
>
>


-- 
Thank You
Dan Vega
[EMAIL PROTECTED]
http://www.danvega.org

Reply via email to