04
May
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" viewSourceURL="srcview/index.html" applicationComplete="init()">

<mx:Script>
<![CDATA[
// import a Native window c lass for handling the native window.
import flash.display.NativeWindow;
[Bindable]
public function init():void
{
this.stage.nativeWindow.maximize();
}

private var myUrl:String = "http://";  // initializing a string to collect url.

private function goToUrl():void{ //function for navigating to the url.

myUrl = urlInput.text;

/* Checking for http */

if (myUrl.substr(0,4) != "http")
{
myUrl = "http://" + myUrl;    //appending to the string myUrlAir Browser
}

//fetch the html page from the location to brows-here a html page.

brows.location = myUrl;
}
// For the Home button.....
private function goToHome():void
{
myUrl = "http://www.google.com";
brows.location = myUrl;
urlInput.text=myUrl;
}

]]>
</mx:Script>

<mx:ApplicationControlBar dock="true" fillAlphas="[1.0, 1.0]" fillColors="[#0E0847, #FFFFFF]">
<mx:Label text="AIR WEB BROWSER" fontWeight="bold" fontSize="12" color="#990000"/>
<mx:TextInput id="urlInput" enter="goToUrl()"/>
<mx:Button label="GO" click="goToUrl()" />
<mx:Spacer width="100%"/>
<mx:Button label="Home" click="goToHome()"/>
<mx:Button label="Back" click="brows.historyBack()" />
<mx:Button label="Forward" click="brows.historyForward()"/>
</mx:ApplicationControlBar>

<mx:HTML id="brows" height="100%" width="100%"/>

</mx:WindowedApplication>


Posted by on 04 May 2010 by vipin in Adobe Air

Add reply

*