2 Replies Latest reply on Apr 23, 2012 9:35 AM by animator_geek

    Workaround for JSFL shape selection bug?


      There seems to be a bug in the document selection reporting in JSFL in  CS4 (haven't tested earlier versions).  I submitted it as a bug to Adobe  but I'd really like to find a workaround for it.  I've included my bug  report below.  Has anyone else encountered this?  If so, have you  figured out a workaround?  It's pretty annoying, making the tool I'm  working on really difficult to manage.

      After performing a publish preview, fl.getDocumentDOM().selection  reports an incorrect selection of raw shapes.

      Steps to reproduce bug:
      1. Create a JSFL command with the following contents:

      doc = fl.getDocumentDOM();
      fl.trace("there are " + doc.selection.length + " items selected");

      2. Start the authoring environment fresh, with a new document.
      3. Draw several shapes on the stage, not touching each other, all in  the same frame and layer.
      4. Select one of those shapes but leave the others unselected.
      5. Run the previously created JSFL command.  It will send the following  text to the output panel, as one would expect:

      "there are 1 items selected"

      6. Do a publish preview (either Flash or HTML).
      7. When it comes up, close the preview window.
      8. Deselect all and then select one of the shapes (again, keeping the  others unselected).
      9. Run the JSFL command again.  This time, it will say that there are n  items selected (where n is the number of shapes you drew in step 3).   So if you drew three shapes, it will print out the following:

      there are 3 items selected

      Note that this result will be the same even if you go to a different  document, do a publish preview on that document, then return to the  original.  It seems that simply doing a publish preview alters Flash's  state to report the selection incorrectly.

      Results: The JSFL command reports that all the shapes are selected,  despite the fact that only one of them is.  The only way I've found to  get Flash back to its normal behavior is to restart the authoring  environment.

      Expected results: In the steps above, the JSFL command should always  print out that there is one element selected.  There's no reason that  doing a publish preview should change that.

        • 1. Re: Workaround for JSFL shape selection bug?
          Rytis Alekna

          When selected all shapes in selection are treated as one. You can see it if you run this script with selected multiple shapes:


          fl.trace( fl.getDocumentDOM().selection[0].contours.length );


          It will output you twise bigger number then selected shapes (because each Shape has two contours - one clockwise, other counterclockwise).


          Of course this. implementation is strange for me too. Thats how i found your post

          • 2. Re: Workaround for JSFL shape selection bug?
            animator_geek Level 1

            Not just a strange implementation. It's inconsistent. Did you read my whole post? Flash was reporting a selection size of 3 when it should have been reporting 1. We're talking about shape elements here, not contours. Yes, it should report two contours per shape, but it should report only one shape, no matter how many are selected in a single frame on a single layer, unless they're grouped to separate them from each other.