Skip navigation
jameztrue
Currently Being Moderated

evalScript() not returning in Fireworks with setDocumentImageSize()

Jul 16, 2012 9:26 AM

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)

 

package 
{
          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! 

 
Replies
  • Currently Being Moderated
    Aug 15, 2012 4:41 PM   in reply to jameztrue

    I have the same problem here.

     

    I'm trying to use the evalScript, but CSInterface.instance,  and CSXSInterface.getInstance(), and CSXSInterface.instance always give me a Error #1009.

     

    This is the line that generates the error:

     

    CSInterface.instance.evalScript("alert('x', 'y', false)");

     

    I'm using the CSXSLibrary-3.0-sdk-4.5-public.swc from http://download.macromedia.com/pub/developer/creativesuite/extension-b uilder/cssdk-free-2.0.zip.

    My Photoshop is CS6 version: 13.0 x64.

     

    Any help will be appreciated!

     

    Thanks a lot!

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2012 7:53 AM   in reply to Nevitones

    Found the solution!

     

    I was using the wrong SDK.

     

    Flex 5.6.0 instead Extension Builder 3.4.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points