That's what I needed. Thank you !


Joe James
Work: (562) 658-3670
Tie Line: 8-320-3670


CONFIDENTIALITY STATEMENT - This message and any files or text attached to 
it are intended only for the recipients named above, and contain 
information that may be confidential or privileged.  If you are not an 
intended recipient, you must not read, copy, use, or disclose this 
communication.  Please also notify the sender by replying to this message, 
and then delete all copies of it from your system.  Thank you.

NOTICE TO RECIPIENT:  If you are not the intended recipient of this 
e-mail, you are prohibited from sharing, copying, or otherwise using or 
disclosing its contents.  If you have received this e-mail in error, 
please notify the sender immediately by reply e-mail and permanently 
delete this e-mail and any attachments without reading, forwarding or 
saving them.  Thank you.




"Ralf Bokelberg" <[EMAIL PROTECTED]> 
Sent by: [email protected]
12/12/2006 08:56 AM
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: [flexcoders] Shuffle items in Repeater






If you use binding, all you need to do is changinge the dataProvider. Here 
is a little example:

---------------------------------------------------- snip 
--------------------------------------------------------
<?xml version=" 1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
    layout="vertical" creationComplete="onCreationComplete()"> 

    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
 
            [Bindable]
            private var buttonData : ArrayCollection;
 
            private function onCreationComplete() : void
            {
                trace("ApplicationEntry::onCreationComplete");
                buttonData = createButtonData();
            } 
 
            private function createButtonData() : ArrayCollection
            {
                var result : ArrayCollection = new ArrayCollection();
                result.addItem({index : 1, label: "one"}); 
                result.addItem({index : 2, label: "two"});
                result.addItem({index : 3, label: "three"});
                return result;
            }
 
            private function bringToTop( item : Object ) : void 
            {
                var index : int = buttonData.getItemIndex( item );
                if( index >= 0 )
                {
                    buttonData.removeItemAt( index );
                    buttonData.addItemAt( item, 0 );
                }
            }
        ]]>
    </mx:Script>
 
    <mx:Repeater id="buttonRepeater"
        dataProvider="{ buttonData }"> 
        <mx:Button 
            label="{ buttonRepeater.currentItem.label }" 
            data="{ buttonRepeater.currentItem }"
            click="bringToTop( event.target.data )"/> 
    </mx:Repeater> 

</mx:Application>
---------------------------------------------------- snip 
--------------------------------------------------------

Cheers,
Ralf. 

On 12/12/06, Lachlan Cotter <[EMAIL PROTECTED]> wrote:
Hi Joe,

I think there might be a way to do it, but it's not pretty. Probably 
better off using a list or something similar instead of a repeater, 
because the repeater isn't much help after it has actually instantiated 
it's contents. The list is a little more work because you have to go and 
define a separate item renderer class and set up some event handling to 
manipulate the data provider, but I believe this would be the correct way 
to do what it is that you are asking. 

Cheers,
Lach


On 12/12/2006, at 1:10 PM, Joe wrote:

I have a repeater that verticaly displays about 12 buttons. Is it 
possible to change the index of the button that is selected. If I 
selected a button in the middle of the repeater can it would move to 
the top. Or if it can't move, maybe change the label of the button on 
the top to read what I just selected. 

Should this not be in a repeater? Help !!!




-- 
Ralf Bokelberg <[EMAIL PROTECTED]>
Flex & Flash Consultant based in Cologne/Germany 
 

Attachment: gifL2AstXPuxn.gif
Description: GIF image

Attachment: gifQSWVzj5Msn.gif
Description: GIF image

Reply via email to