Search Flex Components Free

Custom Search

December 27, 2007

How to remove toolbar and restrict the size of browser window in Flex :

There are so many methods of doing this :

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=” ” layout=”absolute”>

Normal Way:
<mx:Button click=”open()” label=”open”/>

Through Javascript:
<mx:Button click=”openJS()” label=”openJS” x=”59″/>

Through External Interface:
<mx:Button click=”openEI()” label=”openEI” x=”134″/>

Through FSCommand:
<mx:Button click=”openFS()” label=”openFS” x=”218″/>
private var str:String=”
private function openJS():void{
var jscommand:String = “'”+str+”‘,'win','height=200,width=300,toolbar=no,scrollbars=no');”;
url:URLRequest = new URLRequest(”javascript:” + jscommand + ” void(0);”); navigateToURL(url, “_self”);
private function open():void{
url:URLRequest = new URLRequest(str);
navigateToURL(url, “_blank”);
private function openEI():void{
if (ExternalInterface.available) {””, str, “win”, “height=200,width=300,toolbar=no,scrollbars=no”);
private function openFS():void{
fscommand(”openWindow”, str+”winheight=200,width=300,toolbar=no,scrollbars=yes”);

Since External Interface is not supported for all browsers, its recommended that you first check to see if it is supported. If not, you might want to consider an alternate approach.

Related Flex Tutorials