Skip navigation
misterp85
Currently Being Moderated

document.selection problem

Feb 11, 2013 2:31 PM

Tags: #shape #jsfl #document.selection

Hello,

I have a small problem with jsfl. I'm trying to convert make jsfl to convert all shapes to movie clips in *.fla file.

Here is some files to test, simple scene and jsfl script, which converts all shapes in file to movie clips.

 

Symbol 1 -> Layer 2 -> frame 50

 

At line 87 of file "ConvertToMovieClips.jsfl":

'convertToSymbol' requires a selection.

 

but it finds Shape and creates Array for selection, but document.selection.length still 0.

I tried to move this keyframe and sometimes it's working fine, sometimes throws this error.

 

Any solution or workaround for this?

 

https://dl.dropbox.com/u/7525970/jsfl/ConvertToMovieClips.jsfl

https://dl.dropbox.com/u/7525970/jsfl/convertToSymbol.fla

 
Replies
  • kglad
    72,213 posts
    Jul 21, 2002
    Currently Being Moderated
    Feb 11, 2013 4:38 PM   in reply to misterp85

    are you iterating through the elements array of each frame?

     
    |
    Mark as:
  • kglad
    72,213 posts
    Jul 21, 2002
    Currently Being Moderated
    Feb 12, 2013 7:56 AM   in reply to misterp85

    copy/paste your jsfl code that iterates through the elements array and tries to convert shapes to movieclips.

     
    |
    Mark as:
  • kglad
    72,213 posts
    Jul 21, 2002
    Currently Being Moderated
    Feb 12, 2013 1:08 PM   in reply to misterp85

    use:

     

     

    for (k = 0; k < frame.elements.length; k++)

       {

            element = frame.elements[k];

     

             if (element.elementType == "shape")

             {

                    

     

                    

    doc.selection[0] = element;

                     doc.convertToSymbol("movie clip", "", "top left");               

            }

    }

     
    |
    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