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=”
http://www.adobe.com/2006/mxml ” 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″/>
<mx:Script>
<![CDATA[
private var str:String=”
http://www.google.com
private function openJS():void{
var jscommand:String = “window.open('”+str+”‘,'win','height=200,width=300,toolbar=no,scrollbars=no');”;
var
url:URLRequest = new URLRequest(”javascript:” + jscommand + ” void(0);”); navigateToURL(url, “_self”);
}
private function open():void{
var
url:URLRequest = new URLRequest(str);
navigateToURL(url, “_blank”);
}
private function openEI():void{
if (ExternalInterface.available) {
ExternalInterface.call(”window.open”, 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”);
}
]]>
</mx:Script>
</mx:Application>

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