try this
if(this.bt1.label == null || this.bt1.label == ""){
this.removeChild(bt1);
}
HTH,
-Ravi
On Mar 9, 3:00 pm, cool saurabh <[email protected]> wrote:
> Hi all,
>
> I am writing a code which renders button using item renderer. Now problem is
> that each button will have label. incase button is not having label i should
> remove that button so is there anything possible like making skin=null for
> button if no label is there. what i want is the button should disappear
> whenever no label is there . Right now if no label is there m still having
> button.Can anyone look at the code below & suggest where should i do changes
>
> Regards
> Saurabh
>
> here is mine code
>
> *override* *protected* *function* updateDisplayList(unscaledWidth:Number,
> unscaledHeight:Number):*void* {
>
> *super*.updateDisplayList(unscaledWidth, unscaledHeight);
>
> *if*(data){
>
> *if*(*this*.bt1.selected){
>
> *this*.bt1.selected=*false*;
>
> }
>
> *if*(dpft.length>0){
>
> *for* *each*(*var* tmp:String *in* dpft){
>
> *try*{
>
> *if*(*this*.bt1.toolTip.match(tmp)){
>
> previtm=*this*;
>
> *this*.bt1.selected=*true*;
>
> }
> }*catch*(ex:Error){
> }
> }
> }
>
> *var* xml:XMLList=XMLList(*this*.bt1.label);
>
> *var* tmp:string=x...@name;
>
> *if*(tmp){
>
> *this*.bt1.label=tmp.substr(0,11)+*""*+*" ("*+x...@totalcnt+*")"*;
>
> }
> }
> }
>
> *else*{
>
> *this*.bt1.enabled=*false*;
>
> }
> }
>
> ]]>
>
> </mx:Script>
>
> <mx:Button id="bt1" label="{data.col1}" upSkin="
> @Embed('assets/default_100x20.png')" downSkin="
> @Embed('assets/default_100x20.png')" overSkin="
> @Embed('assets/hover_100x20.png')" selectedUpSkin="
> @Embed('assets/selected_100x20.png')" selectedDownSkin="
> @Embed('assets/selected_100x20.png')" selectedOverSkin="
> @Embed('assets/selected_100x20.png')" disabledskin="
> @Embed('assets/disabled_100x20.png')" selected="false" width="90%" height="
> 95%" click="updatedata(event)" toolTip="{data.col1}" paddingLeft="0"
> paddingRight="0" fontFamily="Arial" fontWeight="normal"/>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---