186 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+4 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

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says

What is e.target referring too?

8359 posts Community Moderator
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Attended one of our Meetups around the world
+9 more
MSFX Moderator says

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

186 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+4 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
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+4 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
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+4 more
scottrockers says
What is e.target referring too?

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

393 posts
  • Has been part of the Envato Community for over 6 years
  • Sells items exclusively on Envato Market
  • Has sold $1,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+1 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
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+4 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
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+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
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+4 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

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by