How to set Button visible=false

Hello,

i try to set a button on visible = false if another button is clicked. But it don´t works.
Please can somebody help me?

Thank´s in advance!

Regards,
Mario
[Bindable] private var submitUpdate:Boolean = true;
 
public function buttonAlpha():void {
	neueKarte.addEventListener(MouseEvent.CLICK, buttonClick);
}
	
public function buttonClick(ev:MouseEvent):void {
	submitUpdate.visible = false;
}

Open in new window

20oneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jones911Commented:
Can you show me more of the code.  I need to see the code where you define both buttons.
0
mplordCommented:
Assuming your button's visible is property is bound to submitUpdate (e.g. visible="{submitUpdate}", you can't bind to private member variables - make it public and see if that works.
0
zzynxSoftware engineerCommented:
public function buttonClick(ev:MouseEvent):void {
        yourButton.visible = false;
}

with

<mx:Button id="yourButton" label="I don't know" />
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

mplordCommented:
I might have mislead with the need for [Bindable] properties to be public, not so, it's more a side-effect when setting classes to be [Bindable] when private properties are not included, so ignore my last comment.

Your problem is the line:
submitUpdate.visible = false;

You're trying to set the 'visible' property of a Boolean, rather than the button itself.
Otherwise you're trying to use databinding (where you'll need 'submitUpdate = false') e.g.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();">
	
	<mx:Script>
		<![CDATA[
			[Bindable] private var submitUpdate:Boolean = true;
			 
			public function init():void {
			        btnHide.addEventListener(MouseEvent.CLICK, buttonClick);
			}
			        
			public function buttonClick(ev:MouseEvent):void {
			        submitUpdate = false;
			}
		]]>
	</mx:Script>
 
	<mx:HBox width="100%" horizontalCenter="0" verticalCenter="0" horizontalAlign="center">
		<mx:Button label="Hide" id="btnHide"/>
		<mx:Button label="Update" id="btnUpdate" visible="{submitUpdate}"/>
	</mx:HBox>
	
</mx:Application>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zzynxSoftware engineerCommented:
>> Your problem is the line:
>> submitUpdate.visible = false;
Indeed. As my previous comment should have made clear.
Why would you use a Boolean if all you want to do is set the visible property of your button?
The solution in my previous comment should simply work.
0
mplordCommented:
I interpreted the author's example as possibly trying to use databinding rather than just setting the button visibility directly.
Using databinding, he might also want to set the visibility of other controls etc.

I'm providing a databinding option, it's up to the question author to decide which solution he wants to pursue.
0
Jones911Commented:
Both solutions are equally viable.  Without seeing more of the OP's code its hard to really know what they want.
0
20oneAuthor Commented:
Thank´s guys for helping. I will try it later, when i come home.
0
zzynxSoftware engineerCommented:
>> Thank´s guys for helping.
You're welcome
>> I will try it later, when i come home.
Take your time
0
mplordCommented:
Polite request for an update - please remember to close questions if your issue is resolved, or reply if you need further assistance ;)
0
zzynxSoftware engineerCommented:
Thanx 4 axxepting (although I think you'd have better selected my first comment as assisted solution ;o)
0
20oneAuthor Commented:
Yes, i have ... :) I has been a liitle bit deflected.
Thank´s again for helping!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.