hi ravi ,

so in order keep the binding solid we can use the [Bindable] tag ,
what it really does is letting the component know ,hey i have changed
..please act accordingly .
(by triggering an event , which you might already know.)
if not try this link to know more about [Bindable] tag.
http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_8.html

now ,
Suppose you want to use your own customClass where some of the properties
are bind-able in to other components which you use else where in the product
.
in such cases

you can use
bindingUtils or mxml version of it (binding tag).

note,
there are some cases where you dont want to use explicit binding using
bindingUtils and tag.
but when the change is not reflected , im sure those will come handy :-)

check the example how i bind the variable to extenal reference.code is self
explanery so let me know if you dont understand anything ok


*This is my external class*

package com
{

    // if you want you can try [Bindable] tag for the class it self :)
    public class RtExt
    {
        [Bindable] public var name:String;

        public function RtExt()
        {
            name ="Socerties";
        }



    }
}

*this is my mxml*


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

    <mx:Script>
        <![CDATA[
            import com.RtExt;
            import mx.binding.utils.BindingUtils;

            [Bindable] private var myCustomClass:RtExt = new RtExt();


            private function init():void
            {
                BindingUtils.bindProperty(NameText, "text", myCustomClass,
"name");
            }  // init

            private function changeDogName():void
            {
                myCustomClass.name = NameInput.text;
            }  // changeName
        ]]>
    </mx:Script>
    <mx:Binding source="myCustomClass.name" destination="NameText2.text"/>
    <mx:Text id="NameText" text="{myCustomClass.name}" fontSize="12" />
    <mx:Text id="NameText2" text="{myCustomClass.name}" fontSize="12" />
    <mx:Spacer height="50" />
    <mx:HBox>
        <mx:Label text="Change name to: " />
        <mx:TextInput id="NameInput" />
    </mx:HBox>
    <mx:Button label="change name" click="changeDogName()"/>

</mx:Application>


here im creating two binding methods on using utils and tag where you can
play around with.

try commenting

<mx:Binding source="myCustomClass.name" destination="NameText2.text"/>
or bindingUtils

or both.

try removing [Bindable] tag in places and observe the changes .

im sure you will be able to over come any  doubts you have.

Best regards

Dinukx





On Thu, Nov 26, 2009 at 12:52 AM, Ravi <[email protected]> wrote:

> Hi All,
>
> I have doubt.
>
> for data biniding , we have 3 options,
>
> 1. {} binding in mxml
> 2. <mx:Binding> in mxml
> 3.Bindingutils in Action script.
>
> And what is the use of [bindable] meta tag? Any features add into
> this?
>
>
>
> Thanks,
> Ravi
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.


Reply via email to