tourdeflexmobile/src/views/NewsDetailsView.mxml (5 lines of code) (raw):

<?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" tabBarVisible="false" title="{data.title}" viewActivate="init(event)" viewDeactivate="goBack(event)" > <fx:Script> <![CDATA[ import mx.core.FlexGlobals; import mx.events.FlexEvent; import spark.events.ViewNavigatorEvent; private var myStageWebView:StageWebView; private var fontPercent:Number; private var currentFlexScalingFactor:Number = FlexGlobals.topLevelApplication.runtimeDPI/FlexGlobals.topLevelApplication.applicationDPI; protected function init(event:ViewNavigatorEvent):void { NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE; myStageWebView = new StageWebView(true); myStageWebView.viewPort = new Rectangle(myRect.x, myRect.y*currentFlexScalingFactor+FlexGlobals.topLevelApplication.navigator.actionBar.height*currentFlexScalingFactor, myRect.width*currentFlexScalingFactor, myRect.height*currentFlexScalingFactor); myStageWebView.stage = this.stage; myStageWebView.loadString("<html><head><style type='text/css'>"+ "body {background-color:#FFFFFF;}"+ "body {color:black;}"+ "body {padding:10px;}"+ "body {font-size:"+14*currentFlexScalingFactor+"px;}"+ "body {font-family:helvetica;}"+ "a:link {color:#000000;}"+ "a:visited {color:#000000;}"+ "a:hover {color:#000000;}"+ "a:active {color:#000000;}"+ "</style></head><body>"+data.description+"</body></html>"); myRect.addEventListener(Event.RESIZE, resize); } protected function goBack(event:ViewNavigatorEvent):void { NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL; myStageWebView.dispose(); myRect.removeEventListener(Event.RESIZE, resize); } protected function resize(event:Event):void { myStageWebView.viewPort = new Rectangle(myRect.x, myRect.y*currentFlexScalingFactor+FlexGlobals.topLevelApplication.navigator.actionBar.height*currentFlexScalingFactor, myRect.width*currentFlexScalingFactor, myRect.height*currentFlexScalingFactor); } ]]> </fx:Script> <s:navigationContent> <s:Button click="navigator.popView()"> <s:icon> <s:MultiDPIBitmapSource source160dpi="@Embed('assets/icons/160/1_navigation_previous_item.png')" source240dpi="@Embed('assets/icons/240/1_navigation_previous_item.png')" source320dpi="@Embed('assets/icons/320/1_navigation_previous_item.png')"/> </s:icon> </s:Button> </s:navigationContent> <s:Spacer id="myRect" left="10" right="10" top="10" bottom="10"/> </s:View>