I'm trying to skin a Window using setStyle("SkinClass"..). To do this. i've made a siply program that skin my window, and surprisingly (yes surprisingly using flex these days..) it works.. this is my code..
|protected function openwin_clickHandler(event:MouseEvent):void|
|var tableWindow:Window = new Window();|
|tableWindow.width = 600;|
|tableWindow.height = 500;|
|tableWindow.minWidth = 600;|
|tableWindow.minHeight = 500;|
|tableWindow.type = NativeWindowType.UTILITY;|
|tableWindow.systemChrome = NativeWindowSystemChrome.ALTERNATE;|
|tableWindow.resizable = false;|
|tableWindow.maximizable = false;|
|var l:Label = new Label();|
|l.text = "ciao";|
Happy for this "great" piece of software i've decided to get this code and put ii in my main program..
And with my great surprise... it doesn't work! Cool!
Basically.. the window is opened but nothing is shown into.. the label (added for test purpose..) is not shown and neither the drawn hand resize on bottom right. Nothing.
So. in the same program i've decided to add a small button that call the same function.. and strange.. it works! BUT... if i click on my previous datagrid that should open the window i'm trying to open correctly it doesn't work.. and the worst thing is that the test button i've added doesn't display the window correctly!
So my question is... in which way THE SAME code could be destroy eveything??
Please help me sice flex is getting me crazy these days..
I've discovered that the problem occurs if the function is called after a remoting and a subsequent call..
|parentApplication.servers[parentApplication.currentHostConnected].refr eshTokenToken = parentApplication.servers[parentApplication.currentHostConnected].ser verRemoting.refreshToken(parentApplication.userLogged.username, parentApplication.UUID, parentApplication.IPAddress, gameID, selectedItem);|
|parentApplication.servers[parentApplication.currentHostConnected].refr eshTokenToken.addResponder(new AsyncResponder(refreshTokenHandler, parentApplication.stub_onFault));|
|public function refreshTokenHandler(event:ResultEvent, token:AsyncToken=null):void|
|openGame(gameid, tableid, host);|
if i call openGame directly it works... if it is called by that handler it doesn't work...
the problem is neither the asynctoken (luckily..).
I have three datagrid that call the same function (openGame).
If i call it from the first grid that is SAME other grid the window seems opened without any element into.. indeed also the addEventListener is never fired.. if i change the grid (using currentState) the other grid open the window correctly... but event returning to the first grid doesn't help.. the window is opened without any content..
Another discovery.. i've create a class that extends Window.. well, i've tried to override the initialized() property and i've seen that it is never called on the first case while in the second one is called correctly. So that damned window is not opened correctly.. i have no errors but for a strange bug somewhere it is not opened correctly..
That's really weird... i'm hating flex so much..
Another one.. i've seen that Window.as has this constructor:
public function Window()
in the first case.. the creationCompleteHandler is called when i change the current state of my main app!! in the second case it is called correctly when the window has been opened..
If i don't change the currentState of my app the creationCompleteHandler is never called!
How this can be possible??
No.. actually is not possible.. because i've tried to understand what is wrong using a small program and the effect is not reproducible.. I would..
At moment i call two currentState = "newstate" and currentState="oldState" and all is working correctly.. if i uncomment those lines the effect is visible..