• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Select by color

Contributor ,
May 23, 2022 May 23, 2022

Copy link to clipboard

Copied

It's possible to select objects by color. It is for the option to select a scene of strokes with different colors. I want to select all those with the same color with edit multiple frames.


____
2D vector animator since 2000 & PhD

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 23, 2022 May 23, 2022

Copy link to clipboard

Copied

Depending on what you want to do to those strokes, you may be able to use Find And Replace Strokes.

 

Nick - Character Designer and Animator, Flash user since 1998
Member of the Flanimate Power Tools team - extensions for character animation

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 23, 2022 May 23, 2022

Copy link to clipboard

Copied

I have tried, but the option is to select the stroke with green color and delete. And keep the red stroke.
Thanks!

Animate_gYpbLHbyRk.png


____
2D vector animator since 2000 & PhD

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 23, 2022 May 23, 2022

Copy link to clipboard

Copied

I found this code that works in Flash CS6, but not in Animate 2021-22

 

var dom = fl.getDocumentDOM();
var timeline = dom.getTimeline();

/*
 MODIFY THE KEYS IN THIS TABLE.
 */
var coloursToDelete = {
    'FF0000': true,
    'FFFF00': true,
};

var replacements;
var srcColour;
var layerName;

// Make sure all colours are lowercase and start with a #
for(var colour in coloursToDelete)
{
    var val = coloursToDelete[colour];
    delete coloursToDelete[colour];
    
    if(colour[0] !== '#')
        colour = '#' + colour;
    
    coloursToDelete[colour.toLowerCase()] = val;
}

// Make sure to clear the selection, or the script will crash?
dom.selectNone();

fl.outputPanel.clear();

var deleteCount = 0;

// ----------------------------------------------------
// Loop through all layers
for(var layerIndex in timeline.layers)
{
    var layer = timeline.layers[layerIndex];
    
    if(!layer.visible)
        continue;
    
    // ----------------------------------------------------
    // Loop through all frames of the current layer
    for(var frameIndex = 0; frameIndex < timeline.frameCount; frameIndex++)
    {
        var frameDeleteCount = 0;
        var frame = layer.frames[frameIndex];
        
        if(!frame)
            continue;
        
        // ----------------------------------------------------
        // Loop through all elements in the current frame
        for(var elementIndex in frame.elements)
        {
            var element = frame.elements[elementIndex];
            
            if(!element)
                continue;
            
            if(element.elementType !== 'shape')
                continue;
            
            // ----------------------------------------------------
            // Check each edge in the current shape
            for(var edgeIndex in element.edges)
            {
                var edge = element.edges[edgeIndex];
                var stroke = edge.stroke;
                var fill = stroke ? stroke.shapeFill : null;
                
                if(!fill)
                    continue;
                
                if(fill.color in coloursToDelete)
                {
                    stroke.shapeFill = null;
                    edge.stroke = fill;
                    deleteCount++;
                    frameDeleteCount++;
                }
            }
        }
        
        // A quirk of deleting strokes like this is that shapes won't automatically merge like they would when deleting a stroke in the editor.
        // Selecting then deselecting will force this to happen
        if(frameDeleteCount > 0)
        {
            dom.selectAll();
            dom.selectNone();
        }
    }
}

fl.trace('-- ' + dom.name + ': Deleted ' + (deleteCount) + ' strokes.');

 


____
2D vector animator since 2000 & PhD

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 10, 2022 Nov 10, 2022

Copy link to clipboard

Copied

LATEST

If search and replace allowed to use replace by an empty color it could be used.


____
2D vector animator since 2000 & PhD

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines