Simplify your code by using the <mx:XML> tag and set it's source property to
the path to your XML.

<mx:XML id="myXML" source="data/images.xml"/>

Your xml might look like:
<images>
<image thumb="assets/thumb1.jpg"/>
...

Then reference it as myXML.image.thumb.

HTH

Rob

On Fri, Feb 15, 2008 at 9:31 AM, Dan Vega <[EMAIL PROTECTED]> wrote:

>   I downloaded a great component from http://www.quietlyscheming.com/blog/and 
> I am trying to customize it and I am coming across a problem. The
> example uses
> <mx:XML and if understand that is acompile time tag. I want to load the
> xml at runtime so I changed the code. Here is my code and this is the error
> I keep getting. Does anyone
> know what I am doing wrong?
>
> ERROR
> [SWF] /*****/bin-debug/ElginAds.swf - 765,388 bytes after decompression
> TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
>     at qs.controls::FlexBook/fillPage()[C:\Program
> Files\Apache\htdocs\*****\src\qs\controls\FlexBook.as:656]
>     at qs.controls::FlexBook/commitProperties()[C:\Program
> Files\Apache\htdocs\*****\src\qs\controls\FlexBook.as:771]
>     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]
>
>
>
>
> <?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[
>             //imports
>             import qs.caching.ContentCache;
>             import qs.controls.flexBookClasses.FlexBookEvent;
>             import mx.core.UIComponent;
>
>             //bindable variables
>             [Bindable]
>             private var dataSet:XMLList;
>
>             //variables
>             private var loader:URLLoader;
>
>             private function initApp():void    {
>                 loader = new URLLoader();
>                 loader.addEventListener(Event.COMPLETE,onComplete);
>                 loader.load(new URLRequest('data/images.xml'));
>             }
>             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);
>             }
>
>             private function onComplete(e:Event):void {
>                 var xml:XML = new XML(e.target.data);
>                 var thumbs:XMLList = [EMAIL PROTECTED];
>                 dataSet = xml..image;
>             }
>             private function loadContent(event:FlexBookEvent):void {
>                 var page:ImagePage = ImagePage(event.renderer);
>                 page.load();
>             }
>         ]]>
>     </mx:Script>
>
>     <controls:FlexBook id="book" y="47" width="600" top="40" height="400"
> horizontalCenter="0"
>         animateCurrentPageIndex="true"
>         showCornerTease="true"
>         edgeAndCornerSize="150"
>         itemRenderer="ImagePage"
>         content="{dataSet}"
>         turnStart="loadContent(event)"
>         animatePagesOnTurn="true"
>         turnEnd="loadContent(event)"
>         />
>
> </mx:Application>
>
>
> --
> Thank You
> Dan Vega
> [EMAIL PROTECTED]
> http://www.danvega.org
>  
>



-- 
-- 
Regards,
Rob Rusher

Adobe Certified AIR, Connect, ColdFusion MX and Flex Instructor
m: 303-885-7044
im: robrusher

Reply via email to