开发者

Flex SKD's main project and external SWC's

Can I have an application that is based on flex4 SDK and a library (sw开发者_如何学Pythonc file) inside this project which is based on another version of flex (3.2)?

how will flex deal with this situation?


In theory, a Flex 3 SWC should work fine for all Flex 3 point releases. A Flex 4 SWC should work fine with all Flex 4 point releases. I wouldn't expect a Flex 3 SWC to work against Flex 4, but it depends what is in the SWC and what classes are used.

In practice, odd errors sometimes do crop up. I strongly recommend compiling all your SWCs against the same SDK you use with your main project. A lot of odd runtime and compiler errors can be solved by making sure your versions match.

This is the type of question that makes me wonder "wouldn't it have been quicker to try it than to ask the question." Are you having a specific problem?


Think of it this way:

Your Flex application starts loading and flashPlayer loads in the UIComponent class. When the classes from your swc are used (and they have a UIComponent compiled-in from Flex 3.2) flashPlayer uses the already-used UIComponent from the swf that was first initializing, not the one that was compiled into the swc.

[well, that's simplified -- it's the compiler that does all this crap to cut-down on swf size... modules do the same thing tho'. read up on applicationDomain stuff across modules -- if two modules use the same class and one is loaded first, the second (even if it has the updated version of that class) will use the old, first-loaded class.]

Best practice: don't use swcs. If possible, build from the source with the exact same sdk used for compiling.

Next-best practice: Use swcs that don't use many Flex classes. Swiz is a great example.... they pull in some flex classes, but if you search on the project for "mx." you'll find 25ish results of classes that won't change any time soon --- IMXMLObject, FlexEvent and some Binding classes. If your swc uses ComboBox, you are in trouble, period. (have you seen bug releases for ComboBox in the last two years? -- that thing has changed more times since the 3.2sdk than the times I've changed clothes, and that's at least once per week).

I don't spend a lot of time on this site, but I'd be interested in knowing which swc you're trying to pull in. Is it open-source?

I hope that helps. Best of luck, Jeremy

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜