15.10.2012 Views

Actionscript 3 Entwicklerhandbuch

Actionscript 3 Entwicklerhandbuch

Actionscript 3 Entwicklerhandbuch

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ACTIONSCRIPT 3.0 ENTWICKLERHANDBUCH<br />

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

Unter iOS kann der Fokus nicht programmgesteuert festgelegt werden. StageWebView löst focusIn- und focusOut-<br />

Ereignisse aus, wobei die direction-Eigenschaft von FocusEvent auf none eingestellt ist. Wenn der Benutzer den<br />

Bildschirm innerhalb des StageWebView-Objekts berührt, wird das focusIn-Ereignis ausgelöst. Berührt der Benutzer<br />

den Bildschirm außerhalb des StageWebView-Objekts, wird das focusOut-Ereignis ausgelöst.<br />

Das folgende Beispiel veranschaulicht, wie der Fokus vom StageWebView-Objekt zu Flash-Anzeigeobjekten übergeht:<br />

package {<br />

import flash.display.MovieClip;<br />

import flash.media.StageWebView;<br />

import flash.geom.Rectangle;<br />

import flash.events.KeyboardEvent;<br />

import flash.ui.Keyboard;<br />

import flash.text.TextField;<br />

import flash.text.TextFieldType;<br />

import flash.events.FocusEvent;<br />

import flash.display.FocusDirection;<br />

import flash.events.LocationChangeEvent;<br />

public class StageWebViewFocusEvents extends MovieClip{<br />

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

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

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

- 120 );<br />

public function StageWebViewFocusEvents()<br />

{<br />

trace("Starting");<br />

topControl.type = TextFieldType.INPUT;<br />

addChild( topControl );<br />

topControl.height = 60;<br />

topControl.width = stage.stageWidth;<br />

topControl.background = true;<br />

topControl.text = "One control on top.";<br />

topControl.addEventListener( FocusEvent.FOCUS_IN, flashFocusIn );<br />

topControl.addEventListener( FocusEvent.FOCUS_OUT, flashFocusOut );<br />

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

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

webView.addEventListener( FocusEvent.FOCUS_IN, webFocusIn );<br />

webView.addEventListener(FocusEvent.FOCUS_OUT, webFocusOut );<br />

webView.addEventListener(LocationChangeEvent.LOCATION_CHANGING,<br />

function( event:LocationChangeEvent ):void<br />

{<br />

event.preventDefault();<br />

} );<br />

webView.loadString("");<br />

webView.assignFocus();<br />

bottomControl.type = TextFieldType.INPUT;<br />

addChild( bottomControl );<br />

bottomControl.y = stage.stageHeight - 60;<br />

bottomControl.height = 60;<br />

bottomControl.width = stage.stageWidth;<br />

bottomControl.background = true;<br />

bottomControl.text = "One control on the bottom.";<br />

bottomControl.addEventListener( FocusEvent.FOCUS_IN, flashFocusIn );<br />

Letzte Aktualisierung 27.6.2012<br />

1098

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

Saved successfully!

Ooh no, something went wrong!