views:

123

answers:

3

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.

+1  A: 

It's been a long time since I've written AS2, but... have you tried creating an empty MovieClip that sits in the lowest layer? You could then allow the selected frame image to be a child of that MC.

letseatfood
+2  A: 

There`s no built in way in Flash to set a background image, you have to implement the logic yourself.

So for example if you want the image to fill in the entire background, you might have to stretch or tile it manually, maybe even onResize.

dain
+3  A: 

Hi,

You could create a new Bitmap with the masked clip and then created a tiled background. This is the as2 version:

this.beginBitmapFill(tile);

And here it explains how to do it: http://www.kirupa.com/developer/flash8/tiledbackground_flash8.htm

The only difference is instead of loading a bitmap you can create it from the masked clip.

I hope it's clear enough, other ways let me know.

ozke