Select to view content in your preferred language

Add checkbox to splash screen to not show

884
14
12-20-2010 08:54 AM
RichardButgereit
Occasional Contributor
Has anybody thought about adding a check box to the Splash Screen so that once displayed, a user can elect to not have the it displayed the next time they visit the site?
Tags (2)
0 Kudos
14 Replies
AYounas
New Contributor III
Hi Rob,

Thanks for your kind help.

I tried it and my Close function now looks like:

protected function btnClose(event:Event):void
   {
    var btn:Button = new Button();
    
    if(checkBox.selected)
     btn.enabled =true;
    else 
     btn.enabled=false;
     //swidget.dontShowSplashAgain(true);
    PopUpManager.removePopUp(this);
   }


When I run my application, my enable button is disabled because in addButtons function I made it:
switch (btnAction)
     {
      case "close":
      {
       btn.enabled = false;
       btn.addEventListener(MouseEvent.CLICK, btnClose);
       break;
      }

When I click on check box, means its value is selected it should actually make button enable. Any help please.

Sorry if its too basic as I am still learing about widgets.

Thanks,

A
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Adi,

   More like this:

            protected function btnClose(event:Event):void
            {
                var btn:Button = new Button();
                
                //If the close button is not enabled we would never get here in the first place.
                    //swidget.dontShowSplashAgain(true);
                PopUpManager.removePopUp(this);
            }


and

                    switch (btnAction)
                    {
                        case "close":
                        {
                            btn.enabled = checkBox.selected;
                            btn.addEventListener(MouseEvent.CLICK, btnClose);
                            break;
                        }
0 Kudos
AYounas
New Contributor III
Thanks again Rob.

I tried exactly as suggested but the Agree button stays disabled even if I check the checkbox:

switch (btnAction)
     {
      case "close":
      {
       btn.enabled = checkBox.selected;
       btn.addEventListener(MouseEvent.CLICK, btnClose);
       break;
      }

and
protected function btnClose(event:Event):void
   {
    var btn:Button = new Button();
    
    if(checkBox.selected)
     btn.enabled =checkBox.selected;
    //swidget.dontShowSplashAgain(true);
    PopUpManager.removePopUp(this);
   }


Checkbox
<s:VGroup horizontalAlign="center" verticalAlign="middle" gap="5" width="100%">
   <s:CheckBox id="checkBox" selected="false" label="I accept Terms and Conditions." />
   <s:HGroup id="bGroup" horizontalAlign="center" verticalAlign="middle" gap="10" width="100%"/>
  </s:VGroup>


Any other suggestion please?

Thanking you in advance.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Adi,

   Hmm... That was a little more difficult then I thought it should be...

<s:CheckBox id="checkBox" selected="false" label="I accept Terms and Conditions." change="checkBox_changeHandler(event)"  />
            protected function checkBox_changeHandler(event:Event):void
            {
                for (var b:int = 0; b<bGroup.numElements; b++){
                    if (Button(bGroup.getElementAt(b)).name == "")
                        Button(bGroup.getElementAt(b)).enabled = checkBox.selected;
                }
            }


Once again there is no need to have anything in the btnClose function because it will not get fired if the button is not enabled.

            protected function btnClose(event:Event):void
            {
                PopUpManager.removePopUp(this);
            }
0 Kudos
AYounas
New Contributor III
Adi,

   Hmm... That was a little more difficult then I thought it should be...

<s:CheckBox id="checkBox" selected="false" label="I accept Terms and Conditions." change="checkBox_changeHandler(event)"  />
            protected function checkBox_changeHandler(event:Event):void
            {
                for (var b:int = 0; b<bGroup.numElements; b++){
                    if (Button(bGroup.getElementAt(b)).name == "")
                        Button(bGroup.getElementAt(b)).enabled = checkBox.selected;
                }
            }


Once again there is no need to have anything in the btnClose function because it will not get fired if the button is not enabled.

            protected function btnClose(event:Event):void
            {
                PopUpManager.removePopUp(this);
            }


Excellent!!! That is what I wanted! Thanks alot.

Adnan
0 Kudos