FORUMS: list search recent posts

Connect .swf sections in site

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alberto Moreno
Connect .swf sections in site
on Aug 17, 2011 at 11:56:17 am

Hello there,

I am creating a website with different sections (home, portfolio... - each of them has a full-screen looped video as a background)

I made a separated .swf for each section in order to reduce their size.

I just need to know how can I connect these .swf in order to navigate from one section to any other in the website.

What would be the easiest way to do so?

Is there a way to do it using the available Actions/code snippets included in Flash CS5?


Return to posts index

demetri tashie
Re: Connect .swf sections in site
on Aug 20, 2011 at 8:10:59 pm

sorry i can't give you into on 'snippets', but here is how you could go about coding it yourself.

on your main timeline, place movieclips to act as you navigation buttons, .

create a Loader to load in your external SWFs .

write code to then load the correct external SWFs.

here is some very basic, but complete, code which will do just that.
of course you would want to add more code to take diffenet things into consideration.
var myLoader:Loader = new Loader();

var url:URLRequest = new URLRequest('ext1.swf');
var url2:URLRequest = new URLRequest('ext2.swf');


load_btn.addEventListener(MouseEvent.CLICK, loadSWF);
load_2_btn.addEventListener(MouseEvent.CLICK, laodSWF_2);

function loadSWF(e:MouseEvent):void {

function laodSWF_2(e:MouseEvent):void {

1) declare your Loader which will load inthe external SWFs.
2) declare your URL requests to poinjt to the external SWFs
3) add the Loader to the stage/display list
4) give your buttons event listeners
5) write the CLICK functions which will load in the correct SWF.

hope that helps get you started.

Return to posts index

Alberto Moreno
Re: Connect .swf sections in site
on Aug 22, 2011 at 12:54:02 pm

Thanks a lot demetri,

It will really help me to get started and well into it :-)

Return to posts index

Alberto Moreno
Re: Connect .swf sections in site
on Nov 14, 2011 at 5:36:48 pm


I have followed the advice in this thread - I am working on a web (ActionScript3) that uses different .swf for each section - each .swf has its own navigation buttons. (see [*1] below for the code)

Each section has videos on it. In order to stop the video when switching to another section, each navigation button pauses the video in that section. (see [*2] below for the code)

Each time you click on the same button (or a different one) it seems that .swf loads again and again and there's no way to stop the sound even when you have already switched to another section.

I guess I'm doing something wrong - my web is almost finished but can't find a solution to this problem.

I'd be thankful for some help here.


/* Click to Load/Unload SWF or Image from a URL.
Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image. 
homeh_btn.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3); 
var fl_Loader_3:Loader; 
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad_3:Boolean = true; 
function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void
fl_Loader_3 = new Loader();
fl_Loader_3.load(new URLRequest("index.swf"));
fl_Loader_3 = null;
// Toggle whether you want to load or unload the SWF
fl_ToLoad_3 = !fl_ToLoad_3;



/* Click To Pause Video (Requires FLVPlayback component)
Clicking on the symbol instance pauses the video in the specified FLVPlayback component instance. 
1. Replace video_instance_name below with the instance name of the FLVPlayback component that you want to pause.
homeh_btn.addEventListener(MouseEvent.CLICK, fl_ClickToPauseVideo_2); 
function fl_ClickToPauseVideo_2(event:MouseEvent):void
// Replace video_instance_name with the instance name of the video component

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved