-
两个swf通过js通信的demo
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.controls.Alert; private function init():void{ ExternalInterface.addCallback("testCallByJS",testCallByJS); } private function testCallByJS():void{ Alert.show("i'm called by SJ !"); } private function doclick():void{ ExternalInterface.call("function (app){document.getElementById(app).testCallByJS();}",Application.application.className); } ]]> </mx:Script> <mx:Button x="364" y="217" label="Button" click="doclick()"/> </mx:Application>
-
Flex中自定义ToolTip
Flex自带的ToolTip是一个矩形框加上一个文本框,可以通过修改style设置他的大小,背景,字体颜色等,但不能改变其形状,如果我想要一个其他形状的ToolTip就需要自定义了。自定义ToolTiP的方法与自定义其他组件一样,因为ToolTip本身就是一个组件,只是他需要实现IToolTip接口。
<?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" implements="mx.core.IToolTip" width="100" height="25" backgroundColor="red" borderStyle="solid" cornerRadius="5"> <mx:Script> <![CDATA[ [Bindable] private var _text:String; public function get text():String { return this._text; } public function set text(value:String):void { this._text = value; } ]]> </mx:Script> <mx:Text width="100%" text="{this._text}" color="#FFFFFF" fontSize="15" textAlign="center"/> </mx:Canvas>
在程序中使用方法是在要显示ToolTip的组件里监听toolTipCreate事件,这个事件是在创建ToolTip前调用的,因此你可以在这里创建你自定义的ToolTip,如果要对这个ToolTip的位置定位,可以监听他的toolTipShow事件,这个事件是在要显示toolTip时调用的。
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" verticalAlign="middle"> <mx:Script> <![CDATA[ import mx.events.ToolTipEvent; private function createToolTip(e:ToolTipEvent):void { var tip:MyToolTip = new MyToolTip(); e.toolTip = tip; } //将ToolTip定位在距离该组件上方(5,5)的位置 private function positionToolTip(e:ToolTipEvent):void { var pt:Point = new Point(); e.toolTip.x += 5; e.toolTip.y -= 35; } ]]> </mx:Script> <mx:Button id="btn" label="testToolTip" toolTip="test" toolTipCreate="createToolTip(event)" toolTipShow="positionToolTip(event)"/> </mx:Application>
-
删除某个文件夹下的所有同名文件命令
del D:\workspace\xxx\Thumbs.db /f/s/q/a
-
flex用样式文件自定义滚动条样式
css样式文件
/* ScrollBar 全局*/ .scrollBar{ trackSkin:Embed(source='images/track_skin.png', scaleGridLeft=8, scaleGridRight=9, scaleGridTop=11,scaleGridBottom=12); thumbUpSkin:Embed(source="images/thum_skin.png"); thumbOverSkin:Embed(source='images/thum_skin.png', scaleGridLeft=8, scaleGridRight=9, scaleGridTop=11,scaleGridBottom=12); thumbDownSkin:Embed(source='images/thum_skin.png', scaleGridLeft=8, scaleGridRight=9, scaleGridTop=11,scaleGridBottom=12); downArrowSkin: Embed(source="images/down.png"); upArrowSkin: Embed(source="images/up.png"); }
Mxml主文件
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Style source="userStyle.css"/> <mx:List x="56" y="51" verticalScrollBarStyleName="scrollBar" width="130"> <mx:dataProvider> <mx:Object label="label1" data="1"/> <mx:Object label="label1" data="1"/> <mx:Object label="label1" data="1"/> <mx:Object label="label1" data="1"/> <mx:Object label="label1" data="1"/> </mx:dataProvider> </mx:List> </mx:Application>
如果想使滚动条的thumbSkin设置成一个”点”或一个”块”,这个块是固定大小的..不像Flex自带的滚动条会随滚动区域的高度而改变,如果直接设置thumbSkin,那滑块将拉变形~非常难看。
这时候我们可以使用verticalScrollBar里的setScrollProperties方法来调整滑块高度。
例如重写//每次刷新滚动条时调用一次setScrollProperties,设置pageSize为0 override protected function setScrollBarProperties(totalColumns:int, visibleColumns:int, totalRows:int, visibleRows:int):void { super.setScrollBarProperties(totalColumns,visibleColumns,totalRows,visibleRows); if(verticalScrollBar)verticalScrollBar.setScrollProperties(0,verticalScrollBar.minScrollPosition,verticalScrollBar.maxScrollPosition,0); }
-
ActionScript标记点位置的工具类
package { import flash.display.DisplayObjectContainer; import flash.display.Sprite; import flash.events.Event; import flash.text.TextField; import flash.text.TextFieldAutoSize; public class MarkPoint extends Sprite { private var _parent:DisplayObjectContainer; public function MarkPoint(parent:DisplayObjectContainer,o:Object,color:uint = 0x000000,radius:uint = 2) { _parent = parent; this.x = o.x; this.y = o.y; graphics.beginFill(color); graphics.drawCircle(0,0,radius); graphics.endFill(); var pointXY:TextField = new TextField(); pointXY.text = "("+o.x+","+o.y+")"; pointXY.autoSize = TextFieldAutoSize.CENTER; pointXY.textColor = color; pointXY.x = - pointXY.width/2; pointXY.y = radius; pointXY.selectable = false; addChild(pointXY); addEventListener(Event.ENTER_FRAME,enterFrameHandler); _parent.addChild(this); } //将所有的点标记移至最上层 private function enterFrameHandler(event:Event):void{ _parent.setChildIndex(this,_parent.numChildren-1); } } }
日历
| 一 | 二 | 三 | 四 | 五 | 六 | 日 |
|---|---|---|---|---|---|---|
| « 七 | ||||||
| 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 | |||
最近评论
- 快播 在 两个swf通过js通信的demo 上的评论
- mode20100 在 两个swf通过js通信的demo 上的评论
- qvod电影 在 两个swf通过js通信的demo 上的评论
- 我的美丽人生 在 两个swf通过js通信的demo 上的评论
- 糾結的人 在 flex用样式文件自定义滚动条样式 上的评论
最近文章
好友链接
3D标签云
删除文件命令 地址栏图标 垃圾表 数据库 更改字段类型 框架 滚动条 自定义样式 ActionScript as与js通信 FLEX JAVA Jquery JS脚本 MySQL Oracle Red5 Struts2 SWT tomcat Tooltip
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
