隐藏Flex滚动条的箭头和滑竿
2009年12月28日
没有评论
1 2 3 4 5 | .myCustomScrollBarStyleName { downArrowSkin: ClassReference(null); upArrowSkin: ClassReference(null); thumbSkin: ClassReference(null); } |
1 2 3 4 5 | .myCustomScrollBarStyleName { downArrowSkin: ClassReference(null); upArrowSkin: ClassReference(null); thumbSkin: ClassReference(null); } |
今天研究flex遇到一个问题,我想通过PopUpManager在弹出面板的时候能够添加一些淡入淡出的特效,上网狂搜一通之后,发现其实很简单,但是我折腾了一上午,却怎么都看不到效果,代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | var mShowEffect:Blur=new Blur(); mShowEffect.blurXFrom=255; mShowEffect.blurYFrom=255; mShowEffect.blurXTo=0; mShowEffect.blurYTo=0; mShowEffect.duration=300; var window:TitleWindow = new TitleWindow(); PopUpManager.addPopUp(window,this,true); PopUpManager.centerPopUp(window); mShowEffect.stop(); mShowEffect.play([window]); |
最后无意中发现,原来跟我设置的css延迟发生了冲突。
1 2 3 | Application{ modalTransparencyDuration: 500; } |
现在来看这个问题已经很容易了,因为透明度效果持续时间大于模糊效果的延迟时间,当然看不到效果了。不过现在我终于明白了一点,这两个延迟时间是同步进行的,而不是先执行Application设置的延迟,再执行效果的延迟时间。
flex当中可以使用mxml创建组件,并且使用Design模式设计组件布局和样式,但是在actionscript项目当中我们无法使用flex这套组件,不过今天发现在制作自定义组件的时候我们可以通过创建actionscript类文件并继承一个flex组件来实现。比如目前有一个test.mxml项目文件,代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" width="688"> <mx:Script> <![CDATA[ import mx.containers.Panel; private function init(e:Event = null):void{ var renderer:PersonRenderer; renderer = new PersonRenderer(); var obj:Object = new Object(); obj.name = "aaa"; obj.age = 987 renderer.data = obj; addChild(renderer); } ]]> </mx:Script> <mx:Button click="init()"/> </mx:Application> |
然后自定义一个组件类,命名为PersonRenderer.as
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | package { import mx.containers.Canvas; import mx.controls.Text; public class PersonRenderer extends Canvas { private var _data:Object; private var nameText:Text; private var ageText:Text; private var positionText:Text; private var image:Image; public function PersonRenderer() { super();trace(435) nameText = new Text(); nameText.text = "2435"; addChild(nameText); ageText = new Text(); ageText.text = "2sdfdffsdfsf435"; addChild(ageText); ageText.y = 20; positionText = new Text(); addChild(positionText); positionText.y = 40; } override public function set data(value:Object):void { _data = value; nameText.text = value.name; ageText.text = String(value.age); positionText.text = value.position; } override public function get data():Object { return _data; } } } |
测试通过,这样我们的选择性就更大了。