0 Replies Latest reply on May 10, 2009 6:38 PM by MatthewMorgan

    HTML object unable to load js file

    MatthewMorgan

      I am using a html object to load a wysiwyg editor in an air app as follows:

       

      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">

           <mx:String id="text">
          <![CDATA[
              <html xmlns="http://www.w3.org/1999/xhtml">
              <head>
                  <script type="text/javascript" src="com/company/editor/editor.js"></script>
              </head>
              <body>
                  <script type="text/javascript">

                      var editor = new Editor("{name}", "{width}", "{height}", "{toolbar}", "{value}");
                      editor.Create()

                  </script>
              </body>
              </html>
          ]]>
          </mx:String>

       

           <mx:Script>
              <![CDATA[

                private function htmlInit():void {
                      text = text.replace("{name}", this.name);
                      text = text.replace("{width}", this.width);
                      text = text.replace("{height}", this.height);
                     
                      if (this.content == null) {
                          // for some reason there are times that at this stage content is null instead of a blank string
                          // even though I have set it to a blank string when intialized.
                          this.content = "";
                      }
                      text = text.replace("{value}", (this.content.split("\n").join("")).split('"').join('\\"'));
                      text = text.replace("{toolbarSet}", this.toolbarSet);
                     
                      _tmp = text;
                      this.invalidateProperties();
                  }
                 
                  private var _tmp:String;
                 
                  override protected function commitProperties():void{
                      if(_tmp){
                          html.htmlText = _tmp;
                          _tmp = null;
                      }
                      super.commitProperties();
                  }

              ]]>

           </mx:Script>

           <mx:HTML id="html" creationComplete="htmlInit()" width="100%" height="250"/>

      </mx:Canvas>

       

      The problem I have is that if I have the application compiling the air package for flash 10.x.x (which is the default) it doesn't find the editor.js file and therefore "new Editor(...)" goes undefined and the page doesn't work.  If I then override the "target-player" option to 9.0.28 everything works.

       

      Of course the editor.js file is in the correct subdirectory of the air package which corresponds to the entry in the signature.xml.

       

      Any ideas of the cause and a way to get this to load in flash 10?

       

      Thanks in advance

       

      Matthew