all groups > flash actionscript > september 2005 >
You're in the

flash actionscript

group:

Action Script Access to Lines


Action Script Access to Lines Bluejay_00
9/12/2005 11:13:56 PM
flash actionscript:
I have an architectural drawing that was converted to a Flash file with
hundreds and hundreds of lines in it. I need to be able to somehow manipulate
all lines that have a certain color value. This doesn't have to be done via
ActionScript, but I am not aware of a tool in Flash that lets me select all
lines of a certain color at once.

I am comfortable in ActionScript, but I don't have a clue as to how
'enumerate' through all lines on the stage and select them in code. I realize
that I could select them by hand and then add them to a clip and manipulate
them, but it?s the by-hand selection I am trying to avoid (since there would be
hundreds of individual selections I would have to make).

I am probably out of luck, but I thought someone here might have an idea as to
how to do this. I know Flash itself has this ability in some fashion, but I
doubt it?s exposed through ActionScript.


Thanks,

Re: Action Script Access to Lines Bluejay_00
9/13/2005 12:00:00 AM
Yes. I apologize. I probably didn't explain my question very well.

The architectural drawing I am working with is made of a hundreds of lines
(all Flash vector lines), all of which have one of 4 colors. I need to be able
to select all of the lines of a particular color, either through code or
through some interface tool.

The color for a ?type? of line is precise, so I need to somehow ?enumerate?
through all of the vectors on the stage and detect the RGB value, selecting the
shapes that match my criteria.



Re: Action Script Access to Lines NSurveyor
9/13/2005 12:48:18 AM
Re: Action Script Access to Lines Bluejay_00
9/13/2005 8:16:15 PM
Looks like doing this in action script is not possible, so I am taking a
different approach.

I am working on building an extension that will select all ungrouped lines
that match a specified color. I can then move the selections to a separate clip
and manipulate the lines using the clip at run time.

This too is difficult, because Flash groups all ungrouped lines as one huge
element, making it difficult to select anyone line for manipulation.

In fact, the only quasi-option I have found so far is one suggestion to issue
mouse clicks on every space in your document, and some how test to see if a
shape matching the criteria is selected.

But this is an issue dealing with extensions so I will post there if I make it
work.

Re: Action Script Access to Lines NSurveyor
9/14/2005 12:11:33 AM
Yeah, I've been playing with JSFL to write a script that will select all lines
of a specific color (stroke color selected in Tools Panel). I looped through
the elements array in the current frame in each layer. Then, I checked if the
elementType was shape, and if it was I looped through the edge array. Then, I
got a control point, by using getControl, and had flash "click" on the control
point, selecting the line. Then, it checked to see if the selection's stroke
color was the one in the Tools Panel... if it was, it would add it to an array.
Then, after that finished I would look through that new array, and would
"shift-click" each good control point... I WISH THERE WAS AN EASIER WAY TO
LOOP THROUGH EACH STROKE!!!! ARRRGH! When I tested it, it did select many of
the lines of the correct color, BUT it did not select lines that were curved or
intersected with other lines. If you want this script, just let me know...
Re: Action Script Access to Lines Bluejay_00
9/14/2005 11:24:47 PM
That would be great, thanks. I started working on one, but you are a lot further than I am.

AddThis Social Bookmark Button