Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Guest
Oct 07, 2013 Oct 07, 2013

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.

TOPICS
ActionScript
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Oct 08, 2013 Oct 08, 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

...
Translate
Guru ,
Oct 08, 2013 Oct 08, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 08, 2013 Oct 08, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 08, 2013 Oct 08, 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"));

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 08, 2013 Oct 08, 2013

Thank u.

A small doubt again.

That is, if I want to hide the main swf (i.e.,the first swf)so that only the second would visible.

And I would give a button in the second swf to come back again.

Would That be possible?

Because I have tried to hide the first swf(i.e., the main swf) but nt working.

What could be done?

Many thanks in advance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 08, 2013 Oct 08, 2013

Since the main swf is the container which holds all loaded swf it is not possible to make it invisible without hiding all its children (the loaded swfs) too.

In this case it would be better to have a third, pretty much empty swf that does all the loading and treats both image sequences as children.

Since you most certainly need a thrid swf anyway, that acts a s a preloader in a webenvironment.

var l:Loader = new Loader();

var mc1:MovieClip;

var mc2.MovieClip;

l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);

l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);

l.load(new URLRequest("game.swf"));

function loop(e:ProgressEvent):void

{

    var kBytesLoaded:int = Math.round(e.bytesLoaded/1024);

    var kBytesTotal:int = Math.round(e.bytesTotal/1024);

    Object(this).loaded_txt.text = kBytesLoaded;

    Object(this).total_txt.text = kBytesTotal;

    var perc:Number = kBytesLoaded / kBytesTotal;

    trace("PERCENT:"+perc);

}

function done(e:Event):void

{

    //removeChildAt(0);

    addChild(l);

  mc1= MovieClip(l.content);

}

// do this for both swfs and then you can have a function that switches between mc1/mc2 vibility whenver the relevant buttons are pressed

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 08, 2013 Oct 08, 2013

That is create a new swf file with first to be loaded on opening the file.

And toggle visibility between these two swfs?

Am I wrong?

Thank u.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 08, 2013 Oct 08, 2013

3 swfs:

main swf is principally only preloading tzhe other two:

your old main.swf and the Interactive_Walkthrough.swf

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 16, 2013 Oct 16, 2013

Thank u.

I again want to know that, is it possible that the third(main) swf would be the only swf and after linking to the other swfs, the third swf run(work) individually in another location?

Hope I made myself clear.

Thank you in advance.

And is there any swf file to html converter?

Because wen I export the file to html i.e. publish, the html does not work independently. The swf file also have to be placed in the same location.

COuld it be possible to get a html file to work the same as swf without the swf file in its samelocation because the swf file is of rather large file size.

Thank u again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 16, 2013 Oct 16, 2013

I again want to know that, is it possible that the third(main) swf would be the only swf and after linking to the other swfs, the third swf run(work) individually in another location?

Believe me, even though its possible you don`t want to do that.

COuld it be possible to get a html file to work the same as swf without the swf file in its samelocation because the swf file is of rather large file size.

No, the html file is only a wrapper. Its pretty much like a parcel, and the swf is the birthday gift.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 16, 2013 Oct 16, 2013

Thank u but that clear and precise expalanation.

Believe me, even though its possible you don`t want to do that.

What does that mean, is there a possibility.?

curious to know.

Thank u so much.

And another doubt, that is, what could be done wrap all the associated files in a single file?

that is all necessary project files and folders.

What to do?

Thank You in advance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 16, 2013 Oct 16, 2013
LATEST

you can use flashs

navigateToTORL function to navigate between a pair of swf/html files

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html#navigateTo...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines