Wednesday, June 13, 2012

[Action Script] beginBitmapFill() is not working for existing movieclip, help me June,2012

I want to fill the image to the movie clip using beginBitmapFill(), but I don't see the image. Actually, I have created a movie clip with box and I skewed it. I want to show the image inside the skewed box. And Image also should look skewed (needs to fill inside the box)

Here is my action script code :

Code: package{

import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.LoaderInfo;

public class AttachMovieClipExample extends Sprite{

public var rect:MovieClip;

public function AttachMovieClipExample()
{
    rect = new redRectangle();

    var bitmapData:BitmapData;

    var loader:Loader = new Loader();
    loader.load(new URLRequest("sam.jpg"));
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);


    function onComplete (event:Event):void
    {
        bitmapData = Bitmap(LoaderInfo(event.target).content).bitmapData;
        rect.graphics.clear();
        rect.graphics.beginBitmapFill(bitmapData,null,false,true);
      // rect.graphics.endFill();
        rect.x = 400;
        rect.y = 210;
        addChild(rect);
    }

}

}
}
beginBitmapFill() is not working for existing movieclip, help me

Related Post



0 comments: