3 Replies Latest reply on Aug 16, 2012 7:53 AM by Nevitones

    evalScript() not returning in Fireworks with setDocumentImageSize()


      I have had an issue with building an extension for Fireworks (CS6).


      The issue is that when certain commands are run in the JSX file, evalScript() never gets a return value.

      The problematic functions are these:

      - setDocumentImageSize()

      - setDocumentCanvasSize()

      Most functions in Fireworks work as expected (including exportTo(), alert() ) and evalScript() gets a return value with no issues.


      The JSX File has the following: (ResizeImage.jsx)


      function jsxFunction()
                // Fireworks (JS-only app)
          fw.getDocumentDOM().setDocumentImageSize({left:0, top:0, right:200, bottom:125}, {pixelsPerUnit:72, units:"inch"}, true, -1);
           alert("resize complete"); 
                var xml = '<object>';
                xml += '<property id="success"><true/></property>';
                xml += '</object>';
                return xml;


      The ActionScript file has the following (ResizeImageJSX.as)


                import com.adobe.csxs.core.CSInterface;
                public class ResizeImageJSX
                          public static function run():void 
                                    trace("begin script");
                                    var result:String = CSInterface.instance.evalScript("jsxFunction"); 
                                    // This line is never reached because of the function: fw.getDocumentDOM().setDocumentImageSize()
                                    // Event nativeApplication_deactivateHandler() appears to run right after jsx function is complete, and evalScript() continues to wait indefinitely.
                                    trace("Returned a value:" + result);



      Any help would be appreciated.  I'm not sure if there is any workaround, since FW does not appear to support HostObject (jsxInterface object is null) and I can't find any alternative function in FW.


      The purpose of the script is that I want to use actionscript to upload the file after it has been resized in Fireworks.


      Thanks in advance!