When you change the dataProvider, the HLIst should update for you.  It
generates renderer instances based on the data and basically ignores
addChild/removeChild calls.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Carlo Gulliani
Sent: Wednesday, May 07, 2008 11:54 PM
To: Flexcoders
Subject: [flexcoders] HorizontalList.removeChildAt(index)

 

Good time, everybody. I've a problem. When I use HorizontalList I can't
remove any childs. So, I write code:

<mx:HorizontalList id="myList" itemRenderer="components.Frame" />

and code for it:

<mx:Script>
    <![CDATA[
        import mx.collections.*;
        private var _this:Object;
        private function initApp():void {
            myList.addEventListener("itemDelete", onItemDelete);
            _this = this.parent.parent;
        }
        private function onItemDelete(e:Event):void{
            var r:Frame = e.target as components.Frame;
            var targetIndex:int = myList.itemRendererToIndex(r);
            myList.removeChildAt(targetIndex);
            _this.mn.dataFrame.removeItemAt(targetIndex); // here i want
to remove current child, but flex remove all HorizontalList component
            myList.dataProvider = _this.mn.dataFrame;
        }
    ]]>
    </mx:Script>

This error doesn't give me to add new child to HorizontalList. After
deleted some child and when I want to add new child, I must press two
times mouse's button for adding child and I ge! t next scheme:

[1st element] [2nd element] [empty] [3rd element (btw, it's 4th element,
simple the 3rd element is not visible)]

----------------
Now playing: Nena - She's like a Rainbow
<http://www.foxytunes.com/artist/nena/track/she%27s+like+a+rainbow> 
posted with FoxyTunes <http://www.foxytunes.com/signatunes/>     

 

________________________________

Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
it now.
<http://us.rd.yahoo.com/evt=51733/*http:/mobile.yahoo.com/;_ylt=Ahu06i62
sR8HDtDypao8Wcj9tAcJ%20> 

 

Reply via email to