Question

Flash not loading some PNG files via Actionscript

Asked by: MediaMacros

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?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-05-12 at 09:29:47ID21848493
Tags

png

,

flash

,

actionscript

,

loading

,

files

Topic

Adobe Flash

Participating Experts
2
Points
500
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Fireworks PNG printing
    I want to create a simple brochure using Fireworks. I've made a nice png file, but I can't find a way of printing it. I'm using Fireworks to edit the png for the brochure. It seems to recognize text regions and provides really sharp graphics, which makes it appear as if it...
  2. Unable to set Fireworks as opener for PNGs
    Strange...default opener for .PNGs _had been Firework 8. Something's happened where the system now refuses to recognize Fireworks as an option. I've stepped into Folder Options and attempted to set things up there. When I browse to 'Firework.exe' and click ok i just get drop...
  3. Transparent png's - Loss of Quality
    Using Fireworks 8. I want to use transparent png files with gradient but I am losing a lot of quality. You can see the breaks in the color changes. Is there a way to get around this? Thanks in advance, Dave
  4. Load PNG into Flash Library for ActionScript
    Is there a way to load an external PNG file into the Flash library at runtime and then add an identifier to it dynamically so that I could attach the image to various movie clips? I don't want to loadMovie('file.png',mc) over and over again. I'd like to just load the PNG fi...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: aneeshchopraPosted on 2006-05-12 at 20:35:19ID: 16672460

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

 

by: MediaMacrosPosted on 2006-05-14 at 09:26:51ID: 16677920

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.

 

by: aneeshchopraPosted on 2006-05-14 at 10:12:49ID: 16678061

can I review the online version....
it would help to resolve it faster....

Rgds
Aneesh

 

by: MediaMacrosPosted on 2006-05-15 at 05:12:41ID: 16681639

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.

 

by: aneeshchopraPosted on 2006-05-15 at 05:42:52ID: 16681822

you may send it to my email..

email is in profile..

 

by: aneeshchopraPosted on 2006-05-15 at 09:41:51ID: 16683800

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

 

by: MediaMacrosPosted on 2006-05-15 at 11:39:46ID: 16684686

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.

 

by: aneeshchopraPosted on 2006-05-15 at 19:36:25ID: 16687261

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...

 

by: MediaMacrosPosted on 2006-05-16 at 05:09:27ID: 16689780

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.  

 

by: jack_p50Posted on 2006-05-16 at 23:48:32ID: 16696854

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.

 

by: MediaMacrosPosted on 2006-05-17 at 04:54:09ID: 16698142

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.

 

by: jack_p50Posted on 2006-05-17 at 04:57:18ID: 16698159

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?

 

by: MediaMacrosPosted on 2006-05-17 at 05:02:22ID: 16698196

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.

 

by: jack_p50Posted on 2006-05-17 at 05:07:52ID: 16698224

So, GD produces bad PNGs, hmm.. linux version?

 

by: MediaMacrosPosted on 2006-05-17 at 05:12:24ID: 16698248

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.

 

by: jack_p50Posted on 2006-05-17 at 05:18:42ID: 16698299

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.

 

by: MediaMacrosPosted on 2006-05-17 at 05:22:55ID: 16698330

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.

 

by: jack_p50Posted on 2006-05-17 at 05:35:15ID: 16698407

Maybe. I don't know PNG internals, either

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...