Flex - Generate a ModuleLoader at Runtime

Posted on July 28th, 2007 in blogathon 2007, flex, software by sam

I spent most of a day running up against a problem in Adobe’s Flex 2.0. Flex 2.0.1 introduced the concept of modules. With this, you can stick a <mx:ModuleLoader> component in your .mxml file, then load it with the url to your module .swf file when you need it.

Now, I wanted to allow the user to load arbitrary modules at arbitrary times, and then load those into a ViewStack component. The problem is, no matter what I did, I couldn’t seem to get the dynamically loaded module to obey sizing (IE, height=”100%”). Here’s the solution: You have to put the ModuleLoader in a Canvas, and then add the Canvas to your ViewStack. Also, you must use percentWidth and percentHeight in your <Module> tag (not width and height).

  • Digg
  • del.icio.us
  • blogmarks
  • Fark
  • Reddit
  • Slashdot
  • Technorati
  • Propeller
  • StumbleUpon

One Response to 'Flex - Generate a ModuleLoader at Runtime'

Subscribe to comments with RSS or TrackBack to 'Flex - Generate a ModuleLoader at Runtime'.

  1. said,

    on July 28th, 2007 at 4:17 pm

    Dude, seriously, you’re supposed to be keeping me awake for this thing.. SNORE.

Post a comment