2

我们有一个程序,它可以生成多个 SWF 文件、一些 CSS 和 XML 文件,所有这些都需要部署才能使事物正常工作。

是否有将所有这些文件打包成一个 SWF 文件的程序或技术?

4

4 回答 4

1

如果您使用 Flex 编译器(mxmlc或 FlexBuilder),您可以嵌入 SWF 文件并在运行时创建它们,或多或少类似于创建任何显示对象:

package {


  public class Assets {

    [Embed(source="another.swf")]
    public var another : Class;

  }

}

上面的代码嵌入了文件another.swf并可以在另一个 SWF 中创建它,如下所示:

package {

  import flash.display.Sprite;


  public class MyFancySite extends Sprite {

    public function MyFancySprite( ) {
      var theOther : DisplayObject = new Assets.another();

      addChild(theOther);
    }

  }

}

CSS、XML 和任何其他文件都可以以类似的方式嵌入。这是一个描述: http://livedocs.adobe.com/flex/3/html/help.html?content= embed_4.html

于 2008-10-10T20:27:47.133 回答
0

您可以对所有这些文件使用 flex sdk 和 [EMBED] 标签,至于 xml 和 css,您可以在 flex 生成的包装器 swf 中编译它们。它的工作原理是拥有一个“骨架”mxml 文件,该文件将注入 css 和 xml,然后嵌入 swf 文件。

于 2008-10-07T13:24:10.107 回答
0

using flex to easily embed them is a good way to go, and if that doesn't sound like fun, think of it this way - XML and CSS data is really just a big long string - so hard-code the string data as a variable inside of your project, and use it as normal.

于 2008-10-12T09:05:21.253 回答
0

我认为您可以将它们拖到主 swf 的库中并引用它们。至少您可以使用其他 SWF,但不确定 CSS 和 XML。

于 2008-09-16T01:15:56.093 回答