Is there a way to listen for events on the pop up manager class?

后端 未结 2 450
忘了有多久
忘了有多久 2021-01-23 04:51

I\'m trying to detect when pop ups are visible (including tool tips if possible). The reason is that I need to hide or freeze (capture a snapshot) the Stage* components (StageWe

2条回答
  •  生来不讨喜
    2021-01-23 05:34

    For my Spark Application I had to make a few other modifications to RIAStar's answer. My custom class was not found in the preloader.initialize() yet ( ApplicationDomain.currentDomain.getDefinition()) so I added an event listener for the PRELOADER_DOC_FRAME_READY event.

    package com.mydomain.preloaders {
    
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.system.ApplicationDomain;
        import flash.utils.getDefinitionByName;
    
        import mx.core.Singleton;
        import mx.events.FlexEvent;
        import mx.preloaders.SparkDownloadProgressBar;
    
        public class RegisteringPreloader extends SparkDownloadProgressBar {
    
            public function RegisteringPreloader() {
    
            }
    
            public var preloaderSprite:Sprite;
    
            override public function set preloader(value:Sprite):void {
                super.preloader = value;
    
                preloaderSprite = value;
    
                value.addEventListener(FlexEvent.PRELOADER_DOC_FRAME_READY, preloaderCompleteHandler);
    
            }
    
            protected function preloaderCompleteHandler(event:Event):void {
                var myCustomClass:Class;
                var classPath:String;
                var hasDefinition:Boolean;
    
                preloaderSprite.addEventListener(FlexEvent.PRELOADER_DOC_FRAME_READY, preloaderCompleteHandler);
    
                classPath = "com.domain.managers::MyClassImpl";
                hasDefinition = ApplicationDomain.currentDomain.hasDefinition(classPath);
    
                if (hasDefinition) {
                    myCustomClass = Class(getDefinitionByName(classPath));
    
                    Singleton.registerClass("mx.managers::ISingletonClass", myCustomClass);
                }
            }
        }
    }
    

    The rest of the steps are the same as RIAStar's.

提交回复
热议问题