0
votes

I need to load images within my Flash project I don't want to use the Loader class cause the images are from a different domain.

I load images with a TextField Here is my code:

var ti:TextField = new TextField();
ti.border=1
ti.htmlText += " <img id='movieInTxt' align='center' src='"+pic+"' />";
allMC[counter].img.addChild(ti);

I am loading the images to movieClip in a shape of a box. I want to position the image in the center. How can I make it ?

I tried ti.autoSize = TextFieldAutoSize.CENTER but it doesn't work...

Any suggestions how to load an image and position it in the center ?

1

1 Answers

0
votes

You can use <p align='center'><img /></p> I guess.

You can totally use a Loader on domain you don't own since you don't access any advanced properties on the image (like pixel-level manipulations). You can then access the size of the image, and center it in your container.

AS3 doc says :

You can load content from any accessible source.

If the loaded content is an image, its data cannot be accessed by a SWF file outside of the security sandbox, unless the domain of that SWF file was included in a cross-domain policy file at the origin domain of the image.

You can force flashplayer to not check crossdomain.xml file by passing false in the LoaderContext constructor :

myLoader.load(urlReq, new LoaderContext(false));