Adobe AIR - Custom Preloader with Image

前端 未结 3 1657
暗喜
暗喜 2020-12-01 23:00

Folks,

I have designed an Adobe AIR application. I want to show some preloader on it, before it opens up.

Can anyone guide me with

3条回答
  •  星月不相逢
    2020-12-01 23:34

    With AIR I can think of a couple of ways to achieve that:

    1. with native windows

    Set the 'visible' attribute of your main WindowedApplication to 'false'. On 'creationComplete' event spawn a new Window that contains your splash screen. Perform the necessary logic before showing the app. When the bootstrap is done close the splash screen and set the main appliation's 'visible' to 'true'.

    2. in one window, using states

    Create 2 states (e.g. 'loading' and 'normal'). Set the 'currentState' attribute of your main WindowedApplication to 'loading'. In this state display your splash screen. Perform the necessary logic before showing the app. When the bootstrap is done, set the 'currentState' attribute to 'normal'. In the 'normal' state display your actual application.

    3. transparent application

    With a transparent AIR application, you could work with states (as in n° 2) and fake windows. Your main application will then be a transparent window that covers the entire screen. You can now position the splash screen and the main view wherever you wish inside this transparent window. Don't worry: you can click through transparent windows so nothing will be blocked.

    I could show you some code, but I'd need more specific information about your application.

    Edit: example

    The easiest solution would be nr 2:

    
    
        
            
        
    
        
            
            
         
    
        
        
    
    
    

    example with windows

    
    
        
            
    
        
    
    
    

    This one requires more explanation: in your application you'll have to set 'systemchrome' to 'none', 'visible' to 'false' and 'transparent' tot 'true'. You also have to set the 'visible' attribute to 'false'. These settings will effectively hide the main application window. We then sequentially create a window for the splash screen and one for the main view. It is important that the main WindowedApplication stays invisible, because another approach would make that window briefly visible before the splash screen shows up (seems to be a bug).

提交回复
热议问题