简体   繁体   English

AS2 SWF是独立运行的,但是当包含在AS3 SWF中(即使仅加载时),它的行为也很奇怪,有什么想法吗?

[英]AS2 SWF works standalone, but when included into AS3 SWF (even when ONLY it is loaded) it acts strangely, any ideas?

I am aware that there are a few posts on loading AS2 SWF's into AS3 SWF's but none provide a solution! 我知道有几篇关于将AS2 SWF加载到AS3 SWF中的文章,但没有提供解决方案! I have a standalone image gallery - using an XML file - that I have loaded into an AS3 SWF. 我有一个独立的图片库-使用XML文件-已加载到AS3 SWF中。

The gallery functions fine on it's own, but when loaded into an AS3 SWF, it does not change the main image! 画廊本身就可以正常运行,但是当加载到AS3 SWF中时,它不会更改主图像! I created a new AS3 SWF, and had ONLY the code to load this AS2 gallery into the AS3 movie, nothing else, and still it refused to change the large image when the thumbnails were clicked. 我创建了一个新的AS3 SWF,并且只有将该AS2图库加载到AS3电影中的代码,仅此而已,当单击缩略图时,它仍然拒绝更改大图像。 The gallery pretty much run's perfectly fine, it is ONLY the large image that is not working. 画廊的运行非常完美,只有较大的图像无法正常工作。 Can anyone help on this one? 有人可以帮忙吗? Here is my AS2 main gallery code, can someone spot something that could be causing the error? 这是我的AS2主库代码,有人可以发现可能导致错误的内容吗?

import mx.transitions.Tween;
import mx.transitions.easing.*;

var my_xml = new XML();
my_xml.ignoreWhite = true;

my_xml.onLoad = function(success){
    if(success){
        doGallery();
        }
    else{
        null;
        }
    }

my_xml.load("xml/gallery.xml");

function doGallery(){

    var imgTitles:Array = my_xml.firstChild.childNodes[0].attributes.imgtitles.split("|");
    var numImgs:Number = my_xml.firstChild.childNodes[0].attributes.num;
    var thumbprefix = my_xml.firstChild.childNodes[0].attributes.thumbprefix;
    var largeprefix = my_xml.firstChild.childNodes[0].attributes.largeprefix;
    var ext = "."+my_xml.firstChild.childNodes[0].attributes.ext;
    var imgSets:Number = Math.ceil(numImgs/10);//max possible number of image sets
    var desc:Array = my_xml.firstChild.childNodes[0].attributes.descriptions.split("|")

    _parent.mySets = imgSets;
        if(imgSets == 1){
        _parent.btnNxt._visible = false;
        }

    _parent.imgNum = "1/"+numImgs;
    _parent.imgHolder.imgAttach.loadMovie("gallery/"+largeprefix+"01"+ext);

    for(var i:Number=0;i<numImgs;i++){

        attachMovie("thumbframe", "thumb"+i, this.getNextHighestDepth(), {_x:(i * 20), _y:51});
        var clip = eval("thumb"+i);

        if(i == 0){clip._x = 39;}
        else{clip._x = 90 * (i)+39;}

        clip._y = 51;


        _parent.txtsimon = imgTitles[0];
        _parent.imgDescr = desc[0];

        eval("thumb"+i).id = i+1;

        if(imgTitles[i] == "" or imgTitles[i] == undefined){
            clip.title = "Untitled Image";
        }
        else{
            clip.title = imgTitles[i];
        }


        eval("thumb"+i).thumbhold.loadMovie("gallery/"+thumbprefix+"0"+eval("thumb"+i).id+ext);

        eval("thumb"+(i)).onRelease = function(){   

            _parent.imgNum = this.id+"/"+numImgs;
            var thumbid:Number = this.id;
            var imgOut:Tween = new Tween(_parent.imgHolder, "_alpha", Regular.easeOut, _parent.imgHolder._alpha, 0, 0.4, true)

            imgOut.onMotionFinished = function(){
                _root.container.imgHolder.imgAttach.unloadMovie();
                _root.container.imgHolder.imgAttach.loadMovie("gallery/"+largeprefix+"0"+thumbid+ext);
                trace("gallery/"+largeprefix+"0"+thumbid+ext);
                new Tween(_root.container.imgHolder, "_alpha", Regular.easeIn, 0, 100, 0.5, true);
            }
            mytitle = this.title;
            _parent.txtsimon = mytitle;
            _parent.imgDescr = this.descr;

            _parent.btnDownloadImg.onRelease = function(){
                getURL("gallery/"+largeprefix+"0"+thumbid+ext);
                }

            new Tween(activeThumb, "_x", Strong.easeOut, activeThumb._x, this._x, 1.5, true);
            }

        clip.onRollOver = function(){
            new Tween(this, "_alpha", Strong.easeOut, this._alpha, 75, 1, true);
            }

        clip.onRollOut = function(){
            new Tween(this, "_alpha", Strong.easeOut, this._alpha, 100, 1, true);
            }
        }

        _parent.btnSlideShow.onRelease = function(){
        new Tween(this._parent.slideOverlay, "_alpha", Strong.easeOut, 0, 100, 3, true);        
        }
}

        _parent.btn_requestHighRes.onRelease = function(){
            var rtitle:String = _parent.txtsimon.toString();
            getURL("mailto:HIDDEN_EMAIL?subject=Toolkit High Res Request - "+rtitle);
            }

I have run a trace on the source of the large image, and it is calling the correct image. 我已经在大图像的源上运行了跟踪,它正在调用正确的图像。 I unload the current image and load in the new image, but STILL the old one loads in, like it's cached or something?? 我卸载当前图像并加载到新图像中,但仍旧加载旧图像,就像它已缓存一样? The issue seems to be near this code: 问题似乎与以下代码接近:

_root.container.imgHolder.imgAttach.unloadMovie();
_root.container.imgHolder.imgAttach.loadMovie("gallery/"+largeprefix+"0"+thumbid+ext);
trace("gallery/"+largeprefix+"0"+thumbid+ext);

The above trace shows me that the correct image is being called, but it simply will not load in! 上面的痕迹告诉我,正在调用正确的图像,但是根本不会加载!

I appreciate all comments greatly as I have sat on this one for ages! 我已经坐了很久了,我非常感谢所有评论!

Simon 西蒙

Loading a AVM1 inside a AVM2 (SWF with Actionscript 1.0/2.0 into SWF Actionscript 3.0) has some restrictions , but I don't think that you are dealing with one of them... 将AVM1加载到AVM2内(将带有ActionScript 1.0 / 2.0的SWF加载到SWF ActionScript 3.0中) 有一些限制 ,但我认为您没有处理其中的一个...

Anyway, checkout this link . 无论如何,请检查此链接

Hopes that will help. 希望会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM