Posted By

proto on 11/17/10


Tagged

engine AIR as3 webkit webbrowser flashbuilder


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tspitzr


[AIR] [FlashBuilder] Webbrowser


 / Published in: ActionScript 3
 

Webbrowser I have made with FlashBuilder (Adobe) As3, XML, javascript Does support Flash, Javascript etc.. Just a testfile, works nice but buggy. Webkit Engine.

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
  3. xmlns:s="library://ns.adobe.com/flex/spark"
  4. xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute"
  5. title="BrowserApp"
  6. showStatusBar="false"
  7. backgroundColor="0x000000" backgroundAlpha="0.5"
  8. applicationComplete="init()">
  9.  
  10. <fx:Script>
  11. <![CDATA[
  12. <script type="text/javascript" src="AIRSourceViewer.js"></script>
  13. private function init():void
  14. {
  15. stage.displayState=StageDisplayState.FULL_SCREEN_INTERACTIVE;
  16. stage.nativeWindow.title = title;
  17. }
  18.  
  19. [Bindable]private var hisArr:Array = new Array();
  20. private function setHistory():void{
  21. hisArr = new Array();
  22. var len:int = myHTML.historyLength;
  23. while( len -- ){
  24. hisArr[len] = myHTML.getHistoryAt(len);
  25. }
  26. }
  27.  
  28.  
  29. private function onClick(event:Event):void {
  30. if(event.currentTarget == urlButton || (urlTextInput)){
  31. //if(urlTextInput.text.search("app:/")) {
  32.  
  33. myHTML.location = urlTextInput.text.replace("app:/", "");
  34.  
  35. } else if(event.currentTarget == backButton){
  36. myHTML.historyBack();
  37. } else if(event.currentTarget == forwardButton){
  38. myHTML.historyForward();
  39. } else if(event.currentTarget == refreshButton) {
  40. myHTML.reload();
  41. } else {
  42. //DO NOTHING!!!
  43. }
  44. }
  45. ]]>
  46. </fx:Script>
  47. <mx:DataGrid id="dg" dataProvider="{hisArr}" width="125" height="100%"
  48. itemClick="{myHTML.historyPosition = dg.selectedIndex}" left="0">
  49. <mx:columns>
  50. <mx:DataGridColumn headerText="Recent" dataField="title"/>
  51. <mx:DataGridColumn headerText="URL" dataField="url" visible="false"/>
  52. </mx:columns>
  53. </mx:DataGrid>
  54. <mx:ApplicationControlBar width="100%" dock="true" borderVisible="true" dropShadowVisible="false" x="0" y="0">
  55. <mx:VBox width="100%">
  56. <mx:HBox width="100%" borderVisible="true">
  57. <mx:Button id="backButton" label="Vorige" fontWeight="bold" click="onClick(event)"/>
  58. <mx:Button id="forwardButton" label=">" fontWeight="bold" click="onClick(event)"/>
  59. <mx:Button id="refreshButton" label="@" fontWeight="bold" click="onClick(event)"/>
  60.  
  61. <mx:Label text="URL:" fontWeight="bold"/>
  62. <mx:TextInput id="urlTextInput" text="{myHTML.location}" width="235" enter="onClick(event)" />
  63. <mx:Button id="urlButton" label="OK" click="onClick(event)"/>
  64. </mx:HBox>
  65. </mx:VBox>
  66. </mx:ApplicationControlBar>
  67. <mx:HTML id="myHTML" width="100%" height="100%" location="http://google.com" complete="setHistory()" x="123" y="0"/>
  68. </mx:WindowedApplication>

Report this snippet  

You need to login to post a comment.