最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
ActionScript中文本字段的透明度缓动
时间:2009-02-12 编辑:简简单单 来源:一聚教程网
第一是使用BitmapData去绘制,然后对Bitmap进行操作,这个方法代码量稍微偏多,这里不做赘述。
第二种是使用ColorMatrixFilter过滤器。
-
package com.drore.map.view
-
{
-
import flash.events.Event;
-
import flash.text.TextField;
-
import flash.filters.ColorMatrixFilter;
-
-
/**
-
* 动态生成鼠标提示
-
* @author Dada http://www.asflex.cn
-
* @version 5.0
-
* @copy Drore http://www.drore.com
-
*/
-
public class MouseTip extends Sprite
-
{
-
private var txtTips:TextField = new TextField();
-
public function MouseTip()
-
{
-
addEventListener(Event.ENTER_FRAME, init);
-
}
-
-
private function init(event:Event):void
-
{
-
removeEventListener(Event.ENTER_FRAME, init);
-
txtTips.selectable = false;
-
txtTips.tabEnabled = false;
-
txtTips.mouseEnabled = false;
-
txtTips.cacheAsBitmap = true;
-
txtTips.multiline = false;
-
//设置滤镜
-
txtTips.filters=[new ColorMatrixFilter];
-
addChild(txtTips);
-
}
-
//设置提示文字
-
public function setText(txt:String):void
-
{
-
txtTips.text = txt;
-
txtTips.width = txtTips.textWidth + 10;
-
drawBg();
-
}
-
//绘制背景
-
private function drawBg():void
-
{
-
graphics.clear();
-
graphics.beginFill(0xF3E789, .8);
-
graphics.lineStyle(1, 0xFFFF00);
-
graphics.drawRoundRect( -5, -5, txtTips.textWidth + 15, txtTips.textHeight + 15, 10, 10);
-
graphics.endFill();
-
}
-
}
-
-
}
使用方法:
-
//鼠标提示框
-
private var mtips:MouseTip = new MouseTip();
-
mtips.setText("This is a test sentense.");
-
//使用TweenLite对mtips进行alipa缓动
-
TweenLite.to(mtips, .3, { alpha:0 } );
-
上一个: flash as 将图片批量导入到位一帧
-
下一个: as3.0鼠标键盘对MC监听收录
相关文章
- JavaScript中文本框焦点时边框变色 08-29
- JavaScript日历控件插件使用详解(支持中文英文繁体) 10-14
- javascript replace替换中文出错解决方法 12-24
- FLASH软件帧编辑功能怎么使用 06-22
- FLASH软件常用上色工具怎么使用 06-19
- flash怎么制作遮罩图片切换动画 06-19