You need to define a loadercontext. Create a loader context variable in you script section.
[Bindable]
private var loaderContext:LoaderContext;
NOTE: I'm not sure that it needs to be bindable but thats what my code has, so to be safe I am showing it.
Then, in some initialization code, initialize the variable
loaderContext = new LoaderContext(true);
Finally, when loading the graphic into an <mx:image> object, you must define a loaderContext and use the loader context that you just created, as below.
<mx:Image id="picture"
loaderContext="{loaderContext}"
verticalAlign="middle"
horizontalAlign="middle"
source="{picture_http}" width ="200" height="200">
</mx:Image>
Hope this helps.
Regards,
Hank
I literally just hit this problem now too. Did you ever receive a solution Hank? Anyone else?
-AndyOn 9/26/06, hank williams < [EMAIL PROTECTED]> wrote:I have a flex screen that I want to capture into a bitmap using the
technique that Andrew Trice described earlier this week.
it works as so:
<codeExample1>
private function getUIComponentBitmapData(target:UIComponent):BitmapData{
var bd : BitmapData = new BitmapData( target.width, target.height );
var m : Matrix = new Matrix();
bd.draw(target,m);
return bd;
}
</codeExample1>
I am feeding that function a UIComponent that contains an image that
looks like this:
<codeExample2>
<mx:Image id="picture"
verticalAlign="middle"
horizontalAlign="middle"
source="{model.picture_http}" width ="200" height="200"/>
</codeExample2>
The problem is that the model.picture_http is on another domain.
The error I get is as follows:
<error>
SecurityError: Error #2122: Security sandbox violation:
BitmapData.draw:
http://localhost:8080/elroyServer/songmail/songmail-debug.swf cannot
access http://storage.elroynetworks.com/092233720368547758070000000044.
A policy file is required, but the checkPolicyFile flag was not set
when this media was loaded.
</error>
This seems to suggest that I need a crossdomain.xml file, which is
fine. I have that, and I believe it is in the right place. The problem
is I am supposed to set a checkPolicyFile flag. The doc's explain how
to do this, but not in the context of Flex. The docs say:
<docs>
When you load the image using the load() method of the Loader class,
you can specify a context parameter, which is a LoaderContext object.
If you set the checkPolicyFile property of the LoaderContext object to
true, Flash Player checks for a cross-domain policy file on the server
from which the image is loaded. If there is a cross-domain policy
file, and the file permits the domain of the loading SWF file, the
file is allowed to access data in the Bitmap object; otherwise, access
is denied.
You can also specify a checkPolicyFile property in an image loaded via
an <img> tag in a text field. For details, see Loading SWF files and
images using the <img> tag in a text field.
</docs>
I dont know how one would use the "load() " command from MXML.
Moreover, I would really like an MXMLish way to deal with cross domain
issues.
Has anybody dealt with this?
Hank
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Software development tool | Software development | Software development services |
| Home design software | Software development company |
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___

