One possibility would be to subclass flash.display.Loader and supply that as 
the backgroundImage "class" then have it load the image with a custom URL

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of rdibona
Sent: Friday, March 13, 2009 3:44 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: canvas backgroundimage loadercontext


Thanks for the reply.

Assuming that I am willing to take the risk of the server going down (the 
images are stored on Amazon S3 so they are pretty safe), how can I have a 
backgroundimage check the policy file, using LoaderContext or otherwise?

This is an app that has been working great for over 2 years and only with one 
of the latest releases of flash did this break so I am scrambling to try and 
fix it. The reason I can't really do it as an image with a child index of 0 is 
because the user can click things and drag them around and I don't want them to 
accidentally drag the background image -- I'd have to write a bunch of code to 
work through that scenario so I'd like to exhaust all other options first.

Thanks again,

Rich

--- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, Alex 
Harui <aha...@...> wrote:
>
> I'd avoid loading foreign content as the backgroundImage. If that server goes 
> down, your app will look very different.
> If you really want to, then it might be easier to put an Image behind all of 
> the other children and not use backgroundImage
>
> Alex Harui
> Flex SDK Developer
> Adobe Systems Inc.<http://www.adobe.com/>
> Blog: http://blogs.adobe.com/aharui
>
> From: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com> 
> [mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>] On 
> Behalf Of rdibona
> Sent: Friday, March 13, 2009 11:15 AM
> To: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] canvas backgroundimage loadercontext
>
>
> Hi there,
>
> I have an application where I take a "snapshot" of a Canvas with various 
> other images on it using the bitmapdata.draw method. I had to change my code 
> to use a LoaderContext for each image load to avoid security errors, i.e.:
>
> var lc : LoaderContext;
> var img : Image;
>
> img = new Image();
> lc = new LoaderContext(true);
> img.loaderContext = lc;
> img.load(src);
>
> This has worked fine. However, I cannot figure out how to avoid a security 
> error when setting the backgroundImage style for a canvas, as it expects a 
> URL directly with no opportunity to specify another image as the value. It 
> does say you can specify a class, but how do you cast an image into a 
> compatible class? The images I am dealing with are dynamically loaded at 
> run-time so there is no opportunity to use the Embed directive.
>
> Thanks,
>
> Rich
>

Reply via email to