PDA

View Full Version : Picture loader auto-scale problem


Big-O
11-21-2007, 09:03 PM
I am having some difficulty with the mx.controls.Loader component and it's auto-scale parameter.

I have a swf that loads a picture that was just uploaded on the previous page. I use FlashVars to pass the location and filename to the mx.controls.Loader. The loader is set to auto-scale content.

This works perfectly 99% of the time but I have run into a problem when trying to upload and preview a picture from a slower DSL connection. It is not scaling the picture at all so I can see is the corner of this image.

Here are two pictures for an idea what I'm talking about...

How it should be:
http://img215.imageshack.us/img215/2056/howitshouldbevl1.jpg


How it is with slow connection:
http://img215.imageshack.us/img215/8668/howitisdy5.jpg

Any ideas on what could be causing this? Or how to fix it?

Thanks

Big-O
11-23-2007, 08:12 PM
Cool. Thanks for the insight guys. /sarcasm

dr_zeus
11-26-2007, 07:17 PM
You posted your question at the beginning of a long U.S. holiday weekend. I, and I suspect many others, haven't been here since last Wednesday.

Do you mean mx.controls.SWFLoader?

palnudb
11-27-2007, 05:00 AM
I am a bit of a frankenprogrammer so I may be wrong. I had something like this a few years back.

Your image isn't loaded in all the way before the scaling command is called. in Flash as I understand it if your item hasn't completed loading it cannot have other commands applied to it. That is why it works on your faster connections its done loading by the time it gets the scaling command, and on the slower connections it doesn't scale because the file isn't all the way downloaded before it triggers the command to scale. You need to check to see if the file is complete.

Unfortunately I can't help you with how to do that but I think this will tell you where to start.

Good Luck

Hope this helps

palnudb

Sannu
12-06-2007, 04:43 PM
Do you mind sharing your scaling code?

ilProphet
12-07-2007, 02:30 AM
this isnt the right syntax but if you add something before displaying the picture like if(total == total bytes loaded){ then display the image } that might help

Big-O
12-20-2007, 05:46 PM
Thanks for the tips guys, and I apologize for the sarcastic comments (I didn't realize it was a holiday weekend.)

/inserts foot into mouth.

I ended up forgoing the flash loader on that page and used ASP to load and scale the picture (it works now).

Although I have the same problem on another page (using the same flash image loader) that I cannot do with ASP because the image will be manipulated in Flash.

palnudb is exactly right about my problem I think, only I cannot get the auto-scale to wait for the loading to finish. I think it's because I am using a pre-built flash component and there is no control over when the auto-scaling happens (it's just a parameter you set to 'true' on the component.)

I can't share my scaling code because I have none, mx.Controls.Loader is doing all the work for me. Which is probably the source of my problem.

At this stage I will probably just create my own custom coded "pic loader" so I can have better control of the scaling. I had hoped it wouldn't come to this.

Big-O
01-07-2008, 11:11 PM
I figured out the source of the problem. If the image you are loading with mx.Controls.Loader is above 2880 pixels in either dimension it will not auto-scale properly. Anything below 2880 pixels will auto-scale fine.

2880px is the height/width limit for swf stage size.

If you have the same problem as me check to see if your pic is over this size, if it is bring it down and try again and it should work.

Thanks guys.