Jay Roy
asked on
display popup at a specific location
hi guys
I have a situation where i am displaying a popup when user clicks on a button. My requirment is the pop-up window should pop-up right above the button. I can give x and y coordinates but that might not be the best way to do it since if the monitor size changes the x and y coordinates
change. Any idea how i can resolve this?
right now this is my code
when button is clicked i am calling this function
private function launchPopUp(e:MouseEvent): void {
var popupwindow : Window = new Window();
PopUpManager.addPopUp(popu pwindow,th is,true);
PopUpManager.centerPopUp(p opupwindow ); //this needs to be removed because i dont want pop-up to be in center, instead i want it to display right above the button which is clicked.
}
and this is my Window.mxml
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical" width="286" height="292"
title="bla" horizontalAlign="center"
showCloseButton="true"
close="closeWindow(event); " verticalAlign="top"
x, y > -- dont want to give x and y coordinates
<mx:Script>
<![CDATA[
import com.ms.ewq.entity.project. ProjectDet ailDTO;
import mx.core.IFlexDisplayObject ;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
import mx.collections.ArrayCollec tion;
private function closeWindow(e:CloseEvent): void {
PopUpManager.removePopUp(e .target as IFlexDisplayObject);
}
]]>
</mx:Script>
<mx:label text="data"/> --show this in the pop-up
</mx:TitleWindow>
any help appreciated
thanks
I have a situation where i am displaying a popup when user clicks on a button. My requirment is the pop-up window should pop-up right above the button. I can give x and y coordinates but that might not be the best way to do it since if the monitor size changes the x and y coordinates
change. Any idea how i can resolve this?
right now this is my code
when button is clicked i am calling this function
private function launchPopUp(e:MouseEvent):
var popupwindow : Window = new Window();
PopUpManager.addPopUp(popu
PopUpManager.centerPopUp(p
}
and this is my Window.mxml
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical" width="286" height="292"
title="bla" horizontalAlign="center"
showCloseButton="true"
close="closeWindow(event);
x, y > -- dont want to give x and y coordinates
<mx:Script>
<![CDATA[
import com.ms.ewq.entity.project.
import mx.core.IFlexDisplayObject
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
import mx.collections.ArrayCollec
private function closeWindow(e:CloseEvent):
PopUpManager.removePopUp(e
}
]]>
</mx:Script>
<mx:label text="data"/> --show this in the pop-up
</mx:TitleWindow>
any help appreciated
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
You can get the x,y coordinates dynamically from mouse click event and use that for popup..
-mahe
You can get the x,y coordinates dynamically from mouse click event and use that for popup..
-mahe
function whileClick(event:MouseEvent):void
{
//use event.localX , event.localY
//or
//event.stageX,event.stageY
}
sunsonmahesh, please don't repeat what I already said...
ASKER
zzynx:
thanks , that works. One more question i had was when button is clicked the pop-up window shows up but the background fades. how can i avoid that?
thanks.
thanks , that works. One more question i had was when button is clicked the pop-up window shows up but the background fades. how can i avoid that?
thanks.
>> the background fades
That's normal Flex behaviour. It indicates it is a model pop up window.
>> how can i avoid that?
Always think twice before changing standard behaviour. It could confuse the user who is used to such UI conventions.
Why would you want to avoid that?
That's normal Flex behaviour. It indicates it is a model pop up window.
>> how can i avoid that?
Always think twice before changing standard behaviour. It could confuse the user who is used to such UI conventions.
Why would you want to avoid that?
But if - after having thought twice - you still want to avoid it, I think here's the answer:
http://mprami.wordpress.com/2008/04/22/alert_popup_modal_transparancy_color_blur_changes/
http://mprami.wordpress.com/2008/04/22/alert_popup_modal_transparancy_color_blur_changes/
The third parameter to addPopup or createPopup controls modality. Per default you create non-modal dialogs (modal = false) ... if you set this to true you completely get rid of the gray background and can continue to access the background (If you are vreating something like Property views).
ASKER
Yeah, it actually does make sense, i dont want to avoid it.
thanks
Any help with my next question will be greatly appreciated.
https://www.experts-exchange.com/questions/26871467/Text-in-Textareas.html
thanks
Any help with my next question will be greatly appreciated.
https://www.experts-exchange.com/questions/26871467/Text-in-Textareas.html
ASKER
oops, ChristoferDutz , just saw your solution. thanks.
Thanx 4 axxepting
>> It indicates it is a model pop up window.
in my comment should of course have been:
It indicates it is a modAl pop up window.
>> if you set this to true you completely get rid of the gray background
Setting the 3rd parameter to true is creating a modal pop up, so I don't think the above is right
>> It indicates it is a model pop up window.
in my comment should of course have been:
It indicates it is a modAl pop up window.
>> if you set this to true you completely get rid of the gray background
Setting the 3rd parameter to true is creating a modal pop up, so I don't think the above is right
1. You take the coordinates of the point where the user clicked the button
2. You convert those local coordinates to global (cf. http://livedocs.adobe.com/flex/3/html/help.html?content=containers_intro_5.html)
3. You use those global ones to position your popup window