开发者

How to remove Button from Flex Mobile app actionbar with AS3?

How exactly would i remove a Button from the actionBar "actionContent" in a flex mobile app?

I tried these:

this.stage.removeChild(menu_btn);
this.removeChild(menu_btn);
stage.removeChild(menu_btn);
this.stage.removeElement(menu_btn);
this.removeElement(menu_btn);
stage.removeElement(menu_btn);

I'm not having any luck with those. Im guessing where it is located in the actioncontent isn't considered the stage. Any ideas?

<s:actionContent>
        <s:CalloutButton id="menu_btn" icon="@Embed('assets/images/menu/menu_btn.png')" visible="false">
            <s:VGroup>
            <s:Button id="btn_one" label="Button" />
            开发者_如何学JAVA</s:VGroup>
        </s:CalloutButton>
    </s:actionContent>

The actionContent is setup like that, I know like with most mxml stuff I could give it an ID to reference it but im not sure how how to give the action content an id number <s:actionContent id="testID"> does not work. So how can i access this to remove it? making it invisible isn't cutting it i need to actually remove it.


Being that actionContent is a property of the ActionBar, it already is the "id" of an object, namely an Array. Try using an Array method to remove it. For instance, you could use actionContent.pop() if the thing you want to remove is the last element. Or use splice():

actionContent.splice(actionContent.indexOf(menu_btn),1);

which will remove the element from the Array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜