Re: Modal background is not centered if modal is shown while minimized

2017-06-06 Thread Kyle McKnight
Perfect, thanks!

On Jun 6, 2017 1:52 PM, "Nemi" <nemino...@gmail.com> wrote:

> Great that I helped. No need to delve into SDK source.
>
> I found the bug: https://issues.apache.org/jira/browse/FLEX-16946
>
> Some notes:
> More performant way to move popups is popupitem.move(x,y)
>
> To get background FlexSprite, I used:
> bgsprite = systemManager.getChildAt(popupsitemIndex - 1)
>
> then checked: if bgsprite.name = "modelWindow"
>
> then you use bgsprite.graphics to redraw it:
> - clear()
> - beginFill(..use your default Alert CSS style values...)
> - drawRect(0,0,win.width, win.height) to stretch it fullscreen
>
>
>
>
> --
> View this message in context: http://apache-flex-users.
> 246.n4.nabble.com/Modal-background-is-not-centered-if-
> modal-is-shown-while-minimized-tp15286p15292.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>


Re: Modal background is not centered if modal is shown while minimized

2017-06-06 Thread Nemi
Great that I helped. No need to delve into SDK source.

I found the bug: https://issues.apache.org/jira/browse/FLEX-16946

Some notes:
More performant way to move popups is popupitem.move(x,y)

To get background FlexSprite, I used:
bgsprite = systemManager.getChildAt(popupsitemIndex - 1)

then checked: if bgsprite.name = "modelWindow"

then you use bgsprite.graphics to redraw it:
- clear() 
- beginFill(..use your default Alert CSS style values...) 
- drawRect(0,0,win.width, win.height) to stretch it fullscreen




--
View this message in context: 
http://apache-flex-users.246.n4.nabble.com/Modal-background-is-not-centered-if-modal-is-shown-while-minimized-tp15286p15292.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: Modal background is not centered if modal is shown while minimized

2017-06-06 Thread Nemi
I had that issue too. That is a bug. I think its reported, but don't recall
the issue ID. Problem could be that PopUpManager somewhere reads
nativeWindow/window/parent size, and if nativeWindow is minimized, size is
0,0 so there bug happens.

Try this workaround/fix: 
1. listen window's native display change state event, 
2. and within it, check if prev state was minimized, and new state is not
(means: user is restoring window)
3. then if true, loop all popup children, check ones you look for (read
class name, or "modalWindow" property of popup child), re-position it and
its background sprite, and set sprites size as parent window's one.
4. user wont notice repositioning and all looks nice

Test it quickly this way: create sample app, with button that does: minimize
app, than after 1 second, creates popup or better few of them(as you can
have more popups in app). When you restore app window, if all popups are
where they should be, you fixed it.

Helpful links:
https://stackoverflow.com/questions/7323505/flex-how-to-determine-if-a-popupmanager-window-is-open-or-when-it-has-closed
https://weflex.wordpress.com/tag/popupmanager/
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/PopUpManagerChildList.html



--
View this message in context: 
http://apache-flex-users.246.n4.nabble.com/Modal-background-is-not-centered-if-modal-is-shown-while-minimized-tp15286p15288.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: Modal background is not centered if modal is shown while minimized

2017-06-06 Thread kamcknig
<http://apache-flex-users.246.n4.nabble.com/file/n15287/message_centered_-_grayed_in_corner.png>
 



--
View this message in context: 
http://apache-flex-users.246.n4.nabble.com/Modal-background-is-not-centered-if-modal-is-shown-while-minimized-tp15286p15287.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.


Modal background is not centered if modal is shown while minimized

2017-06-06 Thread Kyle McKnight
I'm using Flex 4.15, AIR 20.0.

I have an idle timer on my app that logs a user out after a certain amount
of time. If I start my app and then minimize it immediately and wait for
the idle time to pass so that the modal is shown while it's minimized and
then restore the window, the modal background is centered around the
top-left corner rather than being centered in the application. If I use
PopUpManager I can center the modal itself, but the background is still
off-center. Anyone know how to get that centered? Should I just hide and
reshow the modal?

[image: Inline image 1]

Kyle McKnight
Senior UI Engineer - Accesso
602.515.1444 (M)