186 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
  • United States
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

2509 posts Put a Donk On It
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Attended a Community Meetup
  • Referred between 100 and 199 users
  • Contributed a Tutorial to a Tuts+ Site
+5 more
ThemeProvince says

What is e.target referring too?

8114 posts Community Moderator
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 6-7 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX Volunteer moderator says

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

186 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
  • United States
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
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
  • United States
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
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
  • United States
scottrockers says
What is e.target referring too?

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

393 posts
  • Bought between 100 and 499 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
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
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
  • United States
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
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 1 000 and 5 000 dollars
  • Taiwan
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
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
  • United States
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