2 Replies Latest reply on Jul 1, 2008 6:08 AM by nu2cf

    Problem with multiple instances of same module

    nu2cf
      I want to call the same module in several different viewstates. Based on a variable for each viewstate the module returns different results. Here is a shortened version of my code:

      private var lm:linkModule;

      private function moduleHandler(promotion:String):void
      {
      lm = linkModule(lm1.child);
      lm.initHandler(promotion);
      }

      <mx:ViewStack id="estonishViewStack" width="100%" height="100%">
      <mx:Canvas x="0" y="0" width="100%" height="100%" id="saleView" label="Sales">
      <mx:ModuleLoader id="lm1" url="modules/linkModule.swf" ready="moduleHandler('sale');" />
      </mx:Canvas>
      <mx:Canvas x="0" y="0" width="100%" height="100%" id="seasonalView" label="Seasonal">
      <mx:ModuleLoader id="lm1" url="modules/linkModule.swf" ready="moduleHandler('seasonal');" />
      </mx:Canvas>
      </mx:ViewStack>

      Is there a more elegant (shorter) way to code the actionscript function other than a number of "if" statements based upon the variable or module id?