文件列表
主文件: index.mxml
自定义组件 components.mylogo.mxml
图img a.jpg
2 mylogo.mxml
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
[Bindable]
public var imageFile:String;
]]>
</fx:Script>
<mx:Image x="0" y="0" source="img/{imageFile}"/>
</s:Group>
3 index.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
xmlns:componets="mylogo" xmlns:components="components.*"
>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<components:mylogo x="30" y="40" imageFile="a.JPG"> </components:mylogo>
</s:Application>
4 输入变量名,会自动提示