flex 嵌入其他资源
Flex中的嵌入资源(Embedding Assets)——Swingguy摘译自Flex 3 Developer's Guide,转载请注明2007-10-27 17:18 Flex软件中经常需要使用一些外部的资源,如图片、声音、SWF或字体,虽然你也可以在软件运行的时候引入和载入,但是也可能经常需要直接将这些资源编译(Compile)到软件中,也就是直接嵌入资源(Embedding Assets)。Flex中可以直接嵌入图片image,影片movie,MP3,和TrueType文字。
嵌入资源的利处:
1、比起在运行时访问资源,对嵌入资源的访问速度更加快速;
2、可以用简单的变量访问方式,在多个地方引用所嵌入的资源。这是变量就代表资源,提高写代码的效率;
嵌入资源的弊处:
1、增大了SWF文件的大小,因为是将资源直接包含;
2、由于SWF文件增大,将使得初始化的速度变慢;
3、当资源改变后,需要重新编译SWF文件;
例子1:一个简单的嵌入资源的例子:
<?xml version=”1.0”?>
<!-- embed\ButtonIcon.mxml -->
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”>
<mx:Button label=”Icon Button” icon=”@Embed(source=’logo.gif’)"/>
</mx:Application>
以上粗体部分,使用了@Embed()指令,将logo.gif这个图片直接嵌入到程序中,作为Button按钮的Icon图标。
例子2:用变量引用嵌入的资源
<?xml version="1.0"?>
<!-- embed\ButtonIconClass.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Embed(source="logo.gif")]
[Bindable]
 
相关文档:
DataGrid组件样式属性
backgroundColor 背景色
backgroundAlpha &nb ......
flex控件对象、RemoteObject等都有一个共同的方法addEventListener。
addEventListener方法如下:
public function addEventListener(type:String, listener:Function,
useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
{
eventDispatcher.addEventListener(type, listener, us ......
1.拷贝内容到剪贴板:
System
.
setClipboard
(
strContent)
;
2.克隆一个 ArrayCollection :
var
bar:
ArrayCollection = new
ArrayCollection(
)
;
for
each
(
var
i:
Object
in
ac )
{
bar.
addItem(
i )
;
}
var
bar:
ListCollectionVie ......
对arcgis server for flex学习了一段时间了,需要对自己的学习过程总结一下:
准备工作:1一般对arcgis server软件的安装需要确保自己的电脑上安装了IIS服务器;
2,确保一些arcgis server本身会占用80端口,如果你的电脑上已经装了迅雷软件的话,需要修改迅雷所占用的80端口。3最后你的电脑上装有arcgis desktop,一遍数 ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="InitApp()">
<mx:Script>
<![CDATA[
......