建站部落网 - www.jzbulo.com 首 页业界动态免费空间
建站首页 | 业界动态 | 网页制作 | 网络编程 | 网站运营 | 服务器技术 | 网页特效 | 图形图像 | 计算机技术 | 作品欣赏
您当前的位置:建站部落 > 图形图像 > Flash > 文章内容 注册用户 用户管理 退出登录
Flash CS3 组件开发教程
作者:kinglong  来源:蓝色理想  发布时间:2007-6-18 0:33:26  发布人:jzbulo

减小字体 增大字体

作者相关:http://www.klstudio.com

【教程说明】:
应云开等朋友的要求,我今天把组件开发过程整理一下,写成这篇教程。通过此篇教程你可以大致了解Flash 组件开发整个过程,希望对那些想自己开发Flash 组件的朋友有所帮助。我这次主要开发Flash 代码组件,甚至其他Flash 组件,你可以自行研究或和我一起讨论。

【前提条件】:
1.安装了Flash CS3软件;
2.安装了Adobe Extension Manager 1.8 扩展管理器,如果没有请先到这里下载;

【开发教程】:
1.首先准备一个18x18的png 图片,用来做Flash 组件的图标。(我会在下面打包文件中提供一个png 图片)
2.写一个StringUtilComponent 组件类,我的组件都没有去继承系统组件类(UIComponent),而是直接继承Sprite 类。

package com.klstudio.components {
    
    import flash.display.*;
    
    import com.klstudio.util.StringUtil;
    
    //命名空间;
    use namespace klstudio_internal;
    
    //设置组件图标;
    [IconFile("StringUtilIcon.png")]
    
    public class StringUtilComponent extends Sprite{
        //定义组件显示框;
        //组件里已有的显示元素必须用命名空间作开头;
        klstudio_internal var boundingBox_mc:MovieClip;
        //定义LRC解析器;
        private var util:StringUtil;
        public function LRCParserComponent(){            
            //移除组件显示框;
            boundingBox_mc.visible = false;
            addChild(boundingBox_mc);
            boundingBox_mc = null;            
        }        
    }    
}

这个组件用到的StringUtil 类,我之前已经提供过的“[AS3]StringUtil类”。这里要注意一下,组件内所包含的显示元素一定要用命名空间来做前缀(就是上面“use namespace klstudio_internal;”代码),下面就命名空间定义变量。如果不加的话,就无法直接对boundingBox_mc 显示元素操作(这一点和原来Flash 组件开发不同的地方,原来是可以直接使用的),否则编译时就会报错。

/**
* ...
* @author Kinglong
* @version 0.1
*/
package com.klstudio.components {
    public namespace klstudio_internal = http://www.klstudio.com/;
}

3.建立一个StringUtil.fla 文件,类型当然是选择“Flash File(ActionScript3)”。

4.建立一个MovieClip 元素,命名为“StringUtil”;然后按照下图所示设置Class 路径。

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/tech/UploadPic/2007-7/20077103326820.gif');}" alt="" src="/tech/UploadPic/2007-7/20077103327712.gif" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

5.再建立一个新的MovieClip 元素,命名为“boundingBox_mc”,用来做组件显示框。   

screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/tech/UploadPic/2007-7/20077103327388.gif');}" alt="" src="/tech/UploadPic/2007-7/20077103328190.gif" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

6.然后将boundingBox_mc 放到名叫“StringUtil”的MovieClip 元素里,同时按下图所示将名字已经设置成“boundingBox_mc”。

经典论坛讨论:
http://bbs.blueidea.com/thread-2758660-1-1.html

[1] [2]  下一页

[] [返回上一页] [打 印] [收 藏]
下一篇文章:从 AS2 到 AS3
相关文章 赞助商链接
· 写给刚刚踏入网页设计这个世界的你
· DesignUK 设想英伦系列活动之大声展21日在沪..
· 婚恋交友网站盈利模式初探
· CNAP2007国际艺术展在北京酒厂国际艺术园医..
· 德国DFI学院学生获奖作品之一:大众篇(1)
· Xbox Forza Street Racing 平面广告设计
· Jessica Vernick 平面设计
· Kelsey Reckord 平面设计
· PRINT-RUN伦敦防治肺癌慈善海报展欣赏
· [摄影] 水中芙蓉
· [同盟报道]清华美院2007本科毕业展开幕
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图
声明:本站中的内容及图片来均源于互联网,其中演示的技术细节仅用于试验 环境的技术研究以及漏洞的验证。
文章内容不涉及任何有版权的内容,仅供技术交流研究之用。网 站联系QQ:175612638
Copyright © 2002-2006 jzbulo.com. All Rights Reserved . 粤ICP备05040326号