开发者

Incompatible classes when loading SWF

I have two ActionScript 3 projects, game(.swf) and minigame(.swf). At runtime the main game loads the minigame via Loader. I also have a shared library (SWC) of event classes, included by both, which minigame will need to dispatch and game will need to listen to.

First: Is this possible this way?

Second: What will happen if I compile the minigame, then change the event classes so they're incompatible, then compile the main game. Will Flash crash when trying to load the minigame SWF? (I hope so)

Third: And what will happen if I change the event classes, but in a way that preserves inte开发者_运维技巧rface-level compatibility?


If you have classes named the same but not sharing the same functionality just use a different class path for each (i.e com.game.* com.minigame.*), this will avoid all conflicts.

Basically if a class named the same in several SWFs only the one loaded first will be used.

On the other hand if you really want to share the same classes between both of the SWFs, make sure you only include them in the main SWF (you can choose include/exclude in the publish settings of Flash IDE or in the compiler settings of Flex SDK). This will make the whole loading process a bit lighter and you will avoid weird conflict related bugs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜