我想在纽顿点击上动态地改变申请的字体大小。
任何想法? 请指导我们的工作
感谢
我想在纽顿点击上动态地改变申请的字体大小。
任何想法? 请指导我们的工作
感谢
http://kachurovskiy.com/“rel=“nofollow noreferer” Maxim Kachurovskiy
(它不是地雷,而是部分折旧,但运作良好):
<>FontSize.mxml:
<?xml version="1.0" encoding="utf-8"?>
<!-- (c) Maxim Kachurovskiy -->
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
addedToStage="addedToStageHandler();"
initialize="fontSize = 11;">
<mx:Style>
.header {
font-weight: bold;
fontSizeDelta: 5;
}
</mx:Style>
<mx:Script>
<![CDATA[
private var _fontSize:Number;
[Bindable("fontSizeChange")]
public function get fontSize():Number {
return _fontSize;
}
public function set fontSize(value:Number):void {
if (_fontSize == value)
return;
_fontSize = value;
applyFontSize(_fontSize);
dispatchEvent(new Event( fontSizeChange ));
}
private function applyFontSize(fontSize:Number):void {
var selectors:Array = StyleManager.selectors;
for each (var selector:String in selectors) {
var declaration:CSSStyleDeclaration = StyleManager.getStyleDeclaration(selector);
var delta:Number = declaration.getStyle( fontSizeDelta );
if (delta) {
declaration.setStyle( fontSize , fontSize + delta);
StyleManager.setStyleDeclaration(selector, declaration, true);
}
}
var global:CSSStyleDeclaration = StyleManager.getStyleDeclaration( global );
if (!global)
global = new CSSStyleDeclaration( global );
global.setStyle( fontSize , fontSize);
StyleManager.setStyleDeclaration( global , global, true);
}
private function addedToStageHandler():void {
stage.addEventListener(KeyboardEvent.KEY_UP, my_keyUpHandler);
}
private function my_keyUpHandler(event:KeyboardEvent):void {
if (event.ctrlKey) {
var keyCode:uint = event.keyCode;
if (keyCode == 107 || keyCode == 187 || keyCode == 38)
fontSize++;
else if (keyCode == 109 || keyCode == 189 || keyCode == 40)
fontSize--;
}
}
]]>
</mx:Script>
<mx:Panel title="Font size change" layout="vertical"
horizontalCenter="0" verticalCenter="0" paddingBottom="10"
paddingLeft="10" paddingRight="10" paddingTop="10">
<mx:HBox horizontalGap="10">
<mx:Label text="Font size:" styleName="header"/>
<mx:NumericStepper id="numericStepper" value="{fontSize}"
change="{fontSize = numericStepper.value;}" maximum="100" minimum="1"/>
</mx:HBox>
<mx:Label text="Ctrl+/- adjust font size too."/>
</mx:Panel>
</mx:Application>
这里是提高纽特州点击频率的代码。 检查
<mx:Label id="lb" text="INDIA"/>
<mx:Button label="change" click="button1_clickHandler(event)"/>
protected function button1_clickHandler(event:MouseEvent):void
{
lb.setStyle( fontSize ,Number(lb.getStyle( fontSize ))+5);
}
lb.setStyle( fontSize ,Number(lb.getStyle( fontSize ))+5);
1. 采用以往的电离值,将其提高5,并重新确定。
或
您可以直接确定过去活力的状态的价值。
lb.setStyle( fontSize ,Math.random()*200);
这可以帮助你......
[Bindable]private var _size:Number = 10;
protected function button1_clickHandler(event:MouseEvent):void
{
_size = _size+10;
}
<mx:Label id="lb" text="INDIA" fontSize="{_size}"/>
<mx:Label id="lb1" text="I love India" fontSize="{_size}"/>
<mx:Button label="change" click="button1_clickHandler(event)" />
I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?
How can I delete the element with a certain index in a Flex XMLList?
I was making multiple remote calls and they are done sequentially and when I am getting a result event back it s triggering calls to all the methods with ResultEvent as an argument . I am supposed to ...
I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...
I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...
When I make a new Flex application in Flex 4 beta 2 (Flash Builder), then it creates a border around the outside of the Panel in this example of a thick width. It places a border with a shadow on the ...
I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...
I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...