ActionScript : Applying frame to a image / background?
- by Jay
I am editing a custom calendar application in flash. The purpose of this app is to let you select your own images, and create a calendar out of it. You can basically, drag and drop images of your choice and they apply frame/borders, or drag and drop embellishments.
Here is the piece of code that draws a border/frame on the embellishment/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 chosen frame image, to the entire background - not just to the embellishment or image. How do I go about this?
Thanks in advance for your inputs. Please let me know if the question doesn't make sense, I will attach some images that can help you with the context.