Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple events through local connection

Status
Not open for further replies.

frozenpeas

Technical User
Sep 13, 2001
893
CA
Hi everyone,

I have four seperate swfs, each containing one button. Each button should load different content into a seperate, main swf.

Each button contains the code:

Code:
on (press){
	outgoing_lc = new LocalConnection();
	outgoing_lc.send("lc","moduleLoad","module01.swf");
	delete outgoing_lc;
}

My main swf with is receiving these commands contains the following code on the first frame:

Code:
// receive command from button and load module
var incoming_lc = new LocalConnection();
incoming_lc.moduleLoad = function(moduleToLoad){
	loadMovieNum(moduleToLoad,0);
	// the following two lines are not required but it is something I have tried to remedy my problem
        incoming_lc.close("lc");
	incoming_lc.connect("lc");
}
incoming_lc.connect("lc");
stop();

I need to be able to press the four buttons, in any order, to load the content into the main swf.

The trouble is that it works for only the first button press. Then nothing is loaded on subsequent button presses.

Any ideas? Thanks!

frozenpeas
 
You want to replace your main movie with the new movie being loaded?
 
That is correct. It works on the first one loaded, then no other ones will load (unless I refresh the page).

frozenpeas
 
What if you don't use delete outgoing_lc; on your buttons?
 
I have tried with and without - same problem... [mad]

frozenpeas
 
Fixed.

The problem was that I was loading the movie into _level0, so the local connection receiving script was no longer present, since it was being replaced by the loaded swf.

frozenpeas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top