和as2的原理一样,用bitmap,不过更简单
package
{
import flash.display.Sprite;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.display.*;
import fl.transitions.easing.*;
import fl.transitions.Tween ;
public class BitmapLoader extends Sprite
{
private var _loader:Loader = new Loader( );
var imgmc:MovieClip = new MovieClip();
public function BitmapLoader ( )
{
addChild (imgmc);
var loadcont:LoaderContext = new LoaderContext();
_loader.contentLoaderInfo.addEventListener (Event.COMPLETE , onComplete);
_loader.load (new URLRequest("c_m.jpg"));
}
public function onComplete (event:Event):void
{
var loadedImage:Bitmap = Bitmap(_loader.content);
var bitmap:BitmapData = new BitmapData(loadedImage.width , loadedImage.height);
bitmap.draw (loadedImage);
var image:Bitmap = new Bitmap(bitmap,"auto",true);
imgmc.addChild (image);
new Tween(imgmc,"scaleX",None.easeIn,1,1.5,2,true);
new Tween(imgmc,"scaleY",None.easeIn,1,1.5,2,true);
}
}
}
package
{
import flash.display.Sprite;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.display.*;
import fl.transitions.easing.*;
import fl.transitions.Tween ;
public class BitmapLoader extends Sprite
{
private var _loader:Loader = new Loader( );
var imgmc:MovieClip = new MovieClip();
public function BitmapLoader ( )
{
addChild (imgmc);
var loadcont:LoaderContext = new LoaderContext();
_loader.contentLoaderInfo.addEventListener (Event.COMPLETE , onComplete);
_loader.load (new URLRequest("c_m.jpg"));
}
public function onComplete (event:Event):void
{
var loadedImage:Bitmap = Bitmap(_loader.content);
var bitmap:BitmapData = new BitmapData(loadedImage.width , loadedImage.height);
bitmap.draw (loadedImage);
var image:Bitmap = new Bitmap(bitmap,"auto",true);
imgmc.addChild (image);
new Tween(imgmc,"scaleX",None.easeIn,1,1.5,2,true);
new Tween(imgmc,"scaleY",None.easeIn,1,1.5,2,true);
}
}
}