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

Cut out transparent background with AS3

Engaged ,
Oct 10, 2018 Oct 10, 2018

Copy link to clipboard

Copied

Hey,

I'm working with Flash Builder (previously Flex). I've got hundreds of vector images in .swc format. Problem is that pics have big transparent background. Like whole object is 400x400 but the drawn content is 50x50. I'm looking for a way to remove this background with AS3 code in Flash Builder. Is there a way to do it? Thare are no instance names in these pics. So I'm looking for a way to cut out only visible content.

I could cut out content in Flash and create new object without backgrounds, but it's a lot of work for that many objects.

Views

526

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
Community Expert ,
Oct 11, 2018 Oct 11, 2018

Copy link to clipboard

Copied

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
LEGEND ,
Oct 11, 2018 Oct 11, 2018

Copy link to clipboard

Copied

If your goal is to reuse some old graphics that you only have inside SWCs, you could rename the SWC to be .zip, uncompress it, then import the SWF into an FLA, to get at the original sized vectors.

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
Engaged ,
Oct 12, 2018 Oct 12, 2018

Copy link to clipboard

Copied

I think it's a diffrent kind of problem, I have the original .fla files available.

I did what you said and didn't work. I imported .swf to .fla inside Animate. But the swf should have hundreds of pics inside and I don't see any of them, just the swf object with empty stage.

Anyway, graphics were made with AI and then imported to Animate. In Animate all pics have invisible mask layer around them. I can see this mask when I go inside the object by double-click. I suppose this invisible mask background was the stage size in AI. Mask is not on the main movieclip but rather every part of main movieclip is a movieclip with mask layer. I'm not a graphic designer so it's hard to explain, I'll attach expample .fla to this message. WeTransfer

What I need to do is use those images in normal size, without the masks.

For example in this .fla attached to this message - I have pants with 350px height and 100px width. But because of the masks whole MC is 340 width x 520 height. And I want just simple pants in 100x350px with normal registration point at 0,0.

So I wonder If I can do this in AS3 by some kind of cutting out only the visible parts of swc object. Or if it's not possible in AS3/Flex, how can I remove this mask in Adobe Animate?

After removing mask I'd need to put the visible object on 0,0 registration point. Because now the mask makes every object the same big size while content is smaller. Removing masks manually will take lot of time because I have around 1000 pics, every one of them is made of few other mc with masks.

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
Engaged ,
Oct 12, 2018 Oct 12, 2018

Copy link to clipboard

Copied

LATEST

I've found interesting solution in DMTAtlas, but I don't know how to replicate this behaviour.

When genereting atlas with DMT I save the atlas on hard drive and can see what kind of objects are there. I use command:

dmtBasic.process(false,param,true);

When param is set to 0 the object from .swc rasterizes in normal way - image is surrounded by mask and there is only one image in atlas.

pic10.png

But when I set param to 1 (or above) then the mask and image are rasterized separately. Then the atlas has two images: mask and acctual image.

pic20.png

(the red background is not a problem, it's just an option in DMT, don't mind that)

This way I can get the image without the mask, but only in raster format. I need to get it in vector format, but don't know how. I tried to understand what DMT is doing to my object but I can't understand how it works. I know there is something happening in AssetsGroupBuilder class, but that's all I was able to find out.

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