2010-03-24

Loading CSS at runtime

Just spent like 7 hours trying to debug a problem and finally found the solution by reading someone's blog. Basically was trying to load the CSS settings at runtime in my Flex 3 application. It didn't work at all, kept getting the following error:

Error #1034: Type Coercion failed: cannot convert bla to IFlexModule

Finally the problem was... the CSS filename (bla.css), was the same as the application MXML file (bla.mxml)! Changing the name of the CSS file to something different (app.css) basically solved the problem. Guess when you compile a CSS file to SWF, internally the generated ActionScript class is named the same as your CSS file and thus conflicts with the main application classname.

To learn how to load at runtime, read the "Loading style sheets at run time" in the Flex Livedocs.

3 comments:

Anonymous said...

Another weird thing, you can't name an Application mxml "prototype.mxml". It'll run locally w/i Flash/Flex Builder, but it won't via command line builds and you get this. Joys of Flex.

[ERROR] Type was not found or was not a compile-time constant: prototype. [Generated code (use -keep to save): Path: prototype-generated.as, Line: 682, Column: 14]

cc22 said...

情趣用品,情趣,
角色扮演,吊帶襪,丁字褲,飛機杯,
按摩棒,跳蛋,G點,
自慰套,
情趣內衣,
情趣,情趣用品,
SM,G點,按摩棒,
飛機杯,充氣娃娃,
自慰套,情趣用具,

Anonymous said...

酒店打工 酒店兼職
台北酒店 打工兼差 酒店工作 禮服酒店
酒店兼差 酒店上班 酒店應徵 酒店 酒店經紀