4 Replies Latest reply on Oct 23, 2008 3:15 AM by ridgeback1105

    problems in tilelist dataprovider

    ridgeback1105
      Hi,

      I'm newbie in flex. I have a problem in tilelist. How can i call the child node of the xml file? I'm having "ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
      at flash.display::DisplayObjectContainer/getChildIndex()
      at mx.managers::SystemManager/getChildIndex()
      at mx.managers::SystemManager/::mouseDownHandler()".

      Please help me. Thanks in advance. Here's my code:

      index.mxml


        • 1. Re: problems in tilelist dataprovider
          ntsiii Level 3
          Sorry, that is too much code for me to wade through. Try posting the relevant parts

          Which line is raising the exception?

          Tracy
          • 2. Re: problems in tilelist dataprovider
            ridgeback1105 Level 1
            Hi Tracy,

            Sorry for that. The problem is when i call
            • 3. Re: problems in tilelist dataprovider
              ridgeback1105 Level 1
              Hi Tracy,

              Sorry for that. The problem is when i call the cfilmstrip.dataProvider = imageXML.image[imgPosition].subcat; I got an error ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
              at flash.display::DisplayObjectContainer/getChildIndex()
              at mx.managers::SystemManager/getChildIndex()
              at mx.managers::SystemManager/::mouseDownHandler()
              when the browser has flash debugger.

              Here are the involved modules for your reference:

              index.mxml
              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:tx="com.adobe.as3.tilex.*" layout="absolute" usePreloader="true" creationComplete="loadXML(event);" width="808" height="388" backgroundColor="#ffffff" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundGradientColors="[#ffffff, #ffffff]">
              <mx:Script>
              <![CDATA[
              import mx.events.FlexEvent;
              import mx.controls.Alert;
              import flash.net.*;
              import mx.effects.easing.*;
              import mx.events.ListEvent;
              private var imgPosition:int = 0;
              private var imageLoader:URLLoader = new URLLoader();
              private var imageXML:XML;

              private var timer:Timer;
              private var samplePosition:int = 0;
              [Bindable]
              public var selcamp:int;

              private function loadXML(e:FlexEvent):void {
              imageLoader.addEventListener(Event.COMPLETE, processImageXML);
              imageLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
              imageLoader.load(new URLRequest("xml/xml_productlines.xml"));

              }

              private function ioErrorListener(event:IOErrorEvent):void {
              Alert.show( event.text );
              }

              private function processImageXML(e:Event):void {
              imageXML = new XML(e.target.data);
              filmstrip.dataProvider = imageXML.image;
              filmstrip.columnCount = imageXML.image.length();
              loadImage();

              }

              private function loadImage():void {

              banner.visible = false;
              banner.source = imageXML.image[imgPosition].@filename;

              banner.visible = true;
              cfilmstrip.dataProvider = imageXML.image[imgPosition].subcat;

              }//end loadImage


              private function pickme(imgpick:Number):void
              {
              imgPosition = imgpick ;
              loadImage();
              }

              ]]>
              </mx:Script>

              <mx:Sequence id="slideBan">
              <mx:Move xTo="940" duration="2" target="{CampCanvas}" />
              <mx:Fade alphaFrom="0.0" alphaTo="1.0" target="{banner}" duration="1000" />
              <mx:Parallel>
              <mx:Move xFrom="940" xTo="604" duration="900" target="{CampCanvas}" />
              <mx:Fade alphaFrom="0.3" alphaTo="1" target="{CampCanvas}" duration="900" />
              <mx:Blur duration="900" target="{CampCanvas}"
              blurXFrom="3.0" blurXTo="0.0"
              blurYFrom="3.0" blurYTo="0.0"/>
              </mx:Parallel>
              </mx:Sequence>

              <mx:Canvas horizontalCenter="0" y="0" width="808" height="388" horizontalScrollPolicy="off" verticalScrollPolicy="off" id="canvas1">
              <mx:Image id="banner" y="0" width="808" height="388" maxWidth="920" maxHeight="390" showEffect="slideBan" maintainAspectRatio="false" horizontalCenter="0"/>
              <mx:Canvas backgroundAlpha="0.3" id="CampCanvas" x="807" y="13" width="170" height="188" cornerRadius="12" backgroundImage="@Embed('image/Banners.png')" borderStyle="solid" borderThickness="0" verticalScrollPolicy="off" horizontalScrollPolicy="off">

              <tx:TileListEx id="cfilmstrip" itemRenderer="catRenderer" height="86" verticalScrollPolicy="off" backgroundAlpha="0"
              borderStyle="none" columnCount="1" columnWidth="150" rowHeight="25" useRollOver="false" y="15" x="10">

              </tx:TileListEx>

              </mx:Canvas>

              <mx:Canvas y="288" width="808" backgroundAlpha="0" height="100" borderStyle="solid" borderThickness="0" cornerRadius="6" verticalScrollPolicy="off" horizontalScrollPolicy="off" horizontalCenter="0">

              <tx:TileListEx id="filmstrip" itemRenderer="filmRenderer" height="86" verticalScrollPolicy="off" backgroundAlpha="0"
              rowCount="1" borderStyle="none" columnWidth="203" rowHeight="86" useRollOver="false" itemClick="pickme(filmstrip.selectedIndex)" y="-1">

              </tx:TileListEx>

              </mx:Canvas>

              </mx:Canvas>
              </mx:Application>


              catRenderer.mxml
              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="170" height="188" backgroundAlpha="0" xmlns:tx="com.adobe.as3.tilex.*">

              <mx:Canvas width="150" height="50" y="0" backgroundColor="#FFFFFF" borderStyle="solid" backgroundAlpha="1" useHandCursor="true" buttonMode="true" mouseChildren="false">
              <mx:Label visible="true" text="{data.@cats}" fontSize="11" y="0" color="#800000" fontWeight="bold"/>
              </mx:Canvas>

              </mx:Application>


              xml_productlines.xml
              <?xml version="1.0" encoding="utf-8"?>
              <gallery>
              <image filename="xml/images/SAILING.jpg" film="xml/images/sailing_gear.gif" category="SAILING GEAR">
              <subcat cats="MAN1"/>
              <subcat cats="MAN1"/>
              <subcat cats="MAN1"/>
              </image>

              <image filename="xml/images/SPORTS.jpg" film="xml/images/sportswear.gif" category="SPORTS WEAR">
              <subcat cats="MAN2"/>
              <subcat cats="MAN2"/>
              <subcat cats="MAN2"/>
              </image>

              <image filename="xml/images/GOLF.jpg" film="xml/images/golf.gif" category="GOLF">
              <subcat cats="MAN3"/>
              <subcat cats="MAN3"/>
              <subcat cats="MAN3"/>
              </image>

              <image filename="xml/images/REGATTA.jpg" film="xml/images/regatto.gif" category="REGATTA">
              <subcat cats="MAN4"/>
              <subcat cats="MAN4"/>
              <subcat cats="MAN4"/>
              </image>

              </gallery>

              Hope you can help me. Thanks in advance.
              • 4. Re: problems in tilelist dataprovider
                ridgeback1105 Level 1
                Hi Tracy,

                I've notice that the problem is in the dataprovider. Because I have two tilelist but have the same dataprovider. What I want is when I select one image to the tilelist with the id filmstrip, I want the tilelist with id cfilmstrip to get the subcat of the selected image. Please help. Thanks in advance.