flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christofer Dutz <christofer.d...@c-ware.de>
Subject AW: Bindable functions
Date Thu, 26 Jun 2014 09:03:05 GMT
And as soon as you have a bindable function, you need to dispatch the event yourself. While
Flex will generate events as soon as a bindable property has changed, this will not happen
on a bindable function. I can't see that you are dispatching an event, so the listeners will
never be informed about the function call.

Von: Mihai Chira <mihai.chira@gmail.com>
Gesendet: Donnerstag, 26. Juni 2014 11:00
An: users@flex.apache.org
Betreff: Re: Bindable functions

In your example I didn't understand why the "last" getter wasn't used,
nor why it had to be Bindable.

In any case, it might help to know that a normal function (i.e. not a
getter or a setter) can be "bindable" in the sense that if the mxml
declaration includes it in curly braces, it will get called whenever
any of its bindable parameters change:

private var startDate:Date;

private function formatDate(date:Date):String
    return date.toString(); //do something

<s:Label text="Start date: {formatDate(startDate)}"/>

In the example above, "formatDate" will get called whenever
"startDate" changes. If "formatDate" didn't have any parameters, it
would only get called once, when the label is created.

On 26 June 2014 00:06, Justin Ransom Dallas <justindallas@gmail.com> wrote:
> If you have a bind able function,  then you must have an event in mind.
>  Why don't you listen for that event to be dispatched and run your function
> in the handler.  Also,   If you have to do something to your renderer,  why
> not try modifying your model displayed in the renderer (I.e.  A wrapper or
> adapter). And then interfacing that way.
> On Wednesday, June 25, 2014, Scott Matheson <smatheson@intralinks.com>
> wrote:
>> Hi
>>    well I have never manage to get Bindable functions to work, but now i
>> may need then
>> I have a view stack, with a renderer, in the rendered i would to disable
>> elements of the render dependent on the view stack, i could hold a bit off
>> Bindable data (thats what i do in other place), if i could create a
>> Bindable function i could call this function in the render and disable
>> elements as needed
>> unfortunately i can not get this approach to work
>> [Bindable]
>> public function get last():Boolean
>> {
>> return this.viewIndex === (this.numElements - 1);
>> }
>> <common:ViewStack id="block" dataProvider="{blocks}"
>>   verticalCenter="0" horizontalCenter="0"
>>   itemRenderer="com.peach.uofs.lesson.ReadingBlockRenderer"
>>   viewChange="setHLClip(event)">
>> </common:ViewStack>
>> i want to be able to dibble a button in ReadingBlockRenderer
>> ________________________________
>> Disclaimer: This electronic mail and any attachments are confidential and
>> may be privileged. If you are not the intended recipient, please notify the
>> sender immediately by replying to this email, and destroy all copies of
>> this email and any attachments. Thank you.
> --
> Justin Dallas
> Phone:814-880-5637

View raw message