Skip to main content
Inspiring
February 24, 2013
Answered

Closing a SkinnablePopUpContainer in actionscript

  • February 24, 2013
  • 3 replies
  • 623 views

I have a SkinnablePopUpContainer as follows: 

  <fx:Component className="AlertMsg">

  <s:SkinnablePopUpContainer x="70" y="300">

                                        <s:TitleWindow fontSize="16" title="MyTitle" horizontalCenter="0" close="close()">

                                                            <s:VGroup  horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="8" paddingRight="8" gap="5" width="100%">

                                                            <s:Label textAlign="center" fontSize="16"

                                                                      text="MyText"/>

                                                            <s:Button label="OK" click="close()"/>

  </s:VGroup>

  </s:TitleWindow>

  </s:SkinnablePopUpContainer>

  </fx:Component> 

This is for a mobile app. When I swipe and navigator.pushView to another view, the Alert remains on the screen.

Any one know how to close the Alert in the actionscript code?

Seems a silly question, but I just cannot refernce the object to clode it:-(

TIA,

Phil.

This topic has been closed for replies.
Correct answer yyterrwihbgd

Not sure why, but:

I was using the following to create the popup alert:

  (new AlertMsg()).open(this, false)

When, I used the following method:

  var alert:AlertMsg = new AlertMsg();

                                                            alert.open(this, true);  

                                                            PopUpManager.centerPopUp(alert);

I cannot swipe to move to another view, until I close the Alert, which is exactly what I want.

So, solved by virtue of centering the popup!

3 replies

Known Participant
February 24, 2013

Hi Phil,

You need to give your Alert an id (e.g. 'myAlert') so that you can reference it in code. You could then add an event listener for the swipe event and, in the handler, call myAlert.close();

HTH,

David

Inspiring
February 25, 2013

Thanks for your response,

I have put ID properties in the Container:

                    <fx:Component className="AlertMsg" id="myClassName">

  <s:SkinnablePopUpContainer x="70" y="300">

  <s:TitleWindow id="myTitlewndow"

... etc ...

But in the swipe handler, I canot access any of the ID's with:

Access of undefined property.

Also code hinting does not show any of the ID's in the swipe handler.

Maybe I need to close all children of the view?

yyterrwihbgdAuthorCorrect answer
Inspiring
February 25, 2013

Not sure why, but:

I was using the following to create the popup alert:

  (new AlertMsg()).open(this, false)

When, I used the following method:

  var alert:AlertMsg = new AlertMsg();

                                                            alert.open(this, true);  

                                                            PopUpManager.centerPopUp(alert);

I cannot swipe to move to another view, until I close the Alert, which is exactly what I want.

So, solved by virtue of centering the popup!