Have you ever used [Bindable] in Flex? Do you know it is metatag? Apart from this, there are 12 more documented metatag in Flex framework. I will list them all out here for your reference:
ArrayElementType
Data type restriction like Java Generic
[ArrayElementType("String")]
public var arrayOfStrings:Array;
Bindable
Allows for easy data synchronization within the components. Bindable can be used to bind simple data, classes, complex data, functions and event. I will talk about this metatag in more detail later.
[Bindable]
[Bindable(event="eventname")]
DefaultProperty
The DefaultProperty metadata tag is used to set a single property as a default property of a class. The 3 label controls are equivalent with “text” defined as default property in the component, so you don’t need to put <text> tag around it.
<mx:label text=”Hello”></mx:label>
<mx:label>
<mx:text>Hello</mx:text>
</mx:label>
<mx:label>Hello</mx:label>
Embed
The Embed metadata tag is used to import images into your application. There are two ways to use Embed. You can either embed the image in ActionScript and assign it to a variable. Button 1 and 2 below do the same.
[Embed(source="myIcon.gif")]
[Bindable]
public var myIcon:Class;
<mx:Button label=”Icon Button 1″ icon=”{myIcon}”/>
<mx:Button label=”Icon Button 2″ icon=”@Embed(source=’myIcon.gif’)”/>
Event
The Event metadata tag is used to declare events that will be dispatched by your custom class. Adding this metadata tag to your class definition allows you to add an event handler function to the MXML tag used to instantiate your custom class. You insert the [Event] metadata tag before the class definition in an ActionScript file, or in the <mx:Metadata> block in an MXML file.
In Actionscript:
[Event(name="myClickEvent", type="flash.events.Event")]
In MXML:
<?xml version=”1.0″?>
<mx:TextArea xmlns:mx=”http://www.adobe.com/2006/mxml”>
<mx:Metadata>
[Event(name="myEnableEvent", type="flash.events.Event")]
</mx:Metadata>
….
</mx:TextArea>
Effect
The Effect metadata tag is used to define a custom effect that will be dispatched when an event occurs. An effect is paired with a trigger that invokes the effect. A trigger is an event, such as a mouse click on a component, a component getting focus, or a component becoming visible. An effect is a visible or audible change to the component that occurs over a period of time. You insert the [Effect] metadata tag before the class definition in an ActionScript file, or in the <mx:Metadata> block in an MXML file. Same as Event syntax above.
[Effect(name="darkenEffect", event="darken")]
IconFile
IconFile is used to identify the filename of a jpg, gif, or png file that will be used as the icon for your custom class. While the [Embed] meta tag can be used to embed images files, SWF files, music files, video files, etc, IconFile is only used to embed a file that will be used as the icon for the custom class.
[IconFile("icon.png")]
public class CustomButton extends Button
{}
Inspectable
The Inspectable metadata tag is used to define the attributes of your custom component that you would like to display in the code hints and property inspector of Flex Builder 2.
InstanceType
The [InstanceType] metadata tag specifies the allowed data type of a property. Example below shows that you can only assign instance data type “mx.controls.Label” to variable topRow of type IDeferredInstance.
[InstanceType("mx.controls.Label")]
public var topRow:IDeferredInstance;
NonCommittingChangeEvent
TBA
RemoteClass
TBA
Style
The Style metadata tag is used to define custom style properties for your components. Simply add the Style metadata tag or tags to your class definition and then use the getStyle method to retrieve its value. I will talk about this metatag in more detail later.
分享到:
相关推荐
通过这个实例,你可以学习如何在FLEX中配置和使用HTTPService来与Java后台进行通信,了解FLEX项目结构和配置,以及如何在IDE中管理和运行这样的混合项目。此外,还可以深入理解HTTP请求和响应的处理流程,以及XML或...
- **容器的大小和内容大小均未知的水平和垂直居中**:使用`flex`属性。 - **修饰图片的水平和垂直居中**:通过`display`和`align-items`等属性。 #### 字体的综合属性 - **字体的选择**:通过`font-family`属性。 ...
6. `<head>`和`<meta>`:在头部定义文档元信息,可能包含字符集设置(如`<meta charset="UTF-8">`)。 接下来,CSS(层叠样式表)负责界面的视觉设计和布局。以下是一些可能应用的关键CSS概念: 1. 响应式设计:...
- **所有标记的结束标记**:确保每个开始标记都有对应的结束标记。 - **小写字母**:所有标签名和属性名都使用小写。 - **合理嵌套**:确保所有的HTML元素都合理嵌套。 - **属性值的引用**:使用引号包围属性值...
- **横向菜单**:通过设置`<ul>`的`display`属性为`inline-block`或`flex`,实现水平布局。 #### 八、校验及常见错误 - **XHTML校验**:使用在线工具检查文档是否符合XHTML标准。 - **CSS2校验**:同样可以通过在线...
- **标记规范**:所有标记都必须有结束标记,标签名使用小写,属性值用引号括起等。 - **特殊字符编码**:将`和`&`等特殊字符使用实体编码表示,如`<`和`&`。 #### 七、CSS入门 - **基本语法**:了解CSS的...
- **不用表格的菜单(横向)**:同样使用列表项配合浮动或flex布局实现水平导航菜单。 #### 十二、校验及常见错误 - **XHTML校验**:通过W3C提供的校验工具检查文档是否符合XHTML标准。 - **CSS2校验**:确保CSS...
- **Flex布局**: 使用`display: flex;`属性创建弹性盒子容器,灵活控制子元素的排列方式。 - **Grid布局**: `display: grid;`属性用于创建网格布局,通过定义行和列来管理页面布局。 - **响应式设计**: 使用媒体查询...
- **为搜索引擎准备的内容**: Meta标签等。 **2.7 XHTML代码规范** - **标记闭合**: 所有标签都需要有结束标记。 - **小写字母**: 所有标签和属性名称必须小写。 - **合理嵌套**: 标签必须正确嵌套。 - **属性引号*...
- 文档头部标签:`<title>`、`<meta>`、`<link>`等。 - 文本内容标签:`<p>`、`<h1>`到`<h6>`、`<a>`等。 - 列表标签:`<ul>`、`<ol>`、`<li>`等。 - 图像标签:`<img>`。 - 表单标签:`<form>`、`<input>`、`...
- **实现方法**:使用CSS的`display: flex`或`display: grid`属性,结合`min-height`属性来实现。 #### 十四、不用表格的菜单 - **传统问题**:使用表格布局会导致布局过于复杂且难以维护。 - **解决方案**:使用...
1. `<head>`部分:包含元信息,如字符集设置(`<meta charset="UTF-8">`)、页面标题(`<title>`)以及对CSS文件的引用(`<link rel="stylesheet" href="styles.css">`)。 2. `<body>`部分:实际的网页内容,如...
- `<head>`包含元信息,如字符编码(`<meta charset="UTF-8">`),以及页面标题(`<title>`)。 - `<body>`包含网页的可见内容,如文本、图像、链接等。 2. **注册表单**: - 表单是HTML中处理用户输入的重要...
1. **布局**:使用`display: flex`或`grid`创建响应式布局,使元素能根据屏幕大小自动调整位置和大小。 2. **伪类与伪元素**:`:hover`, `:focus`, `:active`等伪类可以改变鼠标悬停、获得焦点或被激活时元素的样式...
2. **结构化数据**:使用Schema.org标记网站内容。 3. **可访问性**:确保网站易于搜索引擎爬虫抓取。 #### 页面加载流程: 1. **DNS解析**:将域名解析为IP地址。 2. **建立连接**:与服务器建立TCP连接。 3. **...
本项目“Responsive-Tribute-Page”就是一个专注于此领域的实例,旨在创建一个既美观又适应各种屏幕尺寸的致敬页面。 HTML(HyperText Markup Language)是构建网页的基本语言,用于描述网页内容和结构。在这个项目...
5. **布局模式**:流式布局(normal flow)、网格布局(grid)和Flex布局(flexbox)是常见的网页布局方式。 6. **响应式设计**:通过媒体查询`@media`,CSS可以实现不同设备或屏幕尺寸下的样式调整。 7. **层叠和...
- **组合选择器**:可以将多个选择器组合起来使用,如`div p`表示选择所有`div`内的`p`元素。 - **伪类和伪元素选择器**:用于选择特定状态下的元素或元素的特定部分,如`:hover`、`:first-child`、`::before`等。 ...
例如,使用`display: flex`或`grid`布局,以及`position`属性进行元素定位。 7. **响应式设计**:利用媒体查询(`@media`)确保网站在不同设备(桌面、平板、手机)上的显示效果适应屏幕尺寸。 8. **链接与交互**...