闪无忧
 
首 页 业界新闻 业界杂谈 Flash教程 Flash源码 Flash图书 Flash酷站 Flex & AIR 供求信息
   本栏目通告:   请大家多多关注[Flex应用案例],更希望大家[推荐好的案例]给我们
当前位置 :首页>Flex-AIR>Flex资料>列表

Flex Builder中使用Flash CS3组件

[来源:as3blog.com | 作者:as3blog | 时间:2009-02-08 | 点击:  | 收藏本文  【 】]
5uflash文章摘要:经过我的多次测试,发现直接引用Flash的SWC包只能获得相应的代码提示,并不能完全解决纯Flex Builder编译的问题。因此,如果你想彻底抛弃FLA,又希望能用Flash CS3的组件,必须先在Flash CS3中导出一个SWC,再将这个SWC引入到Flex的Library Path中。这种解决方案来自大

经过我的多次测试,发现直接引用Flash的SWC包只能获得相应的代码提示,并不能完全解决纯Flex Builder编译的问题。因此,如果你想彻底抛弃FLA,又希望能用Flash CS3的组件,必须先在Flash CS3中导出一个SWC,再将这个SWC引入到Flex的Library Path中。这种解决方案来自大名鼎鼎的moockblog同学:)

As a simple example, let’s assume we want to use the V3 TextArea component in Flex Builder. Here’s the general process we follow:

1) Create a .swc file containing the desired V3 components.
2) Add the .swc file from Step 1 to the Flex Builder project’s Library path.
3) Import and use the component classes.

To generate the .swc file in Flash CS3, we follow these steps:

1) Make a new Flash CS3 ActionScript 3.0 .fla file.
2) Drag the desired component(s) to the Library. In this example, we’ll drag the TextArea component to the Library.
3) Choose File > Export > Export Movie.
4) For File name, enter v3components.swf. (We don’t even want the generated .swf, but there’s no other way to get the .swc to compile.)
5) Select a folder in which to save the .swf file.
6) Click Save.
7) In the Export Flash Player dialog, check Export SWC.
8) Click OK.

The preceding steps generate two files, v3components.swf and v3components.swc, both of which are placed in the folder selected in Step 5.

Now let’s use v3components.swc in a Flex Builder project. Follow these steps:

1) In Flex Builder, select File > New > ActionScript Project.
2) For Project name, enter "V3Test.as".
3) Click Next.
4) For Main source folder, enter "src".
5) For Main application file, enter "V3Test.as".
6) On the Library path tab, click Add SWC.
7) Browse to the v3components.swc file from the preceding procedure.
8) Click Finish.
9) Update the code in V3Test.as so it looks like this:

package {
  import flash.display.Sprite;
  import fl.controls.TextArea;
  public class V3Test extends Sprite {
    public function V3Test() {
      var t:TextArea = new TextArea();
      t.text = "You're not cookin'";
      addChild(t);
    }
  }
}

10) Run the project.


文章如果有错误或者缺少文件,请发邮件提交给我们
上一篇:Flex与JSON及XML的互操作
下一篇:flex获取焦点
Tags:    
>>> 最新评论:(共有 0 位网友发表了评论)      查看所有评论
  发表评论
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
·本站发布内容均为客观表达作者观点,不代表闪无忧立场,请勿攻击和漫骂
·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的资讯,提倡就事论事,杜绝漫骂和人身攻击等不文明行为
  Flex及AIR分类
  Flex资料   Flex动态
  Flex案例   Flex源码
  AIR资讯
  搜索本站资料
Google
  Flex相关
  寻找Flex工作机会
  发布Flex工作机会
  相关文章
·Flex 4 Spark DockBar 浮动工具
·Visual Studio中使用Adobe的Flex
·Flex 4实现分页
·利用flixel和Flash Builder 4创
·Flex辅助产品-扩展工具包 1.X
·Flex控制对主机网页中脚本的访问
·flex应用中如何关闭浏览器
·基于Flex的免费在线的家庭设计装
·Flash Builder 4添加数据可视化
·Flex 4设置Spart Button控件的强
  热门文章
·Flex 3 AdvancedDataGrid的使用(第二
·Flex中文官方帮助教程下载
·如何从零开始编写一个flex组件
·用Adobe Flex 2和Java创建富Internet
·FLEX地图应用教程之一
·Flex 3 发现之旅:AdvancedDataGrid的
·基于Flex的在线图片编辑器
·学习Flex几个值得研究的例程代码
·FlexUnit 的用法
·Flex 3 dvancedDataGrid的使用(第一部
·Flex 入门教程
关于我们 - 免责声明 - 网站地图 - 商务服务 - 联系我们 - RSS地图
©CopyRight 2006-2008, 5UFlash.COM, Inc. All Rights Reserved
鲁ICP备06034971号