Today I tried to load an image form an url and apply it to a background, well appears like setStyle don’t have the ability to load an image from URL.

So I had to look another alternative, I load the image using an Loader, but I couldn’t found a way to apply it to the background  style, I did a workaround, I draw it on the graphics object, I guess it is helpful because the image is titled, but I will try more options I didn’t quite like 100% this solution.

IMPORTANT : dont’ forget the security restrictions of doing this, remember that flash can’t load images from another domain, and www.zerokernel.com is different to zerokenel.com, see Adobe for more information ( Player 9 restrictions from Adobe – PDF )

Anyway, here is the demo:

http://zerokernel.com/demos/flex/backgroundChanger/

And the code:

http://zerokernel.com/demos/flex/backgroundChanger/BackgroundChanger.zip

Share and Enjoy:
  • Print this article!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter
Vote in HexoSearch Vote for this post @HexoSearch

Related posts: (auto-generated)

  1. Youtube and Flex 3 A time ago google released an SWF/API to interact with...
  2. Skinning flex components sometimes when you are customizing the UI of a flex...
  3. Flex Myths I found a very nice article about misconceptions of flex,...
  4. Flex 3 / SVN plugin (subclipse) / change credentials / OS X For a complex reason I couldn’t understand the SVN plugin...
  5. A non-cientific Flash vs Silverlight Size Comparision I found a very simple comparision between Flex and silverlight,...

Related posts brought to you by Yet Another Related Posts Plugin.