| <?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" minWidth="955" minHeight="600" |
| xmlns:styleTest="assets.styleTest.*"> |
| |
| <fx:Declarations> |
| <!--for testing with class Selector CSS style setting--> |
| <styleTest:ADVStyleTestClass id="classStyleTest" |
| teststyle_1_string_noinh="testString" |
| teststyle_2_number_noinh="12345.678" |
| styleName="myStyle"/> |
| |
| <!--for testing clearStyle using Style manager--> |
| <styleTest:ADVStyleTestClass id="clearStyleTest" |
| teststyle_1_string_noinh="testString" |
| teststyle_2_number_noinh="12345.678" |
| styleName="myStyle"/> |
| |
| </fx:Declarations> |
| |
| <fx:Style> |
| @namespace s "library://ns.adobe.com/flex/spark"; |
| @namespace mx "library://ns.adobe.com/flex/mx"; |
| @namespace styleTest "assets.styleTest.*"; |
| |
| .myStyle { |
| teststyle_1_string_noinh : "cssString"; |
| teststyle_3_uint_inh : 34; |
| teststyle_5_format_length_noinh : 50; |
| } |
| |
| </fx:Style> |
| |
| <fx:Script> |
| <![CDATA[ |
| import assets.styleTest.ADVStyleTestConstants; |
| import mx.effects.Effect; |
| import mx.effects.EffectInstance; |
| import mx.styles.IStyleManager2; |
| |
| import spark.events.TextOperationEvent; |
| |
| private var myStyleManager:IStyleManager2 ; |
| |
| public function testADVStyle():void { |
| |
| //test with Class Selector CSS style setting |
| |
| myStyleManager = StyleManager.getStyleManager(this.moduleFactory); |
| |
| myStyleManager.getStyleDeclaration(".myStyle").setStyle("teststyle_1_string_noinh", "cjchange"); |
| myStyleManager.getStyleDeclaration(".myStyle").setStyle("teststyle_3_uint_inh", 35); |
| myStyleManager.getStyleDeclaration(".myStyle").setStyle("teststyle_6_format_time_noinh", 1998); |
| } |
| |
| //this function is used to clear style using StyleManager |
| public function ClearStyle():void { |
| var css:CSSStyleDeclaration = myStyleManager.getStyleDeclaration(".myStyle"); |
| if(css) { |
| css.clearStyle("teststyle_1_string_noinh"); |
| css.clearStyle("teststyle_2_number_noinh"); |
| css.clearStyle("teststyle_3_uint_inh"); |
| css.clearStyle("teststyle_5_format_length_noinh"); |
| css.clearStyle("teststyle_6_format_time_noinh"); |
| css.clearStyle("teststyle_7_format_color_noinh"); |
| }; |
| } |
| ]]> |
| |
| </fx:Script> |
| |
| <s:Label id="label" text="{getStyle('teststyle_12_enum_string_inh')}" /> |
| |
| </s:Application> |