186 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 4
  • Collector Level 1
+5 more
scottrockers
says

Hey all,

I have a function that finds the URL of an image, and after doing so, I try to resize it to 50×50. Now when I test this locally in the Flash IDE it always resizes the image, and works everytime, but when I test it on a website, the image won’t resize at all.

Does anybody know if you have to cache the image before i can resize it, and any other suggestions that would help me out or point me in the right direction would be great.

Inside a loaded function I basically just resize it by doing this:

e.target.content.width = 50; e.target.content.height = 50;

Thanks, Scott

2627 posts Put a Donk On It
  • Weekly Top Seller
  • Elite Author
  • Exclusive Author
  • Featured Author
+11 more
ThemeProvince
says

What is e.target referring too?

8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says

why not just use loader.width = 50 and loader.height = 50 ?

186 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 4
  • Collector Level 1
+5 more
scottrockers
says

Yes the image is on a different domain, and I know about the security sandbox violation problem, but I know a way to get around that. The only problem is resizing the images that it uses.

186 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 4
  • Collector Level 1
+5 more
scottrockers
says
why not just use loader.width = 50 and loader.height = 50 ?

I have tried that and I didn’t work either. Good suggestion though.

186 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 4
  • Collector Level 1
+5 more
scottrockers
says
What is e.target referring too?

It refers to the image loader, when I traced it.

393 posts
  • Turkey
  • 7 Years of Membership
  • Exclusive Author
  • Author Level 3
+2 more
phantasmagoria
says

I run across same problem before.

It seems it is a restriction from flash player itself only occurs If the domain name of the image is different than the URL of the application.

As i remember, i was trying to get the image from different URL and using bitmap class, drawing it to an mc and resizing it. Couldn’t manage directly so i write a php script to copy the image to my server first, then get the images path… But this was a brute-force solution and not so flexible.

EDIT : And crossdomain.xml does not help about this problem.

186 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 4
  • Collector Level 1
+5 more
scottrockers
says

Hey phantasmagoria,

Thanks for the reply, I do think that’s the exact problem I am having, and I also tried to assign it to a bitmap object and drawing it to a mc, but I couldn’t get it to work either. If there is a solution to this I would love to know.

Would adding it to a display object container or just the display object help?

Thanks

111 posts
  • 5 Years of Membership
  • Author Level 3
  • Collector Level 1
  • Exclusive Author
+2 more
savorks
says

what is the contenrLoaderInfo.content’s height / width you trace in the complete listener ? If that is zero maybe add a enterframe listener try monitor it after.

And think the crossdomain restriction only effect on the bitmapData, but you can still change the content’s size.

186 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 4
  • Collector Level 1
+5 more
scottrockers
says

When I trace imageLoader.contentLoaderInfo.width and height in the complete function, its still the original height and width of the image, not 50×50. I do the resizing of the image in the init listener, is that correct?

And think the crossdomain restriction only effect on the bitmapData, but you can still change the content’s size.

How would you change the contents size?

Scott

by
by
by
by
by
by