Solved

Open window with buttons when a button is clicked?

Posted on 2011-03-09
2
213 Views
Last Modified: 2012-05-11
hi guys

I have a requirment where when a user clicks on a button i want a small window to pop-up. The window should say

'Are you sure you want to submit?' and should contain two buttons 'Yes' and 'No'.

Any idea how i can acchieve this with flex?


thanks
0
Comment
Question by:royjayd
2 Comments
 
LVL 37

Assisted Solution

by:CyanBlue
CyanBlue earned 100 total points
ID: 35094262
I think this tutorial just do what you need to do...
   http://www.roseindia.net/flex/flex-alert-box.shtml

CyanBlue
0
 
LVL 2

Accepted Solution

by:
sunsonmahesh earned 400 total points
ID: 35094898
Hi
as CyanBlue said using alert is easiest way..
if u really want a window of ur own ,u have to create a window and add buttons and message to that window,and add event listeners and display (everything have to be done by u)..

-mahesh
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init()">

    <mx:Script>
        <![CDATA[
            import mx.containers.ControlBar;
            import mx.containers.Panel;
            import mx.containers.VBox;
            import mx.controls.Button;
            import mx.controls.Label;
            import mx.controls.Spacer;
            import mx.controls.TextInput;
            import mx.managers.PopUpManager;

            private var panel:Panel;

            private function init():void {
                var vb:VBox = new VBox();
                var label:Label = new Label();
                var textInput:TextInput = new TextInput();

                var cb:ControlBar = new ControlBar();
                var s:Spacer = new Spacer();
                var b1:Button = new Button();
                var b2:Button = new Button();

                s.percentWidth = 100;

                b1.label = "Yes";
                b1.addEventListener(MouseEvent.CLICK, closePopUp);
                b2.label = "No";
                b2.addEventListener(MouseEvent.CLICK, closePopUp);

                cb.addChild(s);
                cb.addChild(b1);
                cb.addChild(b2);

                label.text = "Your message here:";

                vb.setStyle("paddingBottom", 5);
                vb.setStyle("paddingLeft", 5);
                vb.setStyle("paddingRight", 5);
                vb.setStyle("paddingTop", 5);
                vb.addChild(label);
                vb.addChild(textInput);

                panel = new Panel();
                panel.title = "My Title";
                panel.width = 240;
                panel.height = 180;
                panel.addChild(vb);
                panel.addChild(cb);
            }

            private function closePopUp(evt:MouseEvent):void {
                PopUpManager.removePopUp(panel);
            }

            private function createPopUp(evt:MouseEvent):void {
                PopUpManager.addPopUp(panel, this, true);
                PopUpManager.centerPopUp(panel);
            }
        ]]>
    </mx:Script>

    <mx:Button label="Launch Pop-Up" click="createPopUp(event)" />

</mx:Application>

Open in new window

0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Highlight/Sticky Note/Bookmark page - SWF file 9 345
AS3 Image Edit Package 3 555
Flash Social Media 2 497
CheckBox inside itemRenderer issue 13 590
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Employees depend heavily on their PCs, and new threats like ransomware make it even more critical to protect their important data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now