Solved

sync 2 swf files

Posted on 2004-04-05
8
635 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to put actionscript code for a button? 6 129
Inserting a pop up image to a scanned PDF 5 444
Flash player plugin 13 7 331
Missing Plugin for Firefox - Can't View Content 7 172
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

816 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now