惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
P
Proofpoint News Feed
V
Visual Studio Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
Vercel News
Vercel News
Hugging Face - Blog
Hugging Face - Blog
GbyAI
GbyAI
博客园 - 聂微东
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
美团技术团队
H
Help Net Security
aimingoo的专栏
aimingoo的专栏
C
Check Point Blog
U
Unit 42
博客园 - 叶小钗
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
MongoDB | Blog
MongoDB | Blog

博客园 - Tobin

41岁的大龄程序员,苟着苟着,要为以后做打算了 UC_Center整合单点登录后远程注册不激活问题的解决办法 AspExe - a small ASP.NET compiler and executor for document generation Embedding Resources with AS3 Configure the max limit for concurrent TCP connections [转]翻译:使用.net3.5的缓存池和SocketAsyncEventArgs类创建socket服务器 强制将IE,Chrome设置为指定兼容模式来解析(转) - Tobin - 博客园 工商银行,千万别用,转账不成功一样收手续费 MySQL vs NoSQL 效率与成本之争(转) 使用ASP.NET Global.asax 文件(转) [MySql识记]create utf8 database - Tobin npgsql连接postgresql数据库 由浅到深了解JavaScript类[转过来的收藏] javascript改变this指针 哪个美女最漂亮,自己写的js图片自适应切换 javascript操作cookie实例 [图解] 你不知道的 JavaScript - “this”(转) 对与list<>泛型的一些操作方法 关于游戏开发中的A*/A-star的寻路算法的问题
在as3中Embed(绑定)flash动画元素 - Tobin - 博客园
Tobin · 2010-12-07 · via 博客园 - Tobin

ref:http://zszen.tbcheap.com/wordpress/life/?p=283 

你需要使用loader类的loadBytes方法将这个二进制流转换成显示类
如果你需要控制embed进来的元件, 那么你需要侦听loader.contentLoadInfo的Event.Complete事件
当完成装载后你既的内部embed元件就可以随心所欲的玩了
此时的loader.content即为MainTimeline类, 这时你直接写loader.content.txt严格的话会报错, 你可以使用弱引用 loader.content["txt"] 然后声明个临时变量, 在cs5里面还能给个代码功能提醒

附上我的demo附件作为例子看吧 (本地就不传了, 去论坛下吧)link

另外附上测试的embed各种格式的父类关系
jpg/gif/png:
Main_EMBED
mx.core::BitmapAsset
mx.core::FlexBitmap

swf文件:
Main_EMBED
mx.core::ByteArrayAsset

mp3声音类:
Main_EMBED
mx.core::SoundAsset

txt文本:
不支持
does not have a recognized extension, and a mimeType was not provided

xml文档:
不知道为什么这么报错
expecting semicolon before id

pdf文件同swf
zip压缩包同swf

另外font应该也是可以镶入的, 没测

官方文档里面提到了到底支持绑定什么类型的文件:http://livedocs.adobe.com/flex/3 … ontent=embed_4.html

收集到的各类文件镶入方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

/** Embed SWF */
[Embed(source="$$(source).swf",
   mimeType="application/x-shockwave-flash",
   scaleGridTop="$$(scaleGridTop=1)",
   scaleGridBottom="$$(scaleGridBottom=1)",
   scaleGridLeft="$$(scaleGridLeft=1)",
   scaleGridRight="$$(scaleGridRight=1)",
   symbol="$$(symbol)")]
private var _$$(source)_$$(symbol)SWF:Class;

/** Embed Binary */
[Embed(source="$$(source)", mimeType="application/octet-stream")]
private var _$$(source)BIN:Class;

/** Embed Image */
[Embed(source="$$(source)",
   mimeType="$$(image/gif,image/jpeg,image/png)",
   scaleGridTop="$$(scaleGridTop=1)",
   scaleGridBottom="$$(scaleGridBottom=1)",
   scaleGridLeft="$$(scaleGridLeft=1)",
   scaleGridRight="$$(scaleGridRight=1)")]
private var _$$(source)IMG:Class;

/**
* Embed Font
* fontSharpness = -400 > 400
* fontThickness = -200 > 200
*/

[Embed(source="$$(source)", sourceList="$$(sourceList)",
   mimeType="$$(application/x-font,application/x-font-truetype)",
   fontName="$$(fontName)", systemFont="$$(systemFont)",
   fontStyle="$$(fontStyle=normal,italic,oblique)",
   fontWeight="$$(fontWeight=normal,bold,heavy)",
   advancedAntiAliasing="$$(advancedAntiAliasing=true,false)",
   flashType="$$(flashType=true,false)",
   fontGridFitType="$$(fontGridFitType=pixel,none,subpixel)",
   fontSharpness="$$(fontSharpness=0)",
   fontThickness="$$(fontThickness=0)",
   unicodeRange="$$(unicodeRange)")]
private var _$$(source)FNT:Class;

/** Embed MP3 */
[Embed(source="$$(source).mp3", mimeType="audio/mpeg")]
private var _$$(source)MP3:Class;

/** Embed SVG */
[Embed(source="$$(source)",
   mimeType="$$(image/svg,image/svg-xml)",
   scaleGridTop="$$(scaleGridTop=1)",
   scaleGridBottom="$$(scaleGridBottom=1)",
   scaleGridLeft="$$(scaleGridLeft=1)",
   scaleGridRight="$$(scaleGridRight=1)")]
private var _$$(source)SVG:Class;

/** ArrayElementType */
[ArrayElementType("$$(class=int)")]

/** Bindable */
[Bindable(event="$$(eventname=change)")]

/** DefaultProperty */
[DefaultProperty("$$(defaultProperty)")]

/** Deprecated */
[Deprecated(message="$$(message)", replacement="$$(replacement)", since="$$(since)")]
   
/** Effect */
[Effect(name="$$(name)",
   event="$$(event)",
   deprecatedMessage="$$(deprecatedMessage)",
   deprecatedReplacement="$$(deprecatedReplacement)",
   deprecatedSince="$$(deprecatedSince)")]

/** Event */
[Event(name=="$$(name)",
   type="$$(type=flash.events.Event)",
   deprecatedMessage="$$(deprecatedMessage)",
   deprecatedReplacement="$$(deprecatedReplacement)",
   deprecatedSince="$$(deprecatedSince)")]

/** Exclude */
[Exclude(name="$$(name)", kind="$$(kind=property,event,style)")]

/** ExcludeClass */
[ExcludeClass]

/** IconFile */
[IconFile("$$(iconFile)")]

/** Inspectable */
[Inspectable(category="$$(category=Other,Common,Effects,Events,Layout Constraints,Size,Styles)",
   defaultValue="$$(defaultValue)",
   enumeration="$$(enumeration)",
   environment="$$(environment=none,Flash,MXML)",
   format="$$(format)",
   listOffset="$$(listOffset=0)",
   name="$$(name)",
   type="$$(type=String,Array,Boolean,Color,Font Name,List,Number,Object,String)",
   variable="$$(variable)",
   verbose="$$(verbose=1)")]

/** InstanceType */
[InstanceType("$$(type=mx.core.UIComponent)")]

/** NonCommittingChangeEvent */
[NonCommittingChangeEvent(name="$$(name=change)")]

/** NonCommittingChangeEvent */
[RemoteClass(alias="$(Package).$(FileName)")]

/** Style */
[Style(name="$$(name)",
   type="$$(type=Class)",
   arrayType="$$(arrayType)",
   format="$$(format=Number,Color,Length)",
   enumeration="$$(enumeration)",
   inherit="$$(inherit=yes,no)",
   states="$$(states)",
   deprecatedMessage="$$(deprecatedMessage)",
   deprecatedReplacement="$$(deprecatedReplacement)",
   deprecatedSince="$$(deprecatedSince)")]

/** Transient */
[Transient]

/** --------------- UNDOCUMENTED --------------- */
/** SWF */
[SWF width="$$(width=800)",
   height="$$(height=600)",
   widthPercent="$$(widthPercent=100)",
   heightPercent="$$(heightPercent=100)",
   scriptRecursionLimit="$$(scriptRecursionLimit=225)",
   scriptTimeLimit="$$(scriptTimeLimit=15)",
   frameRate="$$(frameRate=30)",
   backgroundColor="$$(backgroundColor=0xFFFFFF)",
   pageTitle="$$(pageTitle)"]

/** Frame - maybe missing arguments */
[Frame(factoryClass="$$(factoryClass=mx.managers.SystemManager)")]

/** MaxChildren */
[MaxChildren($$(MaxChildren=0))]

/** Mixin */
[Mixin]
public static function init(root:DisplayObject):void

/** PercentProxy */
[PercentProxy("$$(PercentProxy)")]