`
rainwindboy
  • 浏览: 55378 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

【原创】如何发布你的SWC包

    博客分类:
  • Flex
阅读更多

    在Flex中,有的时候,我们将一些常用的功能封装到了几个AS文件中去,但是如果要引用,还需要将公用的类引入到我们的工程,我们可不可以将这些功能打成一个swc发布出来供大家使用呢,答案是肯定的,现在就介绍一下该如何打SWC包。
    我们使用的是JAVA程序员的法宝-eclipse来完成的。
    现在有两种方式来完成swc打包动作,一个是在eclipse中的flex插件中建立一个swc工程,一个是利用eclipse中的ant工程来完成。

    一、ant方式打swc
    为了方便大家的使用,我将一个打PureMVC_MultiCore.swc的工程放到了网上,请大家先下载一下
    下载地址:http://www.blogjava.net/Files/rainwindboys/SWCTest.rar

    下面的介绍就是围绕这个工程展开的。
    首先,请修正工程下的build.properties文件,文件如下:
# Window and document title for the documentation
title = ASDocs Test Library

# Class-folders you want to search for classes to be included in the docs, seperated by spaces (for example   ../com/ ../net/  )
# to include every .as and .mxml file within your project, just state   ../
domainextensions = ./flex-src

# The Location of deployment library on your Computer (PC/Mac) for compiled SWC file
liboutputfolder = bin
liboutputfile = PureMVC_MultiCore.swc
libpath = libs

# The Location of the output folder for your generated documents
docsoutputfolder = bin/docs

# Home directory for flex sdk 3, change this to build for Mac or PC using # as comment
# FLEX_HOME = C:/Program Files/Adobe/Flex Builder 3/sdks/3.0.0
FLEX_HOME = D:/Program Files/Adobe/Flex Builder 3 Plug-in/sdks/3.0.0
    
# The location of your asdoc.exe, change this to build for Mac or PC using # as comment
#asdoc.exe = C:/Program Files/Adobe/Flex Builder 3/sdks/3.0.0/bin/asdoc.exe
asdoc.exe = D:/Program Files/Adobe/Flex Builder 3 Plug-in/sdks/3.0.0/bin/asdoc.exe

需要修正的地方

domainextensions = ./flex-src:这个是你要打包的src路径
liboutputfolder = bin:这个是swc输出的路径
liboutputfile = PureMVC_MultiCore.swc:这个是输出swc的名字
libpath = libs:这个需要打包src用到的类库
docsoutputfolder = bin/docs:这个是asdoc输出的路径
FLEX_HOME = X:/Program Files/Adobe/Flex Builder 3 Plug-in/sdks/3.0.0:你的flex SDK的路径
asdoc.exe = X:/Program Files/Adobe/Flex Builder 3 Plug-in/sdks/3.0.0/bin/asdoc.exe:这个是asdoc的路径



    在eclipse中window->preferences选择ant中的Runtime,将D:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.0.0\ant\lib\flexTasks.jar引入

然后执行build.xml生成SWC

二、建立SWC工程方式
这个比较简单,在建立工程的时候,选择flex libiary project,直接默认到最后一步。
然后再建立的工程上面鼠标右键,选择flex libiary build path 选中你要打入的src,点击完成后,会在bin目录中生成swc,但是需要注意的,如果没有生成swc有可能是src的编译没有通过。

比较初略,如果有不明白的,欢迎给我发mail 



分享到:
评论
2 楼 oldJ 2009-01-20  
 
1 楼 kotime42 2008-12-20  

两个都测试过了

相关推荐

Global site tag (gtag.js) - Google Analytics