Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-13-2007, 02:48 PM   #1
flexcoder
Registered User
 
Join Date: Nov 2007
Posts: 5
Default Dialog box / new window in Flex?

Hello,

I am working on this Flex project where I have a "Save" button. What I want is that a small window pops up when the button is clicked, and allow the user to enter som text into an TextInput control. I then need to access this value from my main application afterwards.

I just need a simple way to allow for some user input, without having to include it in the same panel as the rest of the application. Something like a small, floating panel.

Is there any way to do this?

Thanks in advance!

Last edited by flexcoder; 11-13-2007 at 02:51 PM.
flexcoder is offline   Reply With Quote
Old 11-13-2007, 06:02 PM   #2
blackelement
Nothing cant be done
 
Join Date: Nov 2007
Location: PA
Posts: 58
Send a message via AIM to blackelement Send a message via MSN to blackelement
Wink

You want to accomplish this with the PopUpManager class. It is designed to popup a mxml component or actionscript class above the Application. You can also have it make a modal so the user is forced to aknowedge and react to the popup.

What I would do is this, create a new mxml component that is based of a Panel || TitleWindow of some sort. Within it make your TextInput and an "OK" or whatever button and title. Create a script tag that is nammed appropriatly to handle the button click (maybe btnClickHandler?). Write a custom class that extends Event (flash.events.Event) and program it to save a data variable which will be populated by the users input. In your btnClickHandler program this
ActionScript Code:
this.dispatchEvent(new MyEvent("userReaction" textinput.text))
Then add in a metadata tag that contains this
ActionScript Code:
[Event(name="userReaction", type="path.to.MyEvent")]

In your main application you code should be something like this:
ActionScript Code:
var instance:MyMXMLComponent = PopUpManager(this, MyMXMLComponent, true); instance.addEventListener("userReaction", userReactionHandler); // end of function call here private function userReactionHandler(event:MyEvent):void {      youraction = event.data // you passed this to the MyEvent as the users input }

Class references:
PopUpManager: http://livedocs.adobe.com/flex/2/lan...UpManager.html
Event: http://livedocs.adobe.com/flex/2/lan...nts/Event.html
blackelement is offline   Reply With Quote
Old 11-14-2007, 08:50 AM   #3
flexcoder
Registered User
 
Join Date: Nov 2007
Posts: 5
Default

Thanks!

That's exactly what I was looking for.
flexcoder is offline   Reply With Quote
Old 11-15-2007, 11:15 PM   #4
flexcoder
Registered User
 
Join Date: Nov 2007
Posts: 5
Default

One more question; I've made the popup modal and by default the frame around the window (title bar) becomes slightly transparent. How can I change that?

I have tried to set both the alpha value for the TitleWindow component, but it makes no change.
flexcoder is offline   Reply With Quote
Old 11-16-2007, 01:51 AM   #5
blackelement
Nothing cant be done
 
Join Date: Nov 2007
Location: PA
Posts: 58
Send a message via AIM to blackelement Send a message via MSN to blackelement
Default

ActionScript Code:
sometitlewindow.setStyle("borderAlpha", 1);
acceptable values are anywhere from 0 - 1, default alpha is 0.4
Reference: http://livedocs.adobe.com/labs/flex3...le:borderAlpha
blackelement is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial for Launching a Centered Pop-Up Window vazbo ActionScript 1.0 (and below) 9 01-01-2010 11:01 PM
Getting past the Illustrator Import Dialog box using JSFL [email protected] JSFL - Extending Flash 1 04-14-2009 07:27 PM
Simple noob question File Browse Dialog box lflashNinjal ActionScript 2.0 0 11-06-2007 08:45 PM
Browse files dialog box blu3 Flex 2, 3 & 4 2 06-04-2007 05:29 PM
A shot in the dark - !please read! seeFresh ActionScript 2.0 2 09-01-2005 03:07 PM


All times are GMT. The time now is 11:55 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.