ITeye博客

AS3 Scale9 Bitmap类

hgfghe8 · 2010-04-09 08:14 · flash技术 · Web前端 · HTML · ActionScript · Flex · UI · Flash · Markdown

翻译自: http://www.uza.lt/codex/as3-scale9-bitmap/ 简介: AS3 Scale9 Bitmap是个辅助的类,使用它可以通过bitmap数据填充创建九宫格sprite,而这些在Flash 9中是无法实现的。这个辅助类根据用户定义的缩放矩阵创建了9个虚拟的九宫格sprite。特别适用于创建用户界面(比如按钮,可伸缩的UI元素等等)。 内容: Scale9SimpleStateButton - 用于创建可伸缩的1、3 或者3种状态使用bitmap数据(皮肤)的按钮的类。 Scale9SimpleBitmapSprite - 用于创建静态的可伸缩的UI元素的使用bitmap数据(皮肤)的sprite的类。 示例代码(Flex Builder 3 项目) 要求: ActionScript3 Scale9SimpleStateButton(左上角),Scale9SimpleBitmapSprite(右下角)以及初始的皮肤文件(底部) 示例语法: Actionscript:       var scale9_example:Rectangle = new Rectangle(6,6,105,20);       /* Initialize the button with all 3 states (normal, hover, down) using 3 different bitmaps /       var button_example:Scale9SimpleStateButton = new Scale9SimpleStateButton(           scale9_example,           button_skin_normal.bitmapData,           button_skin_hover.bitmapData,           button_skin_down.bitmapData       );       /         * Scale the button using "width" and "scaleY" properties         * (in general you can use "width", "height", "scaleY", "scaleX" properties for scaling)         */       button_example.width = 300;       button_example.scaleY = 2; 下载: http://www.uza.lt/download/2 本文转自:http://www.5uflash.com/flashjiaocheng/Flash-as3-jiaocheng/4911.html

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。