ActionScript: Applying a frame to an image / background?
I am editing a custom calendar app in flash. The purpose of this app is to let you choose your own images and create a calendar from it. You can basically drag and drop images of your choice and apply frame / borders or drag and drop decorations. Here is a piece of code that draws a border / frame onto a decoration / image of your choice.
tempListener.onLoadInit = function(target_mc:MovieClip)
{
var mcName = target_mc._name.substring(0, target_mc._name.indexOf("@", 0));
if(mcName == "frame_Image")
{
target_mc.onPress = function()
{
if(_root.selectedImage != null)
{
var index = this._name.substring(this._name.indexOf("@",0)+1, this._name.length);
var objPath = nodesFrames.childNodes[index-1].attributes.image;
if(_root.selectedImage._name.split("@")[0] == "image")
{
var mask = _root.selectedImage[_root.selectedImage._parent._name + "_" + _root.selectedImage._name + "_maskMc"];
frameImageWidth = mask._width;
frameImageHeight = mask._height;
frameImageXScale = -1;
frameImageYScale = -1;
}
else
{
frameImageXScale = _root.selectedImage._xscale;
frameImageYScale = _root.selectedImage._yscale;
_root.selectedImage._xscale = 100;
_root.selectedImage._yscale = 100;
frameImageWidth = _root.selectedImage._width;
frameImageHeight = _root.selectedImage._height;
}
if(_root.selectedImage["frame"])
{}
else
{
_root.selectedImage.createEmptyMovieClip("frame", _root.selectedImage.getNextHighestDepth());
}
var image_mcl1:MovieClipLoader = new MovieClipLoader();
image_mcl1.addListener(_root.mclFrameListener);
image_mcl1.loadClip("Images/" + objPath, _root.selectedImage["frame"]);
}
}
}
I need to somehow apply the selected frame image to the entire background - not just the decoration or the image. How can I do it?
Thanks in advance for your input. Please let me know if the question does not make sense, I will attach some images that may help you in context.
a source to share
You can create a new bitmap with a masked clip and then create a background tile. This is the as2 version:
this.beginBitmapFill(tile);
And here's how to do it: http://www.kirupa.com/developer/flash8/tiledbackground_flash8.htm
The only difference is that instead of loading a bitmap, you can create one from a masked clip.
I hope this is clear enough, other ways let me know.
a source to share