flex ½Øͼ
ÔÚflexÖÐÒ²¾³£»áÓõ½½Øͼ¹¦ÄÜ£¬²¢ÇÒ½«½ØͼµÄͼƬ±£´æÖÁ±¾µØ¡£Ò»Ï뵽ͼƬÄÇôÎÒÃǾÍ×ÔÈ»Ïëµ½ËûµÄ´æÔÚÐÎʽ bitmap byteArray.ËùÒÔ×ÔÈ»¾Í»áÁªÏµµ½bitmapÀàÉÏÈ¥¡£
ÏÂÃæÈÃÎÒÃÇÒ»ÆðÀ´¿´¿´¶¼ÓÐÄÄЩ·½·¨°É¡£
·½·¨Ò»£º°´ÎÒÃÇ×ÔÈ»µÄ˼·ʵÏÖ£º
ÔÚapplicationÖÐÓÐÁ½¸öÈÝÆ÷£º
<mx:Canvas id="virtour_cav" top="0" bottom="0" left="0" right="0">
</mx:Canvas>
<mx:Canvas right="0" top="0" width="200" height="200">
<mx:Image id="cpImg" left="0" right="0" bottom="0" top="0"/>
</mx:Canvas>
µ±ÎÒÃǵã»÷½ØͼʱִÐÐ
private function CaptureImage():void{
var bd:BitmapData=getBitmapData(UIComponent(virtour_cav));
cpImg.source= new Bitmap(bd);
}
private function getBitmapData(target:UIComponent):BitmapData{
var bd:BitmapData= new BitmapData(target.width,target.height);
var m:Matrix=new Matrix();
bd.draw(target,m);
return bd;
}
×îºóʹÓÃFileReference.save()·½·¨±£´æ¾Í¿ÉÒÔ¡£
fileReference.save(new Bitmap(bd),"δÃüÃû.jpg");
·½·¨¶þ£ºÖ±½ÓʹÓÃͼƬ½ØͼÀàImageSnapshotʵÏÖ
Õâ¸ö¾Í¸ü¼òµ¥ÁË¡£
private var jpgeEnc:JPEGEncoder=new JPEGEncoder();
private var fileReference:FileReference=new FileReference();
private function CaptureImage():void{
var imgSnapshot:ImageSnapshot=ImageSnapshot.captureImage(virtour_cav,0,jpgeEnc);
fileReference.save(imgSnapshot.data,"δÃüÃû.jpg");
}
µ«ÊÇÕâÁ½¸ö·½·¨ÊµÏÖµÄÇ°ÌáÊÇflash ²¥·ÅÆ÷ÒªÇóÊÇ10ÒÔÉÏ
Èç¹ûÎÒÃÇÒªÓÃһЩ flash player 10 ÉϲÅÌṩµÄ¹¦ÄÜʱ£¬ÐèÒªÔÚÏîÄ¿ÊôÐÔÀïÉèÖÃһϣ¬·ñÔò»áÕÒ²»µ½´Ë·½·¨£¬±
Ïà¹ØÎĵµ£º
flex¿Ø¼þ¶ÔÏó¡¢RemoteObjectµÈ¶¼ÓÐÒ»¸ö¹²Í¬µÄ·½·¨addEventListener¡£
addEventListener·½·¨ÈçÏ£º
public function addEventListener(type:String, listener:Function,
useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
{
eventDispatcher.addEventListener(type, listener, us ......
ÔÚ×Ö·û´®×ª»»ÎªintÀàÐͱØÐëʹÓà ×îºÃÈçÏ£º
var a:int=int(str);
ÉÏÃæת»»Èç¹û²ÉÓÃÈçÏÂÇ¿ÖÆת»»Ôò
var a:int =str as int;
µÃµ½Êý¾ÝΪ0 Ϊ´íÎóÊý¾Ý¡£
ÔÚÏîÄ¿ÖÐÁ½¸öintÏà¼Ó½á¹û³¬¹ýÒ»¸öintµÄ·¶Î§Ê±³öÏÖ´íÎó£¡
¾¹ý×Ô¼ºbug²éÕÒµ½´íÎóÔÒòÊÇÒòΪintÊý¾ÝÀàÐÍ·¶Î§Ì«Ð¡°Â£¡Ö»ºÃ¸ÄΪNumberÀàÐÍ¡£½á¹û²ÅÕýÈ·£¡ÔÎËÀ£¡
Ô ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="InitApp()">
<mx:Script>
<![CDATA[
......
1-Ê×ÏÈдһ¸ö¼ÓÔØÍⲿswfÎļþµÄÀà
package Package
{
import flash.display.DisplayObject;
import flash.display.Loader;
import flash.events.*;
import flash.net.URLRequest;
import mx.core.UIComponent;
import mx.events.FlexEvent;
public class CtmOb ......