?
Solved

sync 2 swf files

Posted on 2004-04-05
8
Medium Priority
?
645 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 2

Accepted Solution

by:
whiterushin earned 1000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 1000 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

741 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