[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2322
  • Last Modified:

Flash not loading some PNG files via Actionscript

I have a set of PNG files saved from a PHP script on a server.  They work fine in the browser.  I then try to open them in flash. If I import them in authoring it works fine.  If I try to load them via loadMovie I get a solid red rectangle.  I noticed that tehy are about 2 K.  If I resave from fireworks (no changes) they are 33 K and then load fine.  The odd thing is that the image data is there and works otherwise.  ANy ideas as to how to force them to work dynamically?
0
MediaMacros
Asked:
MediaMacros
  • 8
  • 5
  • 5
1 Solution
 
Aneesh ChopraCommented:
Hi,

As you said that PHP script on a server is actually creating PNG files which you are loading in flash using loadMovie.

I feel that flash is trying to load these files before it gets generated completely on server.
you shouldput a check to test if PNG file has been generated completed then start loading it inside flash.

Rgds
Aneesh
0
 
MediaMacrosAuthor Commented:
I thought that too so I had it actually save it to the server and redirect instead. I even pointed directly to one of these manually after generation and it failed there too.  The same file loaded in a browser works.  I can also download that file from the browser or via FTP and load it into Flash in authoring and it works, but loading it via loadMovie brings in the red rectangle.

I experimented with Flash's bitmap scaling a bit as another option but it seems to be almost as poor as its scaling of movie clips.  I need a smooth bicubic style scaling that looks clean and anti-aliased.
0
 
Aneesh ChopraCommented:
can I review the online version....
it would help to resolve it faster....

Rgds
Aneesh
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
MediaMacrosAuthor Commented:
Can I get an address to email off list?  I'd rather not post too much of my client's server or URL info here since its still under development.
0
 
Aneesh ChopraCommented:
you may send it to my email..

email is in profile..
0
 
Aneesh ChopraCommented:
I did a small test.....

downloaded png sample generated by your provided url...

and converted the same png using save as png command in Photoshop

next, loaded both sample using loadMovie in a FLA,

I found that, original file were shown as red rectangle (as you said)

but the converted file were shown properly...


this test, proves that your script actually is not generating the png file is required format to be loaded in flash....
here I have uploaded the test source here..

download link:
http://download.yousendit.com/D506A20127654365

Rgds
Aneesh
0
 
MediaMacrosAuthor Commented:
The odd thing is that some of them do work. IE the letter "B" works while "A" does not.
Also, manually loading the same PNG into Flash in authoring does work.  I think its some sort of bug in how it parses PNG files with load movie.  I'll keep searching for alternatives.  

Do you know of any way to get this better and smoother scaling via Flash's bitmap commands?  That was my first approach but it seems to not dither correctly so the edges of high contrast colors look very blocky.
0
 
Aneesh ChopraCommented:
You said:
 "manually loading the same PNG into Flash in authoring does work. I think its some sort of bug in how it parses PNG files with load movie"

My test shows the manual loading of the generated PNG also does not work, actual problem is the PNG format, you might have to check what actual PNG format flash support...
0
 
MediaMacrosAuthor Commented:
I found a bit of a work around but doing the scaling in the Flash file with bitmap objects.  I load the base PNG that did work, then make a new bitmap object, then put that back in where the clip was using attach bitmap with smoothing set to true.  Its not as nice as the PHP scaling for anti-aliasing but is enough to pass for this project.  
0
 
jack_p50Commented:
Are you using Flash 8? Only flash 8 can load gif/png dynamically (AFAIK). If yes, please send me your example, I'll try to check it out. My mail is in my profile.
0
 
MediaMacrosAuthor Commented:
Yes, its Flash 8.  As far as I can tell the simplified PNG files created by the script are just not read by flash via dynamic loading.  It apparently is looking for more info (maybe in the header, etc) than its getting.  Other apps read the files fine but not Flash.  I have a work around using hte bitmap scaling inside of flash but it took a little setup to get it to work. Still not ideal but workable for this project.
0
 
jack_p50Commented:
So you solved the question yourself. You can ask the mods to remove it, then (Community Support section).
Btw, how do you create these PNGs? What software do you use for it?
0
 
MediaMacrosAuthor Commented:
The initial PNG file was from Fireworks but the scaled version comes from the server.  It was converted via PGP using the GD imaging library.
0
 
jack_p50Commented:
So, GD produces bad PNGs, hmm.. linux version?
0
 
MediaMacrosAuthor Commented:
Not bad per se, just bad for FLash.  The bug may very well be FLash, but I can't find a workable fix.  

JPEGs from GD work fine
Some PNG files work fine, but its inconsistent.

Just as a note teh initial PNG was 33 K.  With no scaling if GD rebuilds it it comes out at around 10-11K, so its definately compressing it better.  No visible quality loss.
0
 
jack_p50Commented:
No quality loss should be there given that PNG is totally lossless ). I wonder how it does compress it better. AFAIK, GD uses zlib for compression.
0
 
MediaMacrosAuthor Commented:
Well, if you open the same 11K image in Fireworks and resave its back to 33K.  I think Fireworks and other apps use extra header info, or may use things like 0 in place of null characters for empty pixels.  Just a guess, but that might also explain why Flash does not like some images.  If the lat few bits were null it may see it as an invalid image or partial file.  For import in authoring it would not matter as it can see the entire file length.
0
 
jack_p50Commented:
Maybe. I don't know PNG internals, either
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now