Shared code problem. See my blog
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Guilherme Blanco Sent: Wednesday, July 16, 2008 7:19 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Error #1034: Type Coercion failed.... how to solve? Hi all, I'm in troubles here... researching the internet furiously while post it here. I have in my application that loads a module and instantiate it inside an instance of class core.controls.ModalDialog, class that I wrote extended from TitleWindow. The source is really simple... here is the implementation of module load event: protected function handleCreateCompanyModuleLoad(event:ModuleEvent):void { var dialog:ModalDialog = ModalDialog(PopUpManager.createPopUp(Application(Application.application ), ModalDialog, true)); // Dialog customization dialog.title = "Create Company"; dialog.width = 450; dialog.height = 270; dialog.showCloseButton = true; // Dialog content customization var ui:* = event.module.factory.create(); dialog.addChild(ui); } One of the buttons inside the module closes the ModalDialog, which should be accessible through this.parent or this.owner. Since I know I'm always inside of it, I cast the property to prevent Flex from popping my errors... <mx:Button label="Cancel" click="close();"/> protected function close():void { //ModalDialog(parent).close(); ModalDialog(owner).close(); } Everytime I execute the code and click in the "Cancel" button... it throws this runtime error: TypeError: Error #1034: Type Coercion failed: cannot convert core.controls::[EMAIL PROTECTED] to core.controls.ModalDialog. Any ideas how do I solve this? PS: Inside the application module (it's 100% modular) I already imported the ModalDialog and inside the module too.... researching the internet I saw someone telling that missing this might be a problem (solved the requester' issue), but didn't have any effect for me... []s, -- Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9166-6902 MSN: [EMAIL PROTECTED] <mailto:guilhermeblanco%40hotmail.com> URL: http://blog.bisna.com <http://blog.bisna.com> Rio de Janeiro - RJ/Brazil