Hi Faisal, I think the problem is in the way you are adding the window. Since you are just using addChild(), the window is never assigned a windowManager and I think that is what is null. If you say mdic.windowManager.add( window ), it will addChild() for you and also set the windowManager property correctly. Try that and I think you will be all set.
That said, I think its completely reasonable to expect things to work the way you had them coded. I am going to look at overriding addChild() in MDICanvas to support that workflow so look for that in a future release. Thanks, Ben --- In [email protected], "Faisal Abid" <[EMAIL PROTECTED]> wrote: > > I have an application where the FlexMDI windows are being created > dynamicly via actionscript however the MDICanvas is being created on > inital application creation. When i make the state go to another state > other then the default and try to add an mdiwindow, it adds fine > however when you click on it it gives errors about titlebar being > pressed and bringtofrontproxy . here is the basic code. > > btw im using the latest flexlib build (downloaded it today) , i tried > this with the old flexmdi build also , same problem. > > // on second state call create widgetfunction > private function createWidgets():void{ > this.mdic.effects = new MDIVistaEffects > var widgetWindow:MDIWindow = new MDIWindow(); > widgetWindow.title = "Your Live Widgets"; > widgetWindow.width = 400; > widgetWindow.height = 400; > this.mdic.addChild(widgetWindow); > } > > when i do that the window creates, but when i click on the window i > get this error > > TypeError: Error #1009: Cannot access a property or method of a null > object reference. > at > flexmdi.containers::MDIWindow/onTitleBarPress()[/_projects/flexmdi/src/flexmdi/containers/MDIWindow.as:1406] > > and then this error right after > > ypeError: Error #1009: Cannot access a property or method of a null > object reference. > at > flexmdi.containers::MDIWindow/bringToFrontProxy()[/_projects/flexmdi/src/flexmdi/containers/MDIWindow.as:1316] >

