2013-03-30 9 views
0

我正在Flex 4.6空氣應用程序中有一個列表和數據是透明的背景SWF文件。我的問題是,當我雙擊列表項時,受尊重的swf文件應該在後臺播放,或者我們可以在桌面上說,如虛擬女孩的應用程序。如果我們最小化主應用程序,swf應該像虛擬女孩應用程序一樣在桌面上播放。使用柔性播放SWF文件像虛擬女孩

如果有人有任何想法,請告訴我。

Thank你這麼多。

+0

我不太瞭解你在問什麼,但它聽起來像你需要一個透明鍍鉻的AIR應用程序。 – RIAstar

回答

0

您可以使用以下代碼,您將在其中雙擊列表項打開一個mx或spark窗口。

可能是以下對您有用的代碼。

<?xml version="1.0" encoding="utf-8"?> 
<s:Window xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" 
      xmlns:mx="library://ns.adobe.com/flex/mx" 
      xmlns:customcomponents="customs.customcomponents.*" 
      xmlns:services="services.*" 
      width="100%" height="100%" backgroundAlpha="0" 
      creationComplete="window1_creationCompleteHandler(event)" minimizable="false" 
      showStatusBar="false" systemChrome="none" transparent="true"> 

    <fx:Script> 
     <![CDATA[ 
      import air.net.URLMonitor; 

      import dbconnection.Connection; 

      import globalData.DataModel; 

      import mx.collections.ArrayCollection; 
      import mx.core.FlexGlobals; 
      import mx.events.FlexEvent; 
      import mx.utils.UIDUtil; 

      import vo.UserSettingsVo; 

      private var movie:MovieClip; 
      private var movieTotalFrame:int = 0; 
      public var countMovie:int = 0;   
      public var timer:Timer;      
      private var newRate:int = 0; 
      private var mainScreen:Screen = Screen.mainScreen; 
      private var newStyle:CSSStyleDeclaration;   
      private var flagPreNext:String=""; 
      private var flagFullMin:Boolean = false; 
      private var monitor:URLMonitor; 
      private var timerClosePop:Timer; 
      private var sqlStatStatus:SQLStatement; 
      private var objSelectedItem:Object; 

      [Bindable] 
      private var modellocator:DataModel = DataModel.getInstance(); 

      [Bindable]   
      private var uservo:UserSettingsVo = UserSettingsVo.getInstance(); 

      private var connection:Connection = Connection.getInstance(); 

      protected function window1_creationCompleteHandler(event:FlexEvent):void 
      {    
       seqEffect.target = this; 
       rotate.target = canDesktopVideo; 
       loadMovie(0);       
      }  

      protected function myVidTeaser_completeHandler(event:Event):void 
      { 
       trace(modellocator.arrMovie[countMovie].Videoname.toString()); 
       movie = myVidTeaser.content as MovieClip;       

       if(movie != null) 
       { 
        movieTotalFrame = movie.totalFrames; 
        var sizeWidth:Number = 0; 
        var sizeHeight:Number = 0;      

        /** Always on top setting **/ 
        if(modellocator.userSettingsac[0].alwaysontop == "no") 
        { 
         this.alwaysInFront = false; 
        } 
        else 
        { 
         this.alwaysInFront = true; 
        }      

        /** Size Settings **/ 
        if(modellocator.flagMaxMin) 
        { 
         sizeWidth = mainScreen.visibleBounds.width; 
         sizeHeight = mainScreen.visibleBounds.height; 
        } 
        else 
        { 
         sizeWidth = mainScreen.visibleBounds.width*(modellocator.userSettingsac[0].size/100); 
         sizeHeight = mainScreen.visibleBounds.height*(modellocator.userSettingsac[0].size/100); 
        }     

        if(!this.closed) 
        { 
         this.width = mainScreen.visibleBounds.width; 
         this.height = mainScreen.visibleBounds.height; 
        } 

        modellocator.setSizeWidth = sizeWidth; 
        modellocator.setSizeHeight = sizeHeight;      
        rotate.autoCenterTransform = true; 
        rotate.angleYFrom = 0; 
        myMov.xTo = 0; 
        myMov.xFrom = mainScreen.visibleBounds.width;      
        myMov.yFrom = 40; 
        myMov.yTo = 40; 
        myMov.duration = 0;     
        fadeEffect.alphaFrom = 0; 
        fadeEffect.alphaTo = 1.0; 
        fadeEffect.duration = 1000; 
        rotate.play(); 
        seqEffect.play(); 
       }        
      } 

      protected function myVidTeaser_enterFrameHandler(event:Event):void 
      { 
       if(modellocator.flagDesktopVIdeoPlay == true) 
       { 
        if(movie != null) 
        {      
         if(movie.currentFrame == movieTotalFrame) 
         {      
          if(countMovie == (modellocator.arrMovie.length - 1)) 
          { 
           countMovie = 0;      
          } 
          else 
          {        
           countMovie++; 
          }     

          /** Show Time Settings **/ 
          movie.gotoAndStop(0); 
          System.gc(); 
          System.gc(); 
          timer = new Timer(int(modellocator.userSettingsac[0].showtime)*60000); 
          timer.addEventListener(TimerEvent.TIMER, movieLoadOnTimer, false, 0, true); 
          timer.start(); 
         } 
        } 
       } 
       else 
       { 
        if(timer != null) 
        { 
         timer.stop(); 
         timer.removeEventListener(TimerEvent.TIMER, movieLoadOnTimer); 
         timer = null; 
         System.gc(); 
         System.gc(); 
        } 
        event.preventDefault(); 
        event.stopImmediatePropagation(); 
       }         
      } 

      private function movieLoadOnTimer(event:TimerEvent):void 
      { 
       loadMovie(countMovie); 
      } 

      public function loadMovie(num:int):void 
      { 
       if(modellocator.arrMovie != null && modellocator.arrMovie.length > 0) 
       { 
        if(num < modellocator.arrMovie.length) 
        { 
         if(modellocator.arrMovie[countMovie] != null) 
         {       
          if(modellocator.arrMovie[countMovie].VideoBuyFlag == "yes") 
          { 
           if(flash.system.Capabilities.os.indexOf("Mac") > -1) 
           { 
            myVidTeaser.source = "file://" + modellocator.arrMovie[countMovie].VideoFullURL;  
           } 
           else 
           { 
            myVidTeaser.source = modellocator.arrMovie[countMovie].VideoFullURL; 
           } 
          } 
          else 
          { 
           if(flash.system.Capabilities.os.indexOf("Mac") > -1) 
           { 
            myVidTeaser.source = "file://" + modellocator.arrMovie[countMovie].VideoTeaserURL; 
           } 
           else 
           { 
            myVidTeaser.source = modellocator.arrMovie[countMovie].VideoTeaserURL; 
           }     
          } 
         }       
        } 
        else 
        { 
         countMovie = 0; 
         loadMovie(countMovie); 
        }     
       } 
       else 
       { 
        this.close(); 
       } 
      } 



     ]]> 
    </fx:Script> 

    <fx:Declarations> 
     <s:Move id="moveUp" duration="500" target="{this}" yFrom="350" yTo="0"/> 
     <s:Move id="moveDown" duration="500" target="{this}" yFrom="0" yTo="350"/> 
     <s:Sequence id="seqEffect">   
      <mx:Move id="myMov"/>   
      <mx:Fade id="fadeEffect"/> 
     </s:Sequence> 
     <s:Rotate3D id="rotate"/> 
    </fx:Declarations>  

    <mx:Canvas id="canDesktopVideo" width="100%" height="100%" horizontalScrollPolicy="off" 
       verticalScrollPolicy="off"> 
     <s:SWFLoader id="myVidTeaser" right="0" bottom="0" width="{modellocator.setSizeWidth}" 
        height="{modellocator.setSizeHeight}" alpha="{modellocator.setTransparency}" 
        buttonMode="true" 
        complete="myVidTeaser_completeHandler(event)" 
        enterFrame="myVidTeaser_enterFrameHandler(event)" maintainAspectRatio="true" 
        scaleContent="true" 
        scrollRect="{new Rectangle(0, 0, myVidTeaser.width, myVidTeaser.height)}" 
        useHandCursor="true"/> 
    </mx:Canvas>  
</s:Window>