0
votes

I am working on Flex 4.6 Air application in which there is a list and the data is transparent background swf file. My problem is that when i double click on the list item the respected swf file should be play in the background or we can say on desktop like virtual girl application. if we minimize the main application, swf should be play on desktop like virtual girl application.

If anybody have any idea please tell me.

Thnank You so much.

1
I don't understand much of what you're asking, but it sounds like you need an AIR app with transparent chrome.RIAstar

1 Answers

0
votes

You can use the following code in which you will open a mx or spark window on double click of list item.

May be the following code useful for you.

<?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>