Archive

Archive for June 20, 2008

Sample Full Screen Application in Flex

Hello All,

 

FullScreen Application in Flex,, Yup sounds very interesting…

 

It has been one of our project requirement , I did it quite long days ago, So I thought why not put this thing here on blog so if somebody faces any problem with it he can use this code … Why Not?

 

Before proceeding  as you makes your new project goto your HTML wrapper i.e.

index.template.html . Now

 

Step 1.

 

In the script section add comman (,) in last property of  AC_FL_RunContent function and add the line

“allowFullScreen”, “true”

 

Also in <object> tag add

 

<param name=”allowFullScreen” value=”true” />

 

Property so that we can avoid upcoming Security error.

 

Step 2. Add the following code

 

private var flag:Boolean = false;

      private function clickHandler(e:Event):void

      {

            if(flag==false)

            {

                  flag=true;

                  stage.displayState = StageDisplayState.FULL_SCREEN;

            }

        else if(flag==true)

        {

            flag=false;

            stage.displayState = StageDisplayState.NORMAL;

        } 

      }

 

Now Stage Class:– The Stage class represents the main drawing area. i.e it represents the entire area where Flash content is shown.

Also important thing is that

We don’t create object of this class as obj:Stage=new Stage();

The Stage object is not globally accessible. You need to access it through the stage property of a DisplayObject instance

Most importantly we use

displayState : A value from the StageDisplayState class that specifies which display state to use . so this is how it should look as below

 

This is small code of sweet Fulscreen Player Application sample application… Do check it its muska…Really J

 

<?xml version=”1.0″ encoding=”utf-8″?>

<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” backgroundColor=”#000000″>

            <mx:Script>

                        <![CDATA[

                                    import mx.collections.ArrayCollection;

                                    [Bindable]

                                    private var arrList:ArrayCollection = new ArrayCollection([{Label:'Central Beer',Path:'assets/get_video1111.flv'},{Label:'Clinton',Path:'assets/Clinton.flv'},{Label:'Banned Ad',Path:'assets/bannedAd.flv'},{Label:'Love',Path:'assets/get_video.flv'},{Label:'Darling',Path:'assets/get_video2.flv'},{Label:'Just Call US',Path:'assets/get_video3.flv'}])

                                    private var flag:Boolean = false;

                                    private function clickHandler(e:Event):void

                                    {

                                                if(flag==false)

                                                {

                                                            flag=true;

                                                            stage.displayState = StageDisplayState.FULL_SCREEN;

                                                }

                                      else if(flag==true)

                                      {

                                                flag=false;

                                                stage.displayState = StageDisplayState.NORMAL;

              } 

                                    }

             ]]>

            </mx:Script>

           

           

            <mx:LinkButton label=”Full Screen” id=”btnTest” click=”clickHandler(event)” y=”0″ height=”16″ fontSize=”13″ color=”#ffffff” width=”109″/>

            <mx:VideoDisplay id=”vduSong” x=”0″ y=”24″  width=”100%” height=”100%” source=”{cmbSongList.selectedItem.Path}”/>

            <mx:ComboBox id=”cmbSongList” x=”259″ y=”-1″ dataProvider=”{arrList}” labelField=”Label”></mx:ComboBox>

            <mx:Label x=”120″ y=”-1″ text=”Currently Playing ” color=”#ffffff” fontSize=”14″/>

</mx:Application>

 

 

 Thanks and Regard

 

Shashank Kulkarni

Feel free to mail me :)   shashank.pawan@gmail.com

 

Categories: Best of Flex Utillity