Solved

Open window with buttons when a button is clicked?

Posted on 2011-03-09
2
210 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

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…
In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

19 Experts available now in Live!

Get 1:1 Help Now