ActionScript 3 [AIR] [FlashBuilder] Webbrowser

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 [AIR] [FlashBuilder] Webbrowser相关的知识,希望对你有一定的参考价值。

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
						xmlns:s="library://ns.adobe.com/flex/spark" 
						xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute"
						title="BrowserApp" 
						showStatusBar="false" 
						backgroundColor="0x000000" backgroundAlpha="0.5" 
						applicationComplete="init()">
						
	<fx:Script>
		<![CDATA[
			<script type="text/javascript" src="AIRSourceViewer.js"></script>
			private function init():void 
			{
				stage.displayState=StageDisplayState.FULL_SCREEN_INTERACTIVE;
				stage.nativeWindow.title = title; 				
			}
			
			[Bindable]private var hisArr:Array = new Array(); 
			private function setHistory():void{ 
				hisArr = new Array(); 
				var len:int = myHTML.historyLength; 
				while( len -- ){ 
					hisArr[len] = myHTML.getHistoryAt(len); 
				} 
			} 
			
			
			private function onClick(event:Event):void {
				if(event.currentTarget == urlButton || (urlTextInput)){
					//if(urlTextInput.text.search("app:/")) {
							
					myHTML.location = urlTextInput.text.replace("app:/", "");
				
				} else if(event.currentTarget == backButton){
					myHTML.historyBack();
				} else if(event.currentTarget == forwardButton){
					myHTML.historyForward();
				} else if(event.currentTarget == refreshButton) {
					myHTML.reload();
				} else {
					//DO NOTHING!!!
				}
			}
		]]>
	</fx:Script>
	<mx:DataGrid id="dg" dataProvider="{hisArr}" width="125" height="100%" 
				 itemClick="{myHTML.historyPosition = dg.selectedIndex}" left="0"> 
		<mx:columns> 
			<mx:DataGridColumn headerText="Recent" dataField="title"/> 
			<mx:DataGridColumn headerText="URL" dataField="url" visible="false"/> 
		</mx:columns> 
	</mx:DataGrid> 
	<mx:ApplicationControlBar width="100%" dock="true" borderVisible="true" dropShadowVisible="false" x="0" y="0">
		<mx:VBox width="100%">
			<mx:HBox width="100%" borderVisible="true">
				<mx:Button id="backButton" label="Vorige" fontWeight="bold" click="onClick(event)"/>
					<mx:Button id="forwardButton" label=">" fontWeight="bold" click="onClick(event)"/>
					<mx:Button id="refreshButton" label="@" fontWeight="bold" click="onClick(event)"/>
					
				<mx:Label text="URL:" fontWeight="bold"/>
					<mx:TextInput id="urlTextInput" text="{myHTML.location}" width="235" enter="onClick(event)" />
					<mx:Button id="urlButton" label="OK" click="onClick(event)"/>
			</mx:HBox>
		</mx:VBox>
	</mx:ApplicationControlBar>
	<mx:HTML id="myHTML" width="100%" height="100%" location="http://google.com" complete="setHistory()"  x="123" y="0"/>
</mx:WindowedApplication>

以上是关于ActionScript 3 [AIR] [FlashBuilder] Webbrowser的主要内容,如果未能解决你的问题,请参考以下文章

无法将其他 Flash 影片剪辑访问到 Actionscript 3

ActionScript 3 AIR — 视频使眨眼跳跃

重叠声音 Actionscript 3/AIR

ActionScript 3 AIR ActiveRecord是开源的

ActionScript 3 忽略AIR中的隐藏文件

ActionScript 3 Adobe AIR URLMonitor示例