简体   繁体   English

Flash AS3:将软件包加载到软件包内部后无法查看已加载的swf

[英]Flash AS3: Unable to view loaded swf after loading it inside of package

Good morning friendly Flashers ;) So I've been trying since yesterday to just load a SWF file into my main movie. 早上好,友善Flashers;)从昨天开始,我一直在尝试将SWF文件加载到我的主电影中。 I've done this before just placing code inside a movieClip, but this time I'm working inside of Class files. 在将代码放入movieClip之前,我已经完成了此操作,但是这次我在Class文件中工作。 I have my main class which calls a function inside of my sub class which contains the loader. 我有一个主类,它在包含加载程序的子类中调用一个函数。 My problem is that the swf will load (I can tell via traces) but I cannot see the loaded swf :( 我的问题是瑞士法郎会加载(我可以通过跟踪知道),但看不到已加载的瑞士法郎:(

Below is the code inside of my sub class 下面是我的子类中的代码

package src.howdinicurtain {

import flash.net.*;
import flash.display.*;
import flash.events.Event;

public class HowdiniFrame extends MovieClip {   
    //public var splashLoader;
    public var introLoader:Loader = new Loader();
    public var introContainer:MovieClip;
    private var holdX:Number;
    private var holdY:Number;

    public function HowdiniFrame(url:String, loadX, loadY):void {
        holdX = loadX;
        holdY = loadY;

        this.addChild(introLoader);
        //this.addChild(introContainer);

        introLoader.load(new URLRequest(url));

        introLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,swfLoaded);
    }

    public function swfLoaded(e:Event):void {
        introLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
        introContainer = introLoader.content as MovieClip;
        //introContainer = MovieClip(introLoader.contentLoaderInfo.content);

        addChild(introContainer);

        introContainer.x = holdX;

        introContainer.y = holdY;

        trace("holdX = "+holdX);
        trace("holdY = "+holdY);

    } 

}

} }

The code above will load the swf file, I can see the swf files trace statements from the start of the animation to the end, but I cannot actually see the swf file inside of the main swf. 上面的代码将加载swf文件,我可以看到从动画开始到结尾的swf文件跟踪语句,但是实际上看不到主swf内部的swf文件。

Traces: 痕迹:

  • The SWF file is = intro.swf SWF文件为= intro.swf
  • Intro Movie Starts :) 电影介绍影片开始:)
  • contentLoaderInfo event removed contentLoaderInfo事​​件已删除
  • Intro Movie Ends :( 电影简介:

Here is the code in my main class that calls the sub class function that loads the movie: 这是我的主类中的代码,该代码调用加载电影的子类函数:

var introPath:String = xmlOutput.intro;
trace("The SWF file is = "+introPath+"\r"+"\r");
hc = new HowdiniFrame(introPath, 0, 20); 

I swear I throw my code into the first frame of a movieClip and it works fine, I see the animation in the loaded SWF play instantly, but when I have my code inside of Class files I cannot see my SWF at all :( thoughts? ideas? Thanks for any tips! 我发誓我将代码放入movieClip的第一帧中,并且效果很好,我看到加载的SWF中的动画会立即播放,但是当我将代码包含在Class文件中时,我根本看不到SWF :(想法?想法?谢谢您的提示!

~ Leon 〜莱昂

Always treat your children right. 始终正确对待您的孩子。 Don't forget to add them in everything you do or else you're a bad parent. 别忘了将它们添加到您所做的所有事情中,否则您就是个坏父母。

What is hc ? 什么是hc Is that a MovieClip on the stage? 那是舞台上的MovieClip吗? What if you try: 如果尝试:

hc.addChild(new HowdiniFrame(introPath, 0, 20));

or if hc is not a clip on the stage 或者如果hc不是舞台上的剪辑

hc = new HowdiniFrame(introPath, 0, 20);
addChild(hc);

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

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