Re: [flexcoders] Re: Visible issue
On Friday 30 Jan 2009, lehaianh1986 wrote: > In debug mode the error at line > "NativeApplication.nativeApplication.activeWindow.stage.nativeWindow.visibl >e = true; " > > how to solve it? Find out what is null. -- Tom Chiverton Helping to carefully reintermediate real-time high-end e-commerce This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word ?partner? to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com.
[flexcoders] Re: Visible issue
> I've got something like > creationCompleteHandler: > var sysTrayIcon:SystemTrayIcon = > NativeApplication.nativeApplication.icon as > SystemTrayIcon; > sysTrayIcon.addEventListener(MouseEvent.CLICK,undock); > > undock: > if (!stage.nativeWindow.visible){ > stage.nativeWindow.visible = true; > stage.nativeWindow.activate(); > > }else{ > stage.nativeWindow.visible=false; > } > and it works here to show/hide the main application window. > > Where are you assigning the event handler, and why are you using the funny > inline function syntax ? > If you stop it in the debugger, what is the bit that is actually null ? > > -- > Tom Chiverton Thank Tom very much. In my country, few days ago is Lunar new year so I don't work and reply :( Your solution is very good if the event handler in MXML file. I correct my code follow you and have good result. But I have only special case, the event handler in AS class My code in main.mxml ... and code in systrayapp.as file package com { import flash.desktop.DockIcon; import flash.desktop.NativeApplication; import flash.desktop.SystemTrayIcon; import flash.display.Loader; public class SysTrayApp extends Sprite { public function SysTrayApp():void{ NativeApplication.nativeApplication.autoExit = false; var icon:Loader = new Loader(); var iconMenu:NativeMenu = new NativeMenu(); var showCommand:NativeMenuItem = iconMenu.addItem(new NativeMenuItem("Show")); showCommand.addEventListener(Event.SELECT, function(event:Event):void { NativeApplication.nativeApplication.activeWindow.stage.nativeWindow.visible = true; }); } So the error display when I click "show" menuitem in taskbar TypeError: Error #1009: Cannot access a property or method of a null object reference. In debug mode the error at line "NativeApplication.nativeApplication.activeWindow.stage.nativeWindow.visible = true; " how to solve it?