Skip to main content
October 8, 2013
Answered

How to add 1 swf file to another swf file which both are images sequences?

  • October 8, 2013
  • 1 reply
  • 2014 views

Hi All,

I have two swfs, when clicking the first swf goes to second file and clicking on a button in second file goes back to first file.

The first swf file is the images sequence in which only certain keyframes have the transparent button when clicked  goes to second file.

So far I am able to do that.


But when clicking on keyframes, how can I disable the background swf?(i.e., when when loading second swf, it loads on top of first one right? what can be done to disable the first swf?)

As I tried giving visible to false.

But to no help.


Any help in this would be greatly appreciated and very helpful.


Many thanks in advance.

This topic has been closed for replies.
Correct answer moccamaximum

1. Always add an EVENT.COMPLETE.listener when you load sth.

//this variable will later be used to trigger behavior of your loadedSWf

var mc:MovieClip;

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);

function loaded(e:Event):void{

    trace("LOADED");

    addChild(myLoader);

    mc= MovieClip(myLoader.content);

   //you can now use the alias mc anywhere in your main swf to make the whole loadedSwf invisible or trigger a function in the swf

  // for example: mc.hideMe() would trigger a function hideMe inside your loadedSWF

}

myLoader.load(new URLRequest("Interactive_Walkthrough.swf"));

1 reply

Inspiring
October 8, 2013

More details how you load the swfs are needed. Are both swfs loaded by a main swf? Do you use preloaders ? If yes: you should be able to make an alias for your loaded swf and be able to access all of its public properties/function from your main swf.

For detais, look here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/LoaderInfo.html

Its crucial that you only try this after

Event.COMPLETE

has fired.

October 8, 2013

Hi

I have the first swf as the main file.

To load the second swf file, the user has to click a particular button which is inside a movieclip that too in a certain keyframe.

The cose to load the second swf.

import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.MouseEvent;

var myLoader:Loader = new Loader();

int1_btn.addEventListener(MouseEvent.CLICK, interior);

function interior(event:MouseEvent):void
{
var myRequest:URLRequest = new URLRequest ("Interactive_Walkthrough.swf");
myLoader.load(myRequest);
addChild(myLoader);
myLoader.x = 0;
myLoader.y = -190;

Object(root).cladding_panel_btn.visible = false;
Object(root).contrastbrick_panel_btn.visible = false;
Object(root).facebrick_panel_btn.visible = false;
Object(root).garage_panel_btn.visible = false;
Object(root).gutter_panel_btn.visible = false;
Object(root).rendercolor2_panel_btn.visible = false;
Object(root).rendercolor_panel_btn.visible = false;
Object(root).windowcolor_panel_btn.visible = false;
Object(root).roof_panel_btn.visible = false;
Object(root).trim_panel_btn.visible = false;
Object(root).reset_btn.visible = false;
Object(root).save_btn.visible = false;
}

Any Help.

moccamaximumCorrect answer
Inspiring
October 8, 2013

1. Always add an EVENT.COMPLETE.listener when you load sth.

//this variable will later be used to trigger behavior of your loadedSWf

var mc:MovieClip;

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);

function loaded(e:Event):void{

    trace("LOADED");

    addChild(myLoader);

    mc= MovieClip(myLoader.content);

   //you can now use the alias mc anywhere in your main swf to make the whole loadedSwf invisible or trigger a function in the swf

  // for example: mc.hideMe() would trigger a function hideMe inside your loadedSWF

}

myLoader.load(new URLRequest("Interactive_Walkthrough.swf"));