0 Replies Latest reply on Oct 24, 2008 8:51 AM by dcflex

    Howto create two instances on one swf

    dcflex
      I created a swf file and would like to use it in two different jsp pages. The information on two pages is different base on back bean and jsp page setup. For some reason, the flex area are the same on both page and not refreshed.
      I created two flex object js files and gave them two different id but it still didn't work.
      Jsp Page #1:
      <h:panelGroup id="flexArea" style="height:650px; width:100%;">
      <f:verbatim>
      <div id="contextDiv"> </div>
      <script type="text/javascript" src="../../scripts/flexObject1.js"></script>
      </f:verbatim>
      </h:panelGroup>

      Js File #1 (flexObject1.js):
      var so = new SWFObject("MySwf.swf", "Page#1", "100%", "100%", "9", "#F1F2E7");
      so.addParam("quality", "high");
      so.addParam("name", "Page#1");
      so.addParam("id", "Page#1");
      so.addParam("AllowScriptAccess", "always");
      so.addParam("wmode", "opaque");
      so.addParam("menu", "false");
      so.addVariable("variable1", "value1");
      so.write("contextDiv");

      Jsp Page #2:
      <h:panelGroup id="flexArea" style="height:650px; width:100%;">
      <f:verbatim>
      <div id="contextDiv"> </div>
      <script type="text/javascript" src="../../scripts/flexObject2.js"></script>
      </f:verbatim>
      </h:panelGroup>

      Js File #2 (flexObject2.js):
      var so = new SWFObject("MySwf.swf", "Page#2", "100%", "100%", "9", "#F1F2E7");
      so.addParam("quality", "high");
      so.addParam("name", "Page#2");
      so.addParam("id", "Page#2");
      so.addParam("AllowScriptAccess", "always");
      so.addParam("wmode", "opaque");
      so.addParam("menu", "false");
      so.addVariable("variable1", "value1");
      so.write("contextDiv");

      Can someone please tell me what I missed?