Skip to main content
Known Participant
September 22, 2009
Answered

Bitmaps disappear when scaled

  • September 22, 2009
  • 1 reply
  • 2636 views

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!

This topic has been closed for replies.
Correct answer Rothrock

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.


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.

1 reply

wmohnsAuthor
Known Participant
September 23, 2009

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?

kglad
Community Expert
Community Expert
September 24, 2009

i don't see any problem.

kglad
Community Expert
Community Expert
September 24, 2009

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?


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.