0
votes

I have two SWF files. First o is intro.swf and the second one is menu.swf.

intro.swf only contains an external video that will play automatically. The video ends in 45 seconds. I want menu.swf loaded automatically after the video in intro.swf ends.

The only code I know and work is in this page: Flash as3: Load external swf to main stage from button inside a movie clip. But it only work for a button.

I don't want user to click button to go to another SWF file. I want it to be loaded automatically.

Here is the folder link of the SWF files: https://www.mediafire.com/folder/l4wd4hbwyame9/demo

Can someone help me? I'm new to ActionScript. Please go easy on me.

1
Are you in control of the intro.swf? eg. do you have the source files and can modify it? - BadFeelingAboutThis
There isn't an easy "Do this" generic kind of answer. Everything depends on how the intro.swf is build and the security context it's loaded with into your main app. Post the swf if you can, or the source code for it. - BadFeelingAboutThis
Yes. I have the source files and can modify it. There is no code inside I add the intro.swf. I actually add video with help from this page : helpx.adobe.com/flash/using/add-video-flash.html - Aina Aiikyo
@BadFeelingAboutThis I already provide the SWF in the post. There is no code inside the SWF files though. - Aina Aiikyo
You can use dispatchEvent. It triggers a listener and then you can automate whatever you want. - coner

1 Answers

0
votes

I change my method to add the video. Now, the is added by code. This is the code that works for me with help from fellow commentators.

import fl.video.*;
var player:FLVPlayback = new FLVPlayback();
addChild(player);

player.source = "video.mp4";
player.addEventListener( Event.COMPLETE, onLoaderComplete );
player.setSize(1280, 720);



function onLoaderComplete( e:Event ):void {
    trace( "first swf loaded" );
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
    loader.load(new URLRequest("menu.swf"));

}


function onComplete(e:Event):void {
    var movie:* = LoaderInfo(e.currentTarget).content;
    //Adding content to the stage
    stage.addChild(movie);
}