[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

sync 2 swf files

Posted on 2004-04-05
8
Medium Priority
?
652 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Industry Leaders: 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!

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
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.

656 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