Flash 动作脚本:将帧应用于图像/背景?

Flash 动作脚本:将帧应用于图像/背景?,flash,actionscript-2,flash-cs4,background-image,Flash,Actionscript 2,Flash Cs4,Background Image,我正在用flash编辑自定义日历应用程序。此应用程序的目的是让您选择自己的图像,并从中创建日历。基本上,您可以拖放您选择的图像,并应用框架/边框,或拖放装饰。 下面是在您选择的装饰/图像上绘制边框/框架的代码 tempListener.onLoadInit = function(target_mc:MovieClip) { var mcName = target_mc._name.substring(0, target_mc._name.indexOf("@", 0)); if(

我正在用flash编辑自定义日历应用程序。此应用程序的目的是让您选择自己的图像,并从中创建日历。基本上,您可以拖放您选择的图像,并应用框架/边框,或拖放装饰。 下面是在您选择的装饰/图像上绘制边框/框架的代码

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"]);
            }
        }
    }
我需要以某种方式将选定的帧图像应用于整个背景,而不仅仅是装饰或图像。我该怎么办


提前感谢您的投入。如果这个问题没有意义,请让我知道,我会附上一些图片来帮助您理解上下文。

我已经很久没有写AS2了,但是。。。您是否尝试过创建一个位于最底层的空MovieClip?然后,您可以允许所选帧图像成为该MC的子图像。

Flash中没有内置的方式来设置背景图像,您必须自己实现该逻辑


因此,例如,如果您希望图像填充整个背景,您可能需要手动拉伸或平铺它,甚至可能需要调整大小。

您可以使用遮罩剪辑创建一个新位图,然后创建平铺背景。这是as2版本:

this.beginBitmapFill(tile);
在这里,它解释了如何做到这一点:

唯一的区别是,您可以从蒙版剪辑创建位图,而不是加载位图


我希望它足够清楚,其他方式让我知道。

不确定为什么要将Actionscript 3作为标记,您的代码是AS2。。。。但图像将有助于说明您正在尝试做什么。谢谢对不起,标签弄错了。这只是一次不顾一切地试图获得更多的观点。在过去的两天里,我只收到了8个关于这个的意见。所以,我编辑了标签,希望得到回应。我很高兴它引起了你的注意:)