Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

air nativemenuItem and systemtray problem

$
0
0

package {

 

 

          import flash.display.MovieClip;

          import flash.display.*;

          import flash.events.*;

          import flash.ui.*;

          import flash.net.*;

          import flash.desktop.*;

          import fl.controls.DataGrid;

          import fl.controls.dataGridClasses.*;

          import flash.utils.Timer;

 

 

          public class kuyumcu extends MovieClip {

                    var id:Number=0;

                    //contek menu ayarları

                    public var my_menu:ContextMenu = new ContextMenu();

                    public var my_company:ContextMenuItem=new ContextMenuItem("Rize Kuyumcular Derneği - 2012");

 

 

                    //program giriş nesneleri

                    public var giris:login;

                    public var ekranMc:ekran;

                    var girisdemisin:Boolean=false;

                    var ekrandamisin:Boolean=false;

                    var mesajAcikmi:Boolean=false;

 

 

                    var loader:Loader = new Loader();

 

 

                    var mesajkontrolurl:URLRequest=new URLRequest("http://www.rikud.org/sql/mesajvarmi.php");

                    var mesajkontrolloader:URLLoader=new URLLoader();

                    var mesajkontrolvars:URLVariables = new URLVariables();

 

 

                    var sayac:Timer=new Timer(30000,0);

 

 

          private var gosterTrayButonu:NativeMenuItem=new NativeMenuItem("Göster");

                    private var gizleTrayButonu:NativeMenuItem=new NativeMenuItem("Gizle");

                    private var mesajlarTrayButonu:NativeMenuItem=new NativeMenuItem("Mesajlar");

                    private var kapatTrayButonu:NativeMenuItem=new NativeMenuItem("Programı Kapat");

 

 

          var trayMenu:NativeMenu = new NativeMenu();

 

 

 

 

 

 

                    public function kuyumcu () {

                              addEventListener ( Event.ADDED_TO_STAGE, sahnede, false, 0, true );

                    }

 

 

                    function sahnede (e:Event) {

                              my_menu.hideBuiltInItems ();

                              my_company.addEventListener (ContextMenuEvent.MENU_ITEM_SELECT, openLink);

                              my_menu.customItems.push (my_company);

                              contextMenu=my_menu;

 

 

 

 

                              stage.scaleMode="noScale";

                              stage.align="top_left";

 

 

                              stage.addEventListener (Event.RESIZE, onSizeChange);

                              giris=new login(stage.stageWidth,stage.stageHeight);

                              giris.addEventListener ("girisOK", loginOK);

                              girisdemisin=true;

                              addChild (giris);

                    }

 

 

                    function loginOK (e:loginEvent) {

                              sayac.addEventListener (TimerEvent.TIMER, sayacAt);

                              sayac.start ();

 

 

                              id=Number(e.kullaniciID);

 

 

                              mesajkontrolurl.method=URLRequestMethod.POST;

                              mesajkontrolvars.id=id;

                              mesajkontrolurl.data=mesajkontrolvars;

                              mesajkontrolloader.addEventListener (Event.COMPLETE, mesajKontrol);

                              mesajkontrolloader.load (mesajkontrolurl);

 

 

                              girisdemisin=false;

 

 

                              ekranMc=new ekran(id);

                              addChild (ekranMc);

                              //stage.displayState=StageDisplayState.FULL_SCREEN_INTERACTIVE;

                              removeChild (giris);

                              ekranMc.konumlandir ();

                              ekrandamisin=true;

                              //trayaAt ();

                    }

 

 

                    function sayacAt (e:TimerEvent):void {

                              if (! mesajAcikmi) {

                                        mesajkontrolurl.method=URLRequestMethod.POST;

                                        mesajkontrolvars.id=id;

                                        mesajkontrolurl.data=mesajkontrolvars;

                                        mesajkontrolloader.addEventListener (Event.COMPLETE, mesajKontrol);

                                        mesajkontrolloader.load (mesajkontrolurl);

                              }

                    }

 

 

                    function mesajKontrol (e:Event):void {

                              if (e.target.data=="mesajvar½0") {

 

 

                              } else if (e.target.data == "mesajvar½1") {

                                        createNativeWindow ();

                              }

                    }

 

 

                    function phpGeldi (e:Event) {

                              trace (e.target.data);

                    }

 

                    public function onSizeChange (e:Event) {

                              if (girisdemisin) {

                                        giris.konumlandir ();

                              }

                              if (ekrandamisin) {

                                        ekranMc.konumlandir ();

                              }

                    }

 

 

                    public function openLink (e:ContextMenuEvent):void {

                              navigateToURL (new URLRequest("http://www.*****.org"));

                    }

 

                    function trayaAt () {

                              //pencere ayarları

                              var simgeWin:String="/icons/16x16.png";

                              var simgeMac:String="/icons/128x128.png";

                              var simgeYukleyici:Loader = new Loader();

 

 

              trayMenu.addItem (gosterTrayButonu);

              trayMenu.addItem (gizleTrayButonu);

              trayMenu.addItem (mesajlarTrayButonu);

              trayMenu.addItem (kapatTrayButonu);

 

 

                              if (NativeApplication.supportsSystemTrayIcon) {

                                        NativeApplication.nativeApplication.autoExit=false;

                                        simgeYukleyici.contentLoaderInfo.addEventListener (Event.COMPLETE, simgeYuklendi);

                                        simgeYukleyici.load (new URLRequest(simgeWin));

                              }

 

 

                              if (NativeApplication.supportsDockIcon) {

                                        simgeYukleyici.contentLoaderInfo.addEventListener (Event.COMPLETE,simgeYuklendi);

                                        simgeYukleyici.load (new URLRequest(simgeMac));

                              }

 

 

 

 

              gosterTrayButonu.addEventListener (Event.SELECT, btnGoster);

              gizleTrayButonu.addEventListener (Event.SELECT, btnGizle);

              mesajlarTrayButonu.addEventListener (Event.SELECT, btnMesaj);

              kapatTrayButonu.addEventListener (Event.SELECT, btnKapat);

                    }

 

 

 

 

                    function simgeYuklendi (event:Event):void {

                              if (NativeApplication.supportsSystemTrayIcon) {

                                        var traySimge:SystemTrayIcon=NativeApplication.nativeApplication.icon as SystemTrayIcon;

                                        traySimge.menu=trayMenu;

                              }

 

 

                              if (NativeApplication.supportsDockIcon) {

                                        var macDock:DockIcon=NativeApplication.nativeApplication.icon as DockIcon;

                                        macDock.menu=trayMenu;

                              }

                              NativeApplication.nativeApplication.icon.bitmaps=[event.target.content.bit mapData];

                    }

 

 

                    function btnGoster (event:Event) {

                              stage.nativeWindow.activate ();

                              stage.nativeWindow.visible=true;

                    }

 

 

                    function btnGizle (event:Event) {             

                              stage.nativeWindow.visible=false;

                    }

 

 

                    function btnMesaj (event:Event) {

                              if (! mesajAcikmi) {

                                        createNativeWindow ();

                                        mesajAcikmi=true;

                              }

                    }

 

 

                    function btnKapat (event:Event) {

                              NativeApplication.nativeApplication.icon.bitmaps=[];

                              NativeApplication.nativeApplication.exit ();

                    }

 

 

                    public function createNativeWindow ():void {

                              var mesaj:URLRequest=new URLRequest("/mesaj.swf");

                              loader.contentLoaderInfo.addEventListener (Event.COMPLETE, mesajGeldi);

                              loader.load (mesaj);

 

 

                              //create the init options

                              var options:NativeWindowInitOptions = new NativeWindowInitOptions();

                              options.transparent=false;

                              options.systemChrome=NativeWindowSystemChrome.STANDARD;

                              options.type=NativeWindowType.NORMAL;

 

 

                              //create the window

                              var newWindow:NativeWindow=new NativeWindow(options);

                              newWindow.title="Kuyumcu Ekranı - Mesaj";

                              newWindow.width=600;

                              newWindow.height=400;

 

 

                              newWindow.stage.align=StageAlign.TOP_LEFT;

                              newWindow.stage.scaleMode=StageScaleMode.NO_SCALE;

 

 

                              //activate and show the new window

                              mesajAcikmi=true;

                              newWindow.activate ();

                              newWindow.addEventListener (Event.CLOSE, onClose);

                              newWindow.stage.addChild (loader);

                    }

 

 

                    function mesajGeldi (e:Event):void {

                              MovieClip(loader.content).mesajlarBaslat (Number(id));

                    }

 

 

                    function onClose (e:Event) {

                              mesajAcikmi=false;

                              trace ("kapandı");

                    }

 

 

          }

}

 

 

ok here is my problem. when i run this program using flash player everything is normal and great. ven i run it on a projector there is a problem about NativeMenuItems. when i disable nativemenuitem lines on code air runs good but this time i dont have a try icon and a menu.

 

using air 2.6 and flash professional cs 5.5


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>