15.10.2012 Views

Actionscript 3 Entwicklerhandbuch

Actionscript 3 Entwicklerhandbuch

Actionscript 3 Entwicklerhandbuch

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ACTIONSCRIPT 3.0 ENTWICKLERHANDBUCH<br />

Anzeigen von HTML-Inhalt in mobilen Anwendungen<br />

package<br />

{<br />

import flash.display.Bitmap;<br />

import flash.display.BitmapData;<br />

import flash.display.Sprite;<br />

import flash.events.*;<br />

import flash.geom.Rectangle;<br />

import flash.media.StageWebView;<br />

import flash.net.*;<br />

import flash.text.TextField;<br />

public class stagewebview extends Sprite<br />

{<br />

public var webView:StageWebView=new StageWebView();<br />

public var textGoogle:TextField=new TextField();<br />

public var textFacebook:TextField=new TextField();<br />

public function stagewebview()<br />

{<br />

textGoogle.htmlText="Google";<br />

textGoogle.x=300;<br />

textGoogle.y=-80;<br />

addChild(textGoogle);<br />

textFacebook.htmlText="Facebook";<br />

textFacebook.x=0;<br />

textFacebook.y=-80;<br />

addChild(textFacebook);<br />

textGoogle.addEventListener(MouseEvent.CLICK,goGoogle);<br />

textFacebook.addEventListener(MouseEvent.CLICK,goFaceBook);<br />

webView.stage = this.stage;<br />

webView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);<br />

}<br />

public function goGoogle(e:Event):void<br />

{<br />

webView.loadURL("http://www.google.com");<br />

webView.stage = null;<br />

webView.addEventListener(Event.COMPLETE,handleLoad);<br />

}<br />

public function goFaceBook(e:Event):void<br />

{<br />

webView.loadURL("http://www.facebook.com");<br />

webView.stage = null;<br />

webView.addEventListener(Event.COMPLETE,handleLoad);<br />

}<br />

public function handleLoad(e:Event):void<br />

{<br />

var bitmapData:BitmapData = new BitmapData(webView.viewPort.width,<br />

webView.viewPort.height);<br />

webView.drawViewPortToBitmapData(bitmapData);<br />

var webViewBitmap:Bitmap=new Bitmap(bitmapData);<br />

addChild(webViewBitmap);<br />

}<br />

}<br />

}<br />

Letzte Aktualisierung 27.6.2012<br />

1100

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!