| <?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:s="library://ns.adobe.com/flex/spark" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| xmlns:comps="comps.*"> |
| |
| <fx:Style> |
| @namespace s "library://ns.adobe.com/flex/spark"; |
| @namespace mx "library://ns.adobe.com/flex/mx"; |
| |
| @font-face { |
| src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Regular.ttf"); |
| fontFamily: MyArial; |
| embedAsCFF: true; |
| } |
| |
| @font-face { |
| src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Italic.ttf"); |
| fontFamily: MyArial; |
| fontStyle: italic; |
| embedAsCFF: true; |
| } |
| |
| @font-face { |
| src: url("../../../../../Assets/Fonts/Open_Sans/OpenSans-Bold.ttf"); |
| fontFamily: MyArial; |
| fontWeight: bold; |
| embedAsCFF: true; |
| } |
| |
| @font-face{ |
| src: url("../../../../../Assets/Fonts/PT_Serif/PT_Serif-Web-Regular.ttf"); |
| fontFamily: CourierCFF; |
| embedAsCFF: true; |
| } |
| |
| @font-face{ |
| src: url("../../../../../Assets/Fonts/PT_Serif/PT_Serif-Web-Bold.ttf"); |
| fontWeight: bold; |
| fontFamily: CourierCFF; |
| embedAsCFF: true; |
| } |
| |
| s|RichEditableText{ |
| fontAntiAliasType: "normal"; |
| fontFamily: MyArial; |
| fontSize: 12; |
| fontLookup: "embeddedCFF"; |
| } |
| s|CheckBox{ |
| fontAntiAliasType: "normal"; |
| fontFamily: MyArial; |
| fontSize: 12; |
| fontLookup: "embeddedCFF"; |
| } |
| |
| </fx:Style> |
| |
| <fx:Script> |
| <![CDATA[ |
| import flashx.textLayout.formats.TextLayoutFormat; |
| |
| import mx.events.FlexEvent; |
| protected function doSetFocus():void |
| { |
| myText.setFocus(); |
| } |
| |
| private function setProperty(propertyName:String, value:Boolean):void |
| { |
| var properties:Vector.<String> = Vector.<String>(["lineThrough","textDecoration"]); |
| var format:TextLayoutFormat = myText.getFormatOfRange(properties); |
| |
| if (propertyName == "lineThrough") { |
| format.lineThrough = value; |
| } else if (propertyName == "textDecoration") { |
| format.textDecoration = value ? "underline" : "none"; |
| } |
| |
| myText.setFormatOfRange(format); |
| myText.setFocus(); |
| dispatchEvent(new FlexEvent("propSet")); |
| } |
| |
| protected function underlineToggle_changeHandler(event:Event):void |
| { |
| setProperty("textDecoration", underlineToggle.selected); |
| } |
| |
| |
| protected function strikethroughToggle_changeHandler(event:Event):void |
| { |
| setProperty("lineThrough", strikethroughToggle.selected); |
| } |
| |
| ]]> |
| </fx:Script> |
| <fx:Declarations> |
| <!-- Place non-visual elements (e.g., services, value objects) here --> |
| </fx:Declarations> |
| <s:RichEditableText id="myText" x="10" y="10" width="150" height="150"/> |
| <s:CheckBox id="underlineToggle" x="10" y="175" label="Underline" change="underlineToggle_changeHandler(event)"/> |
| <s:CheckBox id="strikethroughToggle" x="10" y="200" label="Strikethrough" change="strikethroughToggle_changeHandler(event)"/> |
| |
| </s:Application> |