且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Flash 开发、Flash 语言 (AS2/3) 和 Flash IDE 的隐藏功能/技巧

更新时间:2023-10-26 23:33:34

[Flash IDE]

[Flash IDE]

这不是一个功能,而是一个陷阱.为 FLA 指定文档类时,编译器不会对该类进行子类化,而是修改它.

This isn't a feature as much as it is a gotcha. When specifying a document class for an FLA, the compiler does not subclass that class, it modifies it.

当您有多个具有相同文档类的 SWF 时,这会导致问题,所有这些都被加载到另一个 SWF 中(因为两个同名的类不能并排加载到同一个应用程序域中).这导致第一个被加载,第二个使用第一个修改后的类,产生奇怪的错误(如你所想).

This can cause problems when you have several SWFs with the same document class, all being loaded into another SWF (since two classes with the same name cannot be loaded side-by-side into the same application domain). It results in the first being loaded and the second using the first's modified class, producing weird errors (as you can imagine).

解决方案是:

  • 为子类化文档类的每个 FLA 创建一个代理类
  • 将每个 SWF 加载到新的子应用程序域中