/ Published in: ActionScript
Expand |
Embed | Plain Text
/** * Makes a bitmap copy of an image clip and * rewrites it with the same name, depth, position. * * @param target The movie clip to replace. * @param transparent Specifies whether the bitmap image supports per-pixel transparency. * @param fillColor A 32-bit ARGB color value that you use to fill the bitmap image area. */ function replaceByBitmap(target:MovieClip, transparent:Boolean, fillColor:Number):Void { import flash.display.BitmapData; var ox:Number = target._x; var oy:Number = target._y; if(transparent && fillColor){ var bm:BitmapData = new BitmapData(target._width, target._height, true, 0x00FFFFFF); }else{ var bm:BitmapData = new BitmapData(target._width, target._height); } bm.draw(target); var copy_mc:MovieClip = target._parent.createEmptyMovieClip(target._name, target.getDepth()); copy_mc.attachBitmap(bm, 0, "never", true); copy_mc._x = ox; copy_mc._y = oy; }
You need to login to post a comment.
