Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import flash.display.Sprite;
- import flash.events.*;
- import flash.filesystem.File;
- import flash.geom.Rectangle;
- import flash.text.TextField;
- import qnx.media.QNXStageWebView;
- import qnx.ui.buttons.LabelButton;
- import qnx.ui.text.TextInput;
- import mx.utils.ObjectUtil;
- [SWF(width="1024", height="600", backgroundColor="#cccccc", frameRate="30")]
- public class Browser extends Sprite
- {
- private var addressInput:TextInput = null;
- private var webView:QNXStageWebView = null;
- public function Browser()
- {
- addressInput = new TextInput();
- addressInput.x = 10;
- addressInput.y = 10;
- addressInput.text = "http://www.google.ca/";
- var goButton:LabelButton = new LabelButton();
- goButton.label = "Go";
- goButton.x = addressInput.width + 10;
- goButton.y = addressInput.y;
- goButton.addEventListener(MouseEvent.CLICK, go);
- var closeButton:LabelButton = new LabelButton();
- closeButton.label = "Close";
- closeButton.addEventListener(MouseEvent.CLICK, closeWindow);
- closeButton.x = (stage.stageWidth - closeButton.width) - 10;
- closeButton.y = 10;
- webView = new QNXStageWebView();
- webView.stage = stage;
- webView.blockPopups = true;
- webView.viewPort = new Rectangle(10, 50, stage.stageWidth, stage.stageHeight - 50);
- webView.enableCookies = true;
- webView.enableJavaScript = true;
- webView.enablePlugins = true;
- var content:String = '<html><body><p>Enter an address</p><p>Or ' +
- '<a href="http://www.google.ca">click here</a></p></body></html>';
- webView.loadStringWithBase(content, '');
- addChild(addressInput);
- addChild(goButton);
- addChild(closeButton);
- stage.nativeWindow.visible = true;
- }
- private function closeWindow(e:MouseEvent):void{
- stage.nativeWindow.close();
- }
- private function go(e:MouseEvent):void {
- webView.loadURL(addressInput.text);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment