开发者

I want to make the browser fullscreen through my flex website

I have a website which is built totally in flex.

I want to make a button, on the click of which the browser becomes fullscreen. I am not talking about a flex fullscreen, by which i mean "Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;" I dont want to use this.

The reason, I dont want to use it is, that flash does not supports keyboard on flex-fullscreen. But if i can make the browser fullscreen, it will solve my purpose.

Also i am h开发者_JAVA百科oping the same method will be good for all browsers on PC and Mac both.


Use ExternalInterface to call a javascript function for it. Sorry this solution is half-baked so I'm not 100% sure it works..

//In ActionScript
public function fullScreen():void
{
  if (ExternalInterface.available) 
  {
    ExternalInterface.call("fullScreen");
  } 
  else
  {
    //Error
  }
}
//In JavaScript
function fullScreen()
{
  if (parseInt(navigator.appVersion)>3) {
    moveTo(0,0);
    resizeTo(screen.availWidth,screen.availHeight);
  }
  //on older browsers just leave it alone
}


i did the same work using thw solution for which you r saying no, u r saying the keyboard doesn't work, but it's working in ma case

here is the button code :

<mx:Button id="fullscreen" styleName="fullscreen" click="toggleFullScreen();"/>

and here is the function which gets called :-

private function toggleFullScreen():void
{
    if(Application.application.stage.displayState == StageDisplayState.NORMAL)
    Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;
    else if(Application.application.stage.displayState == StageDisplayState.FULL_SCREEN)
     Application.application.stage.displayState = StageDisplayState.NORMAL;
}

also there are some files , that u need to copy in the html-template folder:-

i'll send u those files, mail me ankursharma85@in.com, i'll reply u

and yes, when u r in full screen mode, u can press "esc" key to get to the normal mode, and if u want to use keyboard to make fullscreen, then u keyboard events, thats a different story

i hope this helps

tc hav a gr8 time

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜