Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to control or link external.swf movie from a button on the main movie.swf ?

Posted on 2010-09-14
6
Medium Priority
?
861 Views
Last Modified: 2012-08-13
Hello my name is alan in the last few days

i was trying to find how I can control and link an ( external.swf ) movie

from a menu with buttons inside my main  movie call ( main.swf  )

I can not find the code to make work each button and call a frame label on a movie clip  ( pages mc ) inside my external.swf

Im using AS2

I have the structure of my movies like this.

---------------------------------------------------------------------------------------------------------------------

Please download and check my fla. or see it here :

http://enixstudio.com/flash_tutos/how_to_control_external_movie_tuto.zip 

http://enixstudio.com/flash_tutos/how_to_control_external_movie_tuto/main.html

---------------------------------------------------------------------------------------------------------------------
0
Comment
Question by:enixstudio
[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
  • 2
  • 2
  • 2
6 Comments
 
LVL 5

Expert Comment

by:bupper
ID: 33679288
You have a movieclip called "container". Within this, you load a movieclip that IS NOW CALLED "container".

So, when you want to reference the external movie, you do it like this:
_root.container.container

If you want to move to a frame, for example, assign this actionscript to a button on the menu:
on (release) {
    _root.container.container.gotoAndStop(2);
}

Now when you click the menu button, the external clip will move to frame 2. Is this something like you wanted?
0
 

Author Comment

by:enixstudio
ID: 33679878
Hi bupper in response to your question is NO.

In my maine.swf movie I have a movieclip with the instance name call "container" this empty movieclip load inside my external.swf movie with the following code :

stop ();
this.createEmptyMovieClip("container", 1);
container.loadMovie("external.swf");

Now on my external.swf movie i have a movieclip with the instance name call "pages" inside this movieclip I have 5 frames labels called up "p1","p2","p3","p4","p5"

So my question its how i do to communicate from my button 01 btn ( inside menu mc > main.swf. ) to my external.swf movie to my > movieclip with the instance name call "pages" and goandplay the frame label call "p1" ?

Check this link example here :: Follow the red arrow !

http://enixstudio.com/flash_tutos/how_to_control_external_movie_tuto/control_external_movie.html

if my menu was in the same movie lets say main.swf iknow this code works to call each frame label from my button 01 btn to > movieclip with instance name "pages" > to > my frame label call "p1" and works for each button !

on (press)
{
    if (_root.link != 1)
    {
        _root.menu["item" + _root.link].gotoAndPlay("s2");
        _root.link = 1;
        _root.pages.play();
    } // end if
}

Check this link example here ::

http://enixstudio.com/flash_tutos/how_to_control_external_movie_tuto/crane_and_menu.html 

In brief  I need to do this but with my menu in my main movie and my pages on my external movie.
 
and thanks for the help but I hope you can help me a bit more ! : )
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 33680829
this is so odd, i'm sure I posted something on your topic this morning. oh well, maybe it was too early in the morning.

enixstudio what bupper is saying is correct.

not sure what your _root.link etc does, but the problem is here

_root.pages.play();

as bupper says

  _root.container.container.play();

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Accepted Solution

by:
bupper earned 1200 total points
ID: 33684060
First, when you load an external movieclip, and reference _root from within the external movieclip, it will refer to the _root of the entire thing (main.swf)! To get around this, put the following code directly after you load the external clip:
container._lockroot = true;

Now when you say _root in the external clip, it will refer to itself :)

For the menu buttons, on each menu button in the main movie, attach the following:

on (press)
{
    _root.container.container.pages.gotoAndStop("p2"); // OR p3, p4, p5, etc
}
0
 
LVL 39

Assisted Solution

by:blue-genie
blue-genie earned 800 total points
ID: 33686005
no bupper, your code is right, you dont'need the lockroot

i tested it.
0
 

Author Closing Comment

by:enixstudio
ID: 33686333
Thanks bupper and blue-genie for your attention and patience works to perfection and how you said you do not need the lockroot !

As a contribution i upload the files for people in need in the future:
 http://www.enixstudio.com/downloads/tutorials/flash/how_to_control_an_external_swf/main.html
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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. …
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

604 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