发布标准FLEX库项目
本文将介绍如何发布标准FLEX库项目,其中包括:
自定义组件(包含分离的皮肤文件)
自定义组件库的namespace
使用defaults.css指定组件皮肤
首先,打开FlashBuilder,创建一个flex库项目,名称随便取,如下图
下面开始主要任务:
自定义组件
创建Version.as
在vision.core包下创建名为Version.as的actionscript文件,里面只有一句public static const VERSION:String = “1.0.0”;
此文件在其他类中使用include方式引入,定义组件的版本号。
创建LabelInput类
在vision.components包下创建名为LabelInput的类,并继承自SkinableComponent,为LabelInput创建相关属性,并补全代码,如下package vision.components { import flash.events.Event; import spark.components.Label; import spark.components.TextInput; import spark.components.supportClasses.SkinnableComponent; import spark.events.TextOperationEvent; [SkinState("normal")] [SkinState("disabled")] public class LabelInput extends SkinnableComponent { include "../core/Version.as" public function LabelInput() { super(); } override protected function commitProperties():void { super.commitProperties(); if (_labelChanged) { _labelChanged = false; if (labelDisplay != null) labelDisplay.text = _label; } if (_textChanged) { _textChanged = false; if (textInput != null) textInput.text = _text; } if (_promptChanged) { _promptChanged = false; if (textInput != null) textInput.prompt = _prompt; } } override protected