Hi Kamal,

use data property of object to set new property, may help you.

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

        <mx:Script>
                <![CDATA[
                        import mx.events.FlexEvent;
                        import mx.controls.Alert;

                        private function onInit(event:FlexEvent):void
                        {
                                addBtn.data = new Object();
                        }
                        private function onBtnClick(event:MouseEvent):void
                        {
                                event.target.data.newpro = "Google";
                                Alert.show( "Property : " + 
event.target.data.newpro )
                        }

                ]]>
        </mx:Script>

        <mx:Button id="addBtn" label="Add Property"
click="onBtnClick(event)" />

</mx:Application>

Thanks,
V.Patel

On Apr 16, 4:24 pm, kamal <[email protected]> wrote:
> Thank you khushi, is there any simple way to solve this instead of
> creating custom button class?
>
> On Apr 16, 4:09 pm, khushi <[email protected]> wrote:
>
>
>
> > create a custom button dynamic class and use that button then you will
> > be able to add new property to it.
>
> > find below the ref .
>
> > CustomButton class :
>
> > package components
> > {
> >         import mx.controls.Button;
>
> >         public dynamic class CustomButton extends Button
> >         {
> >                 public function CustomButton()
> >                 {
> >                         super();
> >                 }
>
> >         }
>
> > }
>
> > main application:
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > layout="absolute" xmlns:components="components.*">
> > <mx:Script>
> >         <![CDATA[
> >                 import mx.controls.Alert;
>
> >                 private function submit_fun(e:MouseEvent):void{
> >                         e.target.newpro = "ggogle";
> >          //e.target.newpro="google";
>
> > }
>
> > private function getProperty():void
> > {
> >         if(submit_btn.newpro)
> >         {
> >                 Alert.show(submit_btn.newpro);
> >         }}
>
> >         ]]>
> > </mx:Script>
>
> > <components:CustomButton id="submit_btn" click="submit_fun(event)"
> > x="50" y="50"/>
> > <mx:Button click="getProperty()" x="250" y="50"/>
>
> > </mx:Application>
>
> > On Apr 16, 3:53 pm, kamal <[email protected]> wrote:
>
> > > private function submit_fun(e:MouseEvent):void{
> > >      e.target.newpro="google";
>
> > > }
>
> > > <s:Button id="submit_btn" click="submit_fun(event)" />
>
> > > here i want to assign newpro property to e.target but this is not
> > > working. can you please help me.
> > > i'm new to flex.
>
> > > --
> > > 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 
> > > athttp://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 
> > athttp://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 
> athttp://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