I have done a Video chat application.I have added full screen options to all
videos.My problem is on clicking the Fullscreen button, the Application will be
in Fullscreen Mode not the video. How to solve this. Code is shown below
In my Videopod component i have given like this
private function fullScreen():void
{
try {
switch ( Application.application.stage.displayState ) {
case StageDisplayState.FULL_SCREEN:
// switch to displayState = normal
Application.application.stage.displayState =
StageDisplayState.NORMAL;
break;
default:
// switch to displayState = full
Application.application.stage.displayState =
StageDisplayState.FULL_SCREEN;
break;
}
} catch ( e:SecurityError ) {
// ignore
Alert.show( "cannot go to fullscreen mode. try setting:
'allowfullscreen = true' in HTML container", "security error" );
}
//setCorners();
VideoChatEventsDispatcher.getInstance().dispatchEvent( new
VideoChatEvent(VideoChatEvent.ON_FULLSCREEN_CLICK, this ) );
}
]]>
</mx:Script>
<mx:Fade id="fadeIn" alphaFrom="0.0" alphaTo="1.0" />
<mx:Fade id="fadeOut" alphaFrom="1.0" alphaTo="0.0" />
<mx:Canvas rollOver="showControls()" rollOut="hideControls()">
<view:VideoContainer id="videoDisplay" width="200" height="170"/>
<mx:HBox x="0" y="0" width="100%">
<mx:Label id="broadcastUserName" color="#E8F4F6" fontSize="15"
fontWeight="bold" visible="false"/>
</mx:HBox>
<mx:HBox id="controls" horizontalAlign="right"
styleName="controllerStyle" width="100%" alpha="0.0" y="144" paddingRight="5">
<mx:HSlider id="volumeSlider" x="59" y="142" width="103"
snapInterval="1" value="50" maximum="100"
thumbDrag="updateVolume(event);"
dataTipFormatFunction="formatVolumeToolTip"
liveDragging="true" toolTip="Volume"/>
<mx:Button id="muteButton" toolTip="Mute" height="20" width="20"
styleName="mute" toggle="true" click="toggleSound()" x="170" y="142"/>
<mx:Button id="fScreenBut" click="fullScreen()"
styleName="fullscreen" toggle="true" height="30" width="35"
toolTip="Fullscreen"/>
</mx:HBox>
</mx:Canvas>
And in the main file i gave like this,
private function fullScreen():void
{
Application.application.stage.addEventListener(
FullScreenEvent.FULL_SCREEN, fullScreenHandler );
//screenMode = Application.application.stage.displayState;
}
private function fullScreenHandler( e:FullScreenEvent ):void
{
//screenMode = Application.application.stage.displayState + " (
fullScreen=" + e.fullScreen.toString() + ")";
if (e.fullScreen) {
// do stuff for full screen mode
} else {
// do stuff for normal screen mode
}
}