Solved

sync 2 swf files

Posted on 2004-04-05
8
636 Views
Last Modified: 2012-06-27
How can I load 2 seperate swf on a webpage so that they are in sync?
0
Comment
Question by:markneelon
  • 3
  • 2
8 Comments
 
LVL 2

Accepted Solution

by:
whiterushin earned 250 total points
ID: 10765512
you have to use actionscript to detect when a movieclip is loaded.  Let's say your 2 swfs are loaded into 2 container MCs "mc1" and "mc2".  Create 2 layers "actions" and "objects".  Drag both MCs offstage in the objects layer so they aren't visible before they are done loading.  Create 3 keyframes in the "actions" layer.  In your first you will call the loadMovie() to start the loading process for both MCs.  In keyframe 3 you will do the checking for both MCs loaded:

if (mc1.getBytesLoaded() = mc1.getBytesTotal()) and (mc2.getBytesLoaded() = mc2.getBytesTotal())  {

mc1._x = 200;
mc1._y = 200;
mc2._x = 300;
mc2._y = 200;
mc1.gotoAndPlay(1);
mc2.gotoAndPlay(1);

}
0
 
LVL 2

Expert Comment

by:whiterushin
ID: 10765519
forgot to add:

else {
gotoAndPlay(2);
}
0
 

Author Comment

by:markneelon
ID: 10771612
Thanks for answering.  I have a few questions:

1.  Do I include the "checking code" above in both flash/swf files?
2.  For mc1.x = 200, what does the 200 mean?
3.  There are 2 layers-actions and objects and 3 keyframes in the action layer, loadmovie() is in the 1st keyframe, checking is in the 3rd keyframe, what go's in the 2nd keyframe? Where do I put the keyframe in for the objects?
4.  Please explain your use of container?

I really appreciate your help.

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 2

Expert Comment

by:whiterushin
ID: 10775039
1. To sync the two flash/swf files you will have to load them into one using the "loadMovie()" command inside 2 empty movie clips. Your actionscript goes there.

2. 200 is the x position for the movie clip, you can change that to whatever.

3. you only need 1 keyframe in the "Objects" layer. That's where your 2 empty movie clips are.  3 keyframes in "actions" - the first one is initialization, and the start of loading.  The second is blank, but it's necessary for the looping and third is checking if the movies are loaded yet and loops back to frame 2.

4. Containers are 2 empty movieclips that will have your swfs loaded into them.
0
 

Author Comment

by:markneelon
ID: 10775282
So you are taking the 2 seperate movies and loading them into one movie and then you would embed that 1 movie into a webpage?
0
 
LVL 5

Assisted Solution

by:abdulqabiz
abdulqabiz earned 250 total points
ID: 11036140
Hi markneelon,

there is another way to do it. You can keep both swf separate and make the communication between them using LocalConnectioon Object. LocalConnection object let you communicate between two or more swfs running on same system, it could be:

- two swfs in same browser window
- two swfs in different browser window
- one in browser and other is in Standalone player
- two projectors etc

In your case, when one swf would load, it would check for other swf's LC channel if it doesnt find that, it wont play. When other swf is loaded it would have access to loaded swfs LC channel and it can trigger event in loaded swf.

So thats how you can make syncronizen between them. So need to load them into on or change the existing setup.


Let me know, if you like to know more about this.

Regards,
Abdul

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Does Flash have a Firefox problem? 5 319
Microsoft WSUS 4 103
Adobe flash player memory exhaustion 6 96
Could you point a workaround on how to open this Adobe Flash documents? 5 166
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question