Skip navigation
Currently Being Moderated

Workaround for JSFL shape selection bug?

Apr 1, 2010 4:14 PM

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.

******BUG******
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.

 
Replies
  • Currently Being Moderated
    Apr 23, 2012 4:44 AM   in reply to David Johnston

    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

     
    |
    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