Solved

sync 2 swf files

Posted on 2004-04-05
8
631 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
Comment Utility
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
Comment Utility
forgot to add:

else {
gotoAndPlay(2);
}
0
 

Author Comment

by:markneelon
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 2

Expert Comment

by:whiterushin
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
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 how to record live broadcast.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

763 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

13 Experts available now in Live!

Get 1:1 Help Now