Thanks Ralf - I will give that a go..

 

I did get it working using the following but what you suggest sounds like a
better solution

 

private function displayHelpTopic(evt:Event):void {

                

                var button:LinkButton = evt.target as LinkButton;

                var repIndex:Number = button.repeaterIndex;

                

                var id:String = this.helpRelatedData.getItemAt(repIndex).id;

                

                var description:String =
_dataManager.returnHelpTopicDescriptionForTopicId(id);

                

                descriptionText.text = description;

}

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ralf Bokelberg
Sent: 01 October 2007 11:34
To: flexcoders@yahoogroups.com
Subject: [SPAM] Re: [flexcoders] Passing a property of repeater item

 

You could either use the data property every UIComponent has or subclass the
LinkButton and add the additional property. 
Cheers
r. 

On 10/1/07, Paul Steven <[EMAIL PROTECTED]> wrote:

Thanks Ralf

 

Can you elaborate a bit more please

 

How can I set a property of the button called "topicId". My 

 

I tried the following but it doesn't work

 

<mx:Repeater id="linkrep" dataProvider="{this.helpRelatedData}">


                                                <mx:LinkButton
topicId='linkrep.currentItem.topicId' label='{linkrep.currentItem.title}'
click="displayHelpTopic(topicId)"  color="#0000ff"/>

                 </mx:Repeater>

 

 

topicId is a property of my arrayCollection that is the dataprovider of the
repeater

 

helpRelatedData.addItem({topicId:id, title:title});

 

Thanks

 

Paul

 

 

 

From: [EMAIL PROTECTED] ups.com <http://ups.com>
[mailto:[EMAIL PROTECTED] On Behalf Of Ralf Bokelberg
Sent: 30 September 2007 11:46
To: flexcoders@yahoogroups.com
Subject: [SPAM] Re: [flexcoders] Passing a property of repeater item

 

That is because the click is executed long after the repeater has done its
work. 
You need to pass in a property of the button itself to displayHelpTopic, eg.
the label. 
Cheers
Ralf. 

On 9/30/07, Paul Steven <[EMAIL PROTECTED]> wrote:

I can't figure out how to pass a property of a repeater item to a function

This is what I am trying but it is not working

<mx:Repeater id="linkrep" dataProvider="{this.helpRelatedData}"> 

<mx:LinkButton label='{linkrep.currentItem.title}'
click="displayHelpTopic(linkrep.currentItem.title)" color="#0000ff"/>

</mx:Repeater> 

Basically I want to pass the value linkrep.currentItem.title but what I have
tried above does not work.

Anyone suggest how I can do this.

The label is displaying correctly.

Thanks in advance

Paul




-- 
Ralf Bokelberg <[EMAIL PROTECTED]>
Flex & Flash Consultant based in Cologne/Germany
Phone +49 (0) 221 530 15 35 




-- 
Ralf Bokelberg <[EMAIL PROTECTED]>
Flex & Flash Consultant based in Cologne/Germany
Phone +49 (0) 221 530 15 35 

 

Reply via email to