开发者

AS3 loaded PNG gradient transparency appearing as black

开发者 https://www.devze.com 2023-01-27 00:28 出处:网络
I\'m experiencing a strange PNG issue in my as3 flash project. I am loading a bunch of PNG\'s into flash which have gradient transparencies.

I'm experiencing a strange PNG issue in my as3 flash project. I am loading a bunch of PNG's into flash which have gradient transparencies.

In early slides, these are displaying correctly, later on in the project, the gradient transparency is showing as a solid black background.

Is this a memory issue? I've been pretty hot about memory clean up. All the images are loaded in using exactly the same scripts, and I can swap the images around with the identical results. It just seems like after a while flash stops showing the transparency right.

Images of my problem can been seen below.

Working: http://s331209305.websitehome.co.uk/board/working.jpg

and then after the first level has played:

broken: broken.jpg (same url as above w开发者_StackOverflowith broken.jpg at the end (apparently as I am a new user here I can't have more than one url in a post))

I've been search Google for literally hours but can't find anyone experiencing a similar issue.

Any advice very much appreciated.

T


Ok, I know this is an old post but I too searched for a long time on google and only found this reference to the problem I was having as well.

Anyways, long story short, I fixed my issue.

The problem was I had set the alpha way to high. I set it to 5 and it did something similar to yours. I had to make sure the alpha was always clamped between 0 and 1.

Hope that was your issue as well.


I'm curious if you are loading them on top of each other, and you start seeing buildup.

it's hard to tell what exactly is going on without seeing any code, but here are some ideas

  • make sure that the BitmapData has alpha enabled (this is usually done through the constructor)
  • if this is a memory issue (though this doesn't seem like it is) try using object pools. the HYPE framework has one, but there are others too.
  • Check how they are loaded. I use the casa lib for loading, which makes the handling of the images easier, I load pngs through it and haven't had any issues like this.
  • post a simplified version of the problem. I've solved a problem countless times where I tried to post the problem, but would simplify it to the bare essentials and end up seeing the cause.
0

精彩评论

暂无评论...
验证码 换一张
取 消