Problems in tilelist dataprovider

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

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.

Similar Messages

  • Problem in tilelist with dataprovider.

    I have a problem in tilelist. with the dataprovider a get the
    message error
    ArgumentError: Error #2025: The supplied DisplayObject must
    be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    if i delete the images from the last added to the first one i
    have no prob but if i want to delete from the middle i get the
    message error th sode that i use is
    <mx:TileList id="tileList"
    dataProvider="{imgData}"
    columnCount="4"
    columnWidth="222"
    rowCount="2"
    rowHeight="194"
    themeColor="haloSilver"
    verticalScrollPolicy="on"
    x="0" y="415" width="100%">
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox horizontalAlign="center"
    verticalAlign="middle" width="222" height="194"
    verticalScrollPolicy="off" horizontalScrollPolicy="off" >
    <mx:Image id="img" width="165" height="126"
    maintainAspectRatio="true" source="{data.asset}" />
    <mx:Label id="txt" text="{data.title}"/>
    <mx:Button id="del" label="Delete"
    click="outerDocument.deleteSnapShot(event)"/>
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:TileList>
    the function to add the image is :
    public function addImgToTile(bm:Bitmap):void{
    var bm1:BitmapData = Bitmap(bm1_source.content).bitmapData;
    var bitmap:Bitmap = new Bitmap(bm1);
    var vo:MyVOBm = new
    MyVOBm(bitmap,formatTime(inStream.time));
    imgData.addItem(vo);
    And the function to delete the image is:
    public function deleteSnapShot(ev:Event):void{
    imgData.removeItemAt(tileList.selectedIndex);
    tx for your help

    tx Amy for your help here i give you the code that generate
    the image from streaming video
    <mx:Canvas id="videoHBox" horizontalScrollPolicy="off"
    verticalScrollPolicy="off" backgroundColor="#000000" width="456"
    height="284" y="37">
    </mx:Canvas>
    <mx:Button x="464" y="188" label="In" width="48"
    id="btnIn" click="addStart(inStream.time);" enabled="true"
    visible="true" useHandCursor="true" buttonMode="true" toolTip="Add
    Start Image (shotcut Home)"/>
    <mx:Button id="Btn_add_action" x="464" y="221" label="Add
    Screenshot" click="addImgToTile(bm1)" useHandCursor="true"
    buttonMode="true" toolTip="Add Clip (shotcut insert)"/>
    <mx:TileList id="tileList"
    dataProvider="{imgData}"
    columnCount="4"
    columnWidth="222"
    rowCount="2"
    rowHeight="194"
    themeColor="haloSilver"
    verticalScrollPolicy="on"
    x="0" y="415" width="100%">
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox horizontalAlign="center"
    verticalAlign="middle" width="222" height="194"
    verticalScrollPolicy="off" horizontalScrollPolicy="off" >
    <mx:Image id="img" width="165" height="126"
    maintainAspectRatio="true" source="{data.asset}" />
    <mx:Label id="txt" text="{data.title}"/>
    <mx:Button id="del" label="Delete"
    click="outerDocument.deleteSnapShot(event)"/>
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:TileList>
    variable:
    private var videoHolder:UIComponent = new UIComponent();
    [Bindable] public var imgData:ArrayCollection = new
    ArrayCollection();
    init :
    nc = new NetConnection();
    nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
    nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    netSecurityError);
    nc.connect(Srv_Name);
    videoHolder.setActualSize(Playing_Video_width,
    Playing_Video_height);
    Playing_Video = new Video(Playing_Video_width,
    Playing_Video_height);
    videoHolder.addChild(Playing_Video);
    Playing_Video.x = 0;
    Playing_Video.y = 0;
    videoHBox.width = Playing_Video.width;
    videoHBox.height = Playing_Video.height;
    videoHBox.addChild(videoHolder);
    functions:
    public function addStart(timecode:Number):void{
    var bm:Bitmap = copyBitmap(videoHBox as
    UIComponent,timecode,"start");
    bm1 = bm;
    img_start_time.text = formatTime(timecode);
    start_time = timecode;
    public function addImgToTile(bm:Bitmap):void{
    var bm1:BitmapData = Bitmap(bm1_source.content).bitmapData;
    var bitmap:Bitmap = new Bitmap(bm1);
    var vo:MyVOBm = new
    MyVOBm(bitmap,formatTime(inStream.time));
    imgData.addItem(vo);
    private function
    copyBitmap(source:UIComponent,timecode:Number,origin:String=''):Bitmap
    try{
    var bmd:BitmapData = new BitmapData( source.width,
    source.height );
    bmd.draw(source);
    corectImg = false;
    catch (err:Error){
    this.setFocus();
    inStream.seek(timecode);
    if (origin == "start") setTimeout(addStart,750,timecode);
    return new Bitmap(bmd);
    public function deleteSnapShot(ev:Event):void{
    imgData.list.removeItemAt(tileList.selectedIndex);
    and the MyVOBm class is :
    package components
    import flash.display.Bitmap;
    [Bindable]
    public class MyVOBm
    private var _asset:Bitmap;
    private var _title:String;
    public function MyVOBm(asset:Bitmap, title:String)
    this.title=title;
    this.asset=asset;
    public function set title(title:String):void{
    _title=title;
    public function get title():String{
    return _title;
    public function set asset(asset:Bitmap):void{
    _asset=asset;
    public function get asset():Bitmap{
    return _asset;

  • TileList dataProvider problem

    I use removeAll function to clean the dataProvider then I additem to it.
    There is an error occured. Because the dataProvider is null !
    So I recreate the dataProvider the error still there Why ~~?
    this is the code:
    var i:int = 0;
       if( TileList.dataProvider )
        TileList.dataProvider.removeAll(); // I remove all items.
       else{  // next time I try to recreate it but I still can't add item to the dataprovider
         // TileList.dataProvider.addItem("Class 1"); I can't do it because the dataprovider is null now
        TileList.dataProvider = new ListCollectionView( );
        while( i++ < 15 ){
         TileList.dataProvider.addItem("Class" + i);

    Hmm.. It seems that the data provider is not getting instanciated, which is resulating into null object reference error. I tried out the following code.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="absolute">
        <mx:Script>
            <![CDATA[
                import flash.text.engine.ContentElement;
                import mx.collections.ArrayCollection;
                public function btnClick():void
                    var i:int=0;
                    if (contentList.dataProvider.length > 0)
                        contentList.dataProvider.removeAll();
                    else
                        contentList.dataProvider=new ArrayCollection();
                        while (i++ < 15)
                            contentList.dataProvider.addItem("Class" + i);
            ]]>
        </mx:Script>
        <mx:Canvas width="100%"
                   height="100%">
            <mx:TileList id="contentList"
                         visible="true"
                         width="50%"
                         height="50%"
                         horizontalCenter="0"
                         bottom="10"
                         horizontalScrollPolicy="off"
                         verticalScrollPolicy="off"
                         verticalAlign="middle"
                         maxColumns="3"
                         maxRows="5"
                         rowHeight="{contentList.height*0.20}"
                         columnWidth="{contentList.width*0.33}"
                         dataProvider="{new ArrayCollection()}">
            </mx:TileList>
            <mx:Button id="btn"
                       label="Populate Tile List"
                       width="{btn.label.length * 8}"
                       height="20"
                       click="btnClick()">
            </mx:Button>
        </mx:Canvas>
    </mx:Application>
    May be this will help you.
    Thanks and Regards,
    Pooja Kuber | [email protected] | www.infocepts.com

  • TileList.dataProvider doesn't update

    Hi,
    I have two tilelists with a custom itemrenderer, both are
    drag, drop & dragMove enabled.
    If I drop one item to the other tilelist, in the dragDrop
    event the dataProvider doesn't get updated. But if I dragMove an
    item the dataProvider gets updated in the same event...
    I've tried validateNow and validateDisplayList for the
    tilelists but it doesn't update.
    Anyone an idea?
    Thx!

    I have had problems with the tileList updating as well. I am
    using flash, but I am sure they are similar in nature. For some
    reason the tileList doesn't like to update its state until AFTER
    the event is done. I am not positive if that is exactly what it is
    doing, but if you create a timer that will go off a hair later than
    the event, it will update. At least it does for me. :)
    It would be nice to know if there is a better solution
    though.

  • Problem with TileList

    I have written code where the user selects a directory and
    all the contents of the directory are displayed in a TileList. At
    least that is what I supposed it would do. The contents are
    displayed but in this fashion "[object File]". Changing the
    itemRenderer to mx.controls.Image of the list just gives me a blank
    image.What I am doing wrong? Any suggestions please? Also, I want
    the tilelist to display only the *.jpg files will I do the
    filtering in the Array?
    [Bindable]
    public var d:File;
    public function dir():void
    d = new File(null);
    d.browseForDirectory("Select Directory");
    d.addEventListener(Event.SELECT, dirSelect);
    public function dirSelect(event:Event):void
    d = event.target as File;
    var dirs:Array = d.getDirectoryListing();
    list.dataProvider = dirs;
    }

    Hi,
    try creating a custom component, which extends Image
    component. Your custom component should be something similar to the
    one below. Use this custom component as an itemRendered for your
    TileList.
    You have to get the object of the type File and then retrieve
    the url from the url property and then set it as a source to the
    Image.
    Hope this helps.
    <mx:Image>
    <mx:Script>
    <![CDATA[
    public override function set data(value:Object):void
    var fileObj:File = value as File;
    if(fileObj.extension == ".jpg")
    this.source = fileObj.url;
    ]]>
    </mx:Script>
    </mx:Image>

  • TileList dataProvider not Showing Correct Item

    I have a tileList control that is using an array collection
    into a custom ItemRenderer. I can put the TileList directly above a
    DataGrid control and see that the filter on the ArrayCollection is
    working properly according to the DataGrid, but the TileList
    control shows the incorrect item...
    What would cause this?
    The TileList and the DataGrid use the exact same
    dataProvidor, yet the TileList doesn't show the correct item(s)
    once it's dataProvider has been filtered.

    Please disregard - I'm an idiot! Was overthinking this with
    my classes and created references within references... Stupid!
    :)

  • Problem in changing dataprovider

    Hi,
    I have a Datagrid which contains List as Itemrenderer.I am providing data to the list through arraycollection.I need to change the dataprovider while clicking the button.I have two arraycollections a2 and a3.
                        var ac2:ArrayCollection = new ArrayCollection([ { TaskName: "A" }, { TaskName: "B" }, { TaskName: "C" } ]);
                        var ac3:ArrayCollection = new ArrayCollection([{TaskName: "D"},{TaskName: "E"},{TaskName: "F"}]); 
    At first the datagrid displays A B C.When i clicked the change button to change the dataprovider its displaying D A B insted of D E F
    The complete code is given below.Any one pls help me to solve tis problem.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Canvas id="can3" width="366"    height="286" label="Project Management Related Tasks">
                <mx:Script>
                             <![CDATA[
                            import mx.collections.ArrayCollection;
                            import mx.events.CollectionEvent;
                            import mx.controls.Alert;
                            function changeDataprovider()
                                dg.dataProvider=ac3;
                            function dataProvider():void
                                dg.dataProvider=ac2;
                        var ac2:ArrayCollection = new ArrayCollection([ { TaskName: "A" }, { TaskName: "B" }, { TaskName: "C" } ]);
                        var ac3:ArrayCollection = new ArrayCollection([{TaskName: "D"},{TaskName: "E"},{TaskName: "F"}]);   
                        ]]>         
                         </mx:Script>
                <mx:DataGrid sortableColumns="true" id="dg" creationComplete="{ dataProvider();}"   alpha="2" resizableColumns="false"   width="100%" borderThickness="0" color="black" height="266" >
                    <mx:columns>
                        <mx:DataGridColumn color="navy"  headerText="Task Name" dataField="TaskName" fontWeight="normal">
                         <mx:itemRenderer>
                 <mx:Component>
                     <mx:HBox>
                     <mx:List  id="ManagementList" dragEnabled="true" creationComplete="data1()"   themeColor="white"  allowMultipleSelection="false"   width="85"         height="20" rowHeight="20" borderThickness="0" />
                           <mx:Script>
                             <![CDATA[
                            function data1():void
                                ManagementList.dataProvider = data.TaskName;
                             ]]>         
                         </mx:Script>
                       </mx:HBox>
                      </mx:Component>
                 </mx:itemRenderer>
                 </mx:DataGridColumn>
                 </mx:columns>
                     </mx:DataGrid>
                    </mx:Canvas>
                    <mx:Button id="but" label="change" click="changeDataprovider()" />
    </mx:Application>

    If you remove this code snippet your app will work fine.
    <mx:itemRenderer>
                 <mx:Component>
                     <mx:HBox>
    <mx:List  id="ManagementList" dragEnabled="true"
    creationComplete="data1()"   themeColor="white"
    allowMultipleSelection="false"   width="85"         height="20"
    rowHeight="20" borderThickness="0" />
                           <mx:Script>
                             <![CDATA[
                            function data1():void
                                ManagementList.dataProvider = data.TaskName;
                             ]]>         
                         </mx:Script>
                       </mx:HBox>
                      </mx:Component>
                 </mx:itemRenderer>
    I see you want to add an itemRenderer but I don't get why you need an script there, or what you need to accomplish.

  • Problems with DataGird.dataProvider

    Ok, first; Sorry that my English isn't very well, but see I'm
    just 13 years old boy from The Netherlands. Hope you still want to
    help me guys :)
    Im busy with a site with a: DateChooser, Search form and
    DataGird. Ive made Active Server Pages and used some states and a
    lot of Functions() and <Mx:httpService>.
    I want that the DataChooser let see some posttitles in my
    DataGird, and the same for the Search form. But, when i use this
    function's:
    quote:
    private function calclicked(evta:Event)
    myGird.dataProvider == "evta.lastResult.items.item"
    private function searchclicked(evtb:Event)
    myGird.dataProvider == "evtb.lastResult.items.item"
    And this Mx:httpService:
    quote:
    <mx:HTTPService id="calclick" result="calclicked(event)"
    showBusyCursor="true" method="POST" url="
    http://localhost/GameBasedScripts/cal.asp"
    useProxy="false" > <!-- resultFormat="object" -->
    <mx:request xmlns="">
    <selecteddate>{lblneed.text}</selecteddate>
    </mx:request>
    </mx:HTTPService>
    <mx:HTTPService id="searchpost"
    result="searchclicked(event)" showBusyCursor="true" method="POST"
    url="
    http://localhost/GameBasedScripts/search.asp"
    useProxy="false" > <!-- resultFormat="object" -->
    <mx:request xmlns="">
    <tags>{txtSearch.text}</tags>
    </mx:request>
    </mx:HTTPService>
    It shows just 'evta.lastResult.items.item' or
    'evta.lastResult.items.item' in my DataGird, and not the Data of
    that. Anyone?

    quote:
    Originally posted by:
    Saskovic
    First remove the quotes from:
    myGird.dataProvider == "evta.lastResult.items.item"
    This, since you inserting a string into the dataprovider this
    way.
    (Don't you get an error message for this?)
    And if your not using the clicked methods for anything else,
    you could attach the lastresult directly in the mxml datagrid
    component. (I'm not sure how anymore, since I rather do my requests
    from actionscript (instead of using mxml) (URLRequest, databinding,
    etc.))
    Thanks for response :)
    It's working now, but there where alot of more problems,
    One of them:
    quote:
    [Bindable]
    public var:myData:Object
    and put in my DataGird.DataProvider
    {myData}

  • TileList DataProvider Help!

    I have an array collection and within that collection I have
    objects. Each of those objects has 2 arrays in it (along with other
    properties)
    When I have an object selected I want the TileList to display
    the 2 arrays as its data provider.
    I want to handle this the same way the Tree does with it's
    DataDescriptor, but I do not know how to do this with the TileList,
    any ideas?
    Thanks,
    Art

    Tracy,
    I want to use the same dataprovider for my TileList and my
    Tree. So the data provider is in a hierarchial structure. I want to
    point at a given "node" in the dataprovider and the TileList will
    display its contents. Since I have a custom hierarchial data
    structure, each "node" has two different child nodes (which are
    arrays). So the TileList will need to take those two arrays and
    display its contents in the list.
    The reason I want to do this is because if I remove a child
    in the TileList I dont want to manage a seperate dataprovider for
    the tree. Also in my environment I will have multiple instances of
    each the tree and TileList. I will be using data binding so that I
    dont have to manage each and every different set of Tree and
    TileList.
    If you can point me in the right direction to use a custom
    ItemRenderer to display my data the way I want, please let me know.
    Here is some example dataprovider...
    -------Example Code---------
    myDataProvider =
    <node1>
    <data/>
    <data2/>
    <children1>
    <node1>
    <data/>
    <data2/>
    <children1>
    <node1>
    <data/>
    <data2/>
    <children1></children1>
    <children2></children2>
    </node1>
    <node1>
    <data/>
    <data2/>
    <children1></children1>
    <children2>
    <node2/>
    </children2>
    </node1>
    </children1>
    <children2>
    <node2/>
    <node2/>
    <node2/>
    </children2>
    </node1>
    <node1>
    <data/>
    <data2/>
    <children1></children1>
    <children2>
    <node2/>
    </children2>
    </node1>
    </children1>
    <children2></children2>
    </node1>
    ---------------------End of Code-----------
    So above is an example of my data structrue, so I want to
    pass node1 to the TileList and the TileList will display children1
    and children2 in it's list - with keeping an handle back to the
    dataprovider so I dont have to manage seperate lists.
    Hope this helps clear what I am trying to do, and thanks for
    your help so far!
    Art

  • Problem with datagrid dataprovider

    I'm wondering why is it my search result is null after I press search button. After I press search, the datagrid is blank. But I ever test my service and it's working.
    Anyone has any idea how to solve it? So sorry I'm totally new to FLEX... >.<
    Below is my code...
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx"
                           xmlns:productbasicservice="services.productbasicservice.*"
                           width="1024" height="768">
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.controls.Alert;
                import mx.controls.TextInput;
                import mx.events.DataGridEvent;
                import mx.events.FlexEvent;
                import mx.rpc.AsyncToken;
                import valueObjects.Product_basic;
                protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                    getProduct_basic_pagedResult.token = productbasicService.getProduct_basic_paged();
                protected function saveClick(event:MouseEvent):void
                    productbasicService.commit();
                protected function revertData(event:MouseEvent):void
                    productbasicService.revertChanges();
                protected function searchData(event:MouseEvent):void
                    var searchStr:String = searchbox.toString();
                    searchProduct_basicResult.token = productbasicService.searchProduct_basic(searchStr);
                    dataGrid.dataProvider = searchProduct_basicResult.lastResult;
            ]]>
        </fx:Script>
        <fx:Declarations>
            <s:CallResponder id="getAllProduct_basicResult"/>
            <productbasicservice:ProductbasicService id="productbasicService"
                                                     fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                     showBusyCursor="true"/>
            <s:CallResponder id="getProduct_basic_pagedResult"/>
            <s:CallResponder id="searchProduct_basicResult"/>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <mx:DataGrid id="dataGrid" x="11" y="61" width="1003" height="557"
                     creationComplete="dataGrid_creationCompleteHandler(event)"
                     dataProvider="{getProduct_basic_pagedResult.lastResult as ArrayCollection}" editable="true">
            <mx:columns>
                <mx:DataGridColumn width="200" dataField="id" editable="false" headerText="ID"/>
                <mx:DataGridColumn dataField="name" headerText="name"/>
                <mx:DataGridColumn width="200" dataField="price" headerText="Price"/>
                <mx:DataGridColumn dataField="description" headerText="description"/>
            </mx:columns>
        </mx:DataGrid>
        <s:Button x="849" y="22" label="Save" click="saveClick(event)"/>
        <s:Button x="944" y="22" label="Revert" click="revertData(event)"/>
        <s:TextInput x="14" y="22" width="367" id="searchbox"/>
        <s:Button id="button" x="389" y="22" label="Search" click="searchData(event)"/>
    </s:WindowedApplication>
    I have added my own data service operation in the php file called searchProduct_basic(searchStr). Basically this function return the object of the search result.

    It's the same for lastResult as ArrayCollection.
                protected function searchData(event:MouseEvent):void
                    var searchStr:String = searchbox.toString();
                    searchProduct_basicResult.token = productbasicService.searchProduct_basic(searchStr);
                    dataGrid.dataProvider = searchProduct_basicResult.lastResult;
    For you information, the searchProduct_basic(searchStr) would return Product_basic object. >.<

  • Problem in setting dataprovider for a dynamically generated datagrid

    Hi everybody
    I have a issue in flex, I am generating datagrids dynamically
    by using repeaters but i am unable to set a seperate dataprovider
    for each grid
    Grid1 might come with some set of data and grid 2 with some
    and so on so i want to set dataproviders at runtime for each grid
    how can i do that
    i have pasted my code for generating datagrid dynamically plz
    go thru that and find me some solution
    <mx:Repeater id="ProjectNames"
    dataProvider="{GetTimeSheetDetails.lastResult.NewDataSet.Table1}"
    >
    <mx:Canvas label="{ProjectNames.currentItem.ProjectName}"
    width="100%" height="251" id="CanvasTimeSheet"
    creationComplete="disablecanvas();">
    <mx:DataGrid x="10" y="10" width="864" height="206"
    editable="true"
    dataProvider="{GetTimeSheetDetails.lastResult.NewDataSet.Table}"
    id="dgTimeSheet">
    <mx:columns>
    <mx:DataGridColumn headerText="Task" dataField="TaskName"
    width="60" >
    </mx:DataGridColumn>
    <mx:DataGridColumn headerText="Task Description"
    dataField="TaskDescription" width="150" editable="true"/>
    <mx:DataGridColumn headerText="M" dataField="Monday"
    width="15" editable="true"/>
    <mx:DataGridColumn headerText="T" dataField="Tuesday"
    width="15" editable="true"/>
    <mx:DataGridColumn
    </mx:columns>
    </mx:DataGrid>
    <mx:Label x="564" y="222" text="0" width="35"
    textAlign="right" id="lblMonday" />
    <mx:Label x="602" y="222" text="0" width="33"
    textAlign="right" id="lblTuesday"/>
    </mx:Canvas>
    </mx:Repeater>
    </mx:TabNavigator>

    try this and say me if it works fine!!!
    <html>
    <head>
    <script>
    function fileds() {
         var myParent = document.getElementById('myDiv');
         var text = document.createElement('input');
         text.setAttribute('id', 'myText');
         myParent.appendChild(text);
         document.all.myText.focus();
    </script>
    </head>
    <body>
    <input type="button" onClick="javascript:fileds()" value="Create And Give Focus">
    <br>
    <div id="myDiv"></div>
    </body>
    </html>
    bye

  • Problem with Tilelist: size of displayed items changes when you scrolldown

    Hi,
          I have a TileList that shows some items. I have an initial state, with the columncount set to 4. When the application begins the Tilelist only shows 3 columns, supposedly because there is no more space left, but when you scrolldown, and then scroll up, you’ll see that now the Tilelist shows 4 columns, as it’s supposed to, instead of the 3 that it showed at the beginning. I want to know how can make the tilelist show 4 columns from the beginning (I know that there is enough space, and that somethings going wrong with the tilelist(.
    Thanks for your help
    Sebastián Toro

    Hi Karin,
          I can't try your VI unless you save it in 7.1 (using File\save-with-options) however...
    try using the defer-panel-updates property to disable/enable the front panel before/after the array change:
    Message Edited by Dynamik on 12-08-2005 12:11 AM
    Message Edited by Dynamik on 12-08-2005 12:12 AM
    Message Edited by Dynamik on 12-08-2005 12:13 AM
    When they give imbeciles handicap-parking, I won't have so far to walk!
    Attachments:
    defer.gif ‏6 KB

  • Problem selecting DataProvider.

    I encountered a problem adding a DataProvider which already exists. This is what happened.
    I wanted bind a table component to data; in the Add Data Provider dialog box, I selected Data Sources > fitwise > Tables > company and clicked Add; In the Add New Data Provider with RowSet for Table company dialog box, I had to select a DataProvider because I had already added the company table to other tables twice. I selected the second radio button and clicked OK. The IDE added the first DataProvider to my table. I tried to add the second DataProvider again and again, but the IDE kept adding the first DataProvider in the list, the one not bound to the selected radio button, but to the not selected radio button. Has anyone encountered the same problem? Is there a solution? For instance is there another way to bind a table to an existing DataProvider.
    Kind regards,
    Annet.

    I think you may have to try what I'm about to try - resetting the Prefs - delete the Preferences folder and let Illustrator rebuild it when you restart it.
    I can't get the Arrange commands to run - only thing I can think to try is resetting the Preferences...it usually clears up strange glitches like yours and mine.
    [edit: Well resetting the Preferences did nothing for me. Hope you found a solution to your problem]

  • Several same objects in a tilelist not selectable

    Hello.
    I have 2 horizontal lists in my application. The first one
    contains images and I am allowed to drag them from first one and
    drop in the another one. Everything seems to work perfectly in
    first look. I can drag images to one list to another and it copies
    the images a move to other one. The problem appears when I move
    same image for a several times (2 or more). There seems to be
    several items, but the problem is that I can only select the last
    one. I have also a numeric stepper there. When I change a value in
    other, value changes in another as well.
    I think problem is that the objects have same UID, but I
    can't figure out how to change that.
    Can you please tell me the solution to this problem. I have
    totally lost my nerves with this.
    Thank you!
    Here is the source:
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    [Bindable]
    private var valitut_kuvat:ArrayCollection=new
    ArrayCollection();
    <mx:Canvas label="Choose images">
    <mx:TileList
    dataProvider="{taustakuvalataus.lastResult.multime dia.images.img}"
    dropEnabled="false" allowDragSelection="false" dragEnabled="true"
    dragMoveEnabled="false" itemRenderer="Thumbnail"
    id="tilelist_kuvat"
    creationComplete="taustakuvalataus.send()"></mx:TileList>
    <mx:HorizontalList dropEnabled="true" dragEnabled="true"
    dragMoveEnabled="true" itemRenderer="Thumbnail2"
    dropShadowEnabled="true" id="multimedia_valitut"
    dataProvider="{valitut_kuvat}"></mx:HorizontalList>
    </mx:Canvas>
    -----------Thumbnail.mxml----------------------------------------------
    <?xml version="1.0"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns="*" width="80" height="65" horizontalScrollPolicy="off"
    verticalScrollPolicy="off" borderStyle="none">
    <mx:Image id="img" height="60" width="80"
    source="{data.kuva}"/>
    </mx:VBox>
    -----------Thumbnail2.mxml---------------------------------------------
    <?xml version="1.0"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns="*" width="125" horizontalScrollPolicy="off"
    verticalScrollPolicy="off" borderStyle="none" height="158">
    <mx:Image id="img" height="100" width="120"
    source="{data.kuva}"/>
    </mx:VBox>

    i have had the same exact problem, it only happens if you
    move one image and have 2 instances of it on the other side. i have
    been trying from this mornin to figure out a solution. i am getting
    close, ill let u know

  • How use PHP to read image files from a folder and display them in Flex 3 tilelist.

    Hello. I need help on displaying images from a folder dynamically using PHP and display it on FLEX 3 TileList. Im currently able to read the image files from the folder but i don't know how to display them in the TileList. This is my current code
    PHP :
    PHP Code:
    <?php
    //Open images directory
    $imglist = '';
    $dir = dir("C:\Documents and Settings\april09mpsip\My Documents\Flex Builder 3\PHPTEST\src\Assets\images");
    //List files in images directory
    while (($file = $dir->read()) !== false)
    if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
    echo "filename: " . $file . "\n";
    $dir->close();
    ?>
    FLEX 3 :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="pic.send();">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    import mx.rpc.events.FaultEvent;
    import mx.events.ItemClickEvent;
    import mx.rpc.events.ResultEvent;
    public var image:Object;
    private function resultHandler(event:ResultEvent):void
    image = (event.result);
    ta1.text = String(event.result);
    private function faultHandler(event:FaultEvent):void
    ta1.text = "Fault Response from HTTPService call:\n ";
    ]]>
    </mx:Script>
    <mx:TileList x="31" y="22" initialize="init();" dataProvider = "{image}" width="630" height="149"/>
    <mx:String id="phpPicture">http://localhost/php/Picture.php</mx:String>
    <mx:HTTPService id="pic" url="{phpPicture}" method="POST"
    result="{resultHandler(event)}" fault="{faultHandler(event)}"/>
    <mx:TextArea x="136" y="325" width="182" height="221" id="ta1" editable="false"/>
    <mx:Label x="136" y="297" text="List of files in the folder" width="182" height="20" fontWeight="bold" fontSize="13"/>
    </mx:Application>
    Thanks. Need help as soon as possbile. URGENT.

    i have made some changes, in the php part too, and following is the resulting code( i tried it, and found that it works.):
    PHP Code:
    <?php
    echo '<?xml version="1.0" encoding="utf-8"?>';
    ?>
    <root>
    <images>
    <?php
    //Open images directory
    $dir = dir("images");
    //List files in images directory
    while (($file = $dir->read()) !== false)
    if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
    echo "<image>" . $file . "</image>"; // i expect you to use the relative path in $dir, not C:\..........
    //$dir->close();
    ?>
    </images>
    </root>
    Flex Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="callPHP();">
    <mx:Script>
    <![CDATA[
    import mx.rpc.http.HTTPService;
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    import mx.rpc.events.FaultEvent;
    import mx.events.ItemClickEvent;
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    private var arr:ArrayCollection = new ArrayCollection();
    private function callPHP():void
    var hs:HTTPService = new HTTPService();
    hs.url = 'Picture.php';
    hs.addEventListener( ResultEvent.RESULT, resultHandler );
    hs.addEventListener( FaultEvent.FAULT, faultHandler )
    hs.send();
    private function resultHandler( event:ResultEvent ):void
    arr = event.result.root.images.image as ArrayCollection;
    private function faultHandler( event:FaultEvent ):void
    Alert.show( "Fault Response from HTTPService call:\n " );
    ]]>
    </mx:Script>
    <mx:TileList id="tilelist"
    dataProvider="{arr}">
    <mx:itemRenderer>
    <mx:Component>
    <mx:Image source="images/{data}" />
    </mx:Component>
    </mx:itemRenderer>
    </mx:TileList>
    </mx:Application>

Maybe you are looking for

  • How can I transfer music from my iphone 5 to another iphone 5

    I want to know How can I transfer music from my iphone 5 to another iphone 5

  • Getting two selection screen in one report

    Hello Friends, I am Making report, In my report on first screen i have given two pushbutton, like this : SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001. PARAMETERS : p1_but RADIOBUTTON GROUP g1,                          p2_but RADIOBUTT

  • Business one - how is the prospects for a MBA fresher

    I am very new to business one and I need some information regarding its training and prospects. One of my friend has graduated (MBA) and trying to get into SAP. Since he is fresher he is not able to undergo any major SAP module. The training center i

  • JCO RFC Problem

    Hello, I am trying to call BAPI Using RFC - JCO connections from EJB with the help of below document. http://help.sap.com/saphelp_nw04/helpdata/en/17/d609b48ea5f748b47c0f32be265935/frameset.htm I have two questions here,     DestinationService dstSer

  • GSServices GetGatewaySpecificConfig Object variable or With block variable

    I am trying to get the Imageserver path of Plumtree 5.0.4 using the GSServices dll (version 30.1817.7918.) When I execute the method GetGatewaySpecificConfig I get an exception System.Runtime.InteropServices.COMException: Object variable or With bloc