Bitmaps disappear when scaled

New Here ,
Sep 22, 2009 Sep 22, 2009

Copy link to clipboard

Copied

Flash CS3/Flash Player 9 issue

I've imported 29 bitmaps into my library (gifs, each one 1728x1152, size ranges from 4-14kb, in each case the vast majority of the image is transparent).

I add each one to the stage in the following manner:

var img1Data = new img1(1728,1152);

var img1Map = new Bitmap(img1Data);

containerMC.addChild(img1Map); // MovieClip to which all of the bitmaps are added

If I set scaleX and scaleY of the containerMC to 1, .75, .5 or .25, all of the bitmaps show up.  However, when I scale to a different amount, .6 or .8, for example, the first six bitmaps added do not show up.  I've changed around the order of the bitmaps, and it always seems to be the first six that do not display.

It doesn't seem to matter if I scale the container, or scale each bitmap individually; the result comes out the same.

Any ideas as to why this is happening and how I can avoid it?  Thanks for your help!

TOPICS
ActionScript

Views

2.0K

Likes

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

correct answers 1 Correct answer

LEGEND , Sep 24, 2009 Sep 24, 2009

kglad -- where your bitmaps imported graphics or just AS generated ones?

I'm wondering if this is the continuation of the magic mysterious high-quality anti-aliasing array problem?

Back in the day there was a limit of 10 bitmaps with transparency that could be properly anti-aliased by Flash's rendering engine. Evidently there was a hard coded array of length 10 that held the references and when you got more the rest went away. I think in Flash 9 they improved that number, but not to an unlimited d

...

Likes

Translate

Translate
New Here ,
Sep 23, 2009 Sep 23, 2009

Copy link to clipboard

Copied

Tried it in CS4 and FP10 and got very similar results: all bitmaps display as expected at 100%, but at anything less, the first few do not show up.  If I change the order, it is always the first few that I added that don't show up.  Situation also causes performance issues.

The bitmaps are still there, but they are getting covered up by the normally transparent parts of other bitmaps.

As an experiment, I tried starting from scratch: made 28 squares, each in a different place on a 1300x900 pixel canvas using Fireworks.  Exported them as gifs.  Imported them into the library.  Added them to the stage via actionscript (as3), as above, and the same thing happens.

Interestingly though, in both cases, if I apply a filter (e.g. GlowFilter) to any one of the visible bitmaps, then they all show up as they should, regardless of the scale, and performance seems okay.

Is this a bug or a limitation, or is there some issue with my actionscript?  Any ideas as to what's going on here?

Likes

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
Adobe Community Professional ,
Sep 23, 2009 Sep 23, 2009

Copy link to clipboard

Copied

i don't see any problem.

Likes

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
New Here ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

kglad: Thanks for the repsonse.  Do you mean that you don't see a problem with my ActionScript, or that you don't see the problem more generally?

Likes

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
Adobe Community Professional ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

i used actionscript to create 30 bitmap instances in a for-loop and scaled the ith bitmap by i/50.  they all appeared on-stage without problem.

Likes

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 ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

kglad -- where your bitmaps imported graphics or just AS generated ones?

I'm wondering if this is the continuation of the magic mysterious high-quality anti-aliasing array problem?

Back in the day there was a limit of 10 bitmaps with transparency that could be properly anti-aliased by Flash's rendering engine. Evidently there was a hard coded array of length 10 that held the references and when you got more the rest went away. I think in Flash 9 they improved that number, but not to an unlimited degree.

Try adding this line to your code:

stage.quality=StageQuality.LOW

The low setting tells Flash not to anti-alias those things and therefore they should not have this problem. Of course they won't look so hot. But if they become visible then we will know that it is most likely related to some variation of this old issue.

Otherwise there might be something else, but heck if I know.

Likes

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
Adobe Community Professional ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

i imported a bitmap.  i set quality to HIGH and have no problem with 90+ bitmaps scaled on-stage.

i doubt it's the problem you mentioned because with some scaling, the op has no problem.

Likes

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
New Here ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

Excellent!  I inserted that one line of code and it solved the problem: all bitmaps became visible.  Tried that in both CS3/FP9 and CS4/FP10 and in both cases, that made the difference.  The quality is lower of course.  Very interesting.  Is this limitation documented anywhere?

I wonder what the difference is between what I am doing and what you are kglad.  Are you only importing a single bitmap?  Would that make any difference?

Likes

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
Adobe Community Professional ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

i was using 1 bitmap but i just tried it with 12 and had no problem.

Likes

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 ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

Crazy. I was so with kglad that it was very unlikely, but I was grasping at straws there.

You can try StageQuality.MEDIUM to see if that works better and perhaps you can toggle the stage quality between different settings as the need arrises.

I did import 31 different png files and scalled them to 35% (also tried another at 70%) and I couldn't reproduce the issue myself. So I don't know exactly what the difference would be either.

Likes

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
Adobe Community Professional ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

it's not the transparency limitation issue.  there's something else going on.

Likes

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 ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

Just thought of two things that could be causing the problem.

First my thought is that since these are so big you are overlapping all of them? That could be part of it. My pngs are much smaller and don't all overlap each other.

The other could have to do with the size of the graphics as well. I don't know exactly how this post could relate, but you might find it interesting:

http://quasimondo.com/

Likes

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
New Here ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

LATEST

I'm really appreciating the discussion on this, thanks!

Yes, the images all overlap.  It's a mapping animation with regions and overlays.  The individual file sizes are quite small (4-14kb), and the size of the swf at this point is only 212kb.  Some images become hidden with the quality set to medium as well.

Likes

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

Make your promotional social content with Adobe Express.

Get started quickly with free templates: