| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <s:Application |
| xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| width="1024" height="800" |
| creationComplete="appCompleteHandler(event)" xmlns:tflow="TLF.tflow.*" xmlns:comp="TLF.comp.*" xmlns:tflow1="SWFs.TLF.tflow.*"> |
| |
| |
| <s:layout> |
| <s:VerticalLayout paddingLeft="20" paddingRight="20" |
| paddingTop="20" paddingBottom="20" /> |
| </s:layout> |
| <fx:Style> |
| @namespace mx "library://ns.adobe.com/flex/mx"; |
| @namespace s "library://ns.adobe.com/flex/spark"; |
| |
| |
| @font-face { |
| src:url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Bold.ttf"); |
| fontFamily: VeraMoBdEmbedded; |
| embedAsCFF: true; |
| unicodeRange: |
| U+0041-005A, /* Upper-Case [A..Z] */ |
| U+0061-007A, /* Lower-Case a-z */ |
| U+0030-0039, /* Numbers [0..9] */ |
| U+002E-002E; /* Period [.] */ |
| } |
| |
| @font-face{ |
| src: url("../../../../../Assets/Fonts/PT_Serif/PT_Serif-Web-Regular.ttf"); |
| fontFamily: MeiryoEmbedded; |
| embedAsCFF: true; |
| } |
| |
| |
| @font-face{ |
| src: url("../../../../../Assets/Fonts/PT_Serif/PT_Serif-Web-Bold.ttf"); |
| fontWeight: bold; |
| fontFamily: MeiryoEmbedded; |
| embedAsCFF: true; |
| } |
| |
| s|RichEditableText{ |
| fontAntiAliasType: "normal"; |
| fontFamily: MeiryoEmbedded; |
| fontSize: 12; |
| fontLookup: "embeddedCFF"; |
| } |
| |
| </fx:Style> |
| <fx:Script> |
| <![CDATA[ |
| import flashx.textLayout.conversion.TextConverter; |
| import flashx.textLayout.elements.TextFlow; |
| |
| import mx.events.FlexEvent; |
| |
| import spark.utils.TextFlowUtil; |
| |
| private var xml:XML; |
| public var textFlow:TextFlow; |
| private var string:String = ""; |
| |
| |
| protected function appCompleteHandler(event:FlexEvent):void |
| { |
| var request:URLRequest = new URLRequest("TLF/tflow/xml/html.xml"); |
| var loader:URLLoader = new URLLoader(); |
| loader.addEventListener(Event.COMPLETE, completeHandler); |
| loader.load(request); |
| } |
| private function completeHandler(event:Event):void |
| { |
| string = event.target.data; |
| xml = XML(event.target.data); |
| textFlow = TextFlowUtil.importFromXML(xml); |
| xml = TextFlowUtil.export(textFlow); |
| textFlow = TextFlowUtil.importFromString(string); |
| richEditableText.textFlow=textFlow; |
| } |
| ]]> |
| </fx:Script> |
| <s:RichEditableText id="richEditableText"/> |
| </s:Application> |