1

是否可以将 facebook 数据(例如 user_pic)转换为DisplayObject,以便更容易操作?我想要做的是,当用户在我的网站上执行FacebookConnect时,让他们有可能在将图像提交到画廊之前缩放他们的图像(如转换工具的使用)。

4

1 回答 1

0

更新:事实证明 OP 已经在UILoader. 在这种情况下,您可以使用以下content属性访问它UILoader

var img:Bitmap = Bitmap(uiLoader.content);
var bitmapdata:BitmapData = img.bitmapData;

您可以使用Loader对象将用户图片加载到您的 SWF并对其进行操作,前提是该图像托管在允许您域中的 SWF 使用适当crossdomain.xml的 .

如果您知道策略文件的位置,请在加载图像之前调用Security.loadPoliCyFile 。Flash 播放器将尝试从默认位置加载它/crossdomain.xml

Security.loadPolicyFile(policy-file-url);

var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);
ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
ldr.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
ldr.load(new URLRequest(the-image-url);

function onError(e:Event):void
{
  trace(e);
}
function onLoad(e:Event):void
{
  //this will fail if there is no crossdomain.xml file at
  //the image's originating server.
  var image:Bitmap = LoaderInfo(e.target).content as Bitmap;
  var bitmapData:BitmapData = image.bitmapData;
  //do whatever you want with the bitmap data here
  addChild(image);
}
于 2010-03-05T14:09:14.480 回答