A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How do you have a button call from one .swf to another .swf without file name

  1. #1
    Junior Member
    Join Date
    Mar 2001



    I'm pretty new to actionscript so please bear with me on this question. Here's what I'm trying to do. I have 2 movies. Movie 1 is an intro that we'd like to use in many different movies. Movie 2 is one of the many movies we'd like to use Movie 1 (Intro) in.

    Right now in Movie 2 I have and an actionscript which is loading Movie 1: loadMovieNum ("intro.swf", 0);. Movie 1 (intro.swf) has a "Click to play" button. I need the "Click to play" button to start playing Movie 2. The problem I'm having is that I don't want to specify an exact movie name because it needs to be generic so the Movie 1 (intro.swf) can be used among many different movies. I tried unloading Movie 1 but that just gave me a blank screen. I tried having it go to the next scene, but that also gave me a blank screen. Is there any way to have the button go to the movie that loaded the movie with the button?

    If this sounds confusing, here's exactly what we want this functionality for. I'm creating ecards and I want a little intro with the logo and such on it. Then I want it to have an option to start playing the ecard. Hallmark.com has ecards that do this very thing. I want our intro seperate so that we can make updates easily to the intro.

    Any advice, code, suggestions, etc. are greatly appreciated!

    Thank you in advance!


  2. #2
    The name of the Movie you want the Intro Movie to load and play has to come from somewhere - either the Intro Movie itself, the desired Movie or a 3rd movie that 1st loads the intro Movie that in turn loads the desired movie. If you load the desired Movie and have it load the Intro Movie you will have to consider the size of the desired Movie and how Flash handles streaming. If you use a 3rd "pre-loader" movie, then it can load the Intro Movie and tell it the name of the desired Movie. This pre-loader movie will be extremely small in size so it will load quickly. You can bury the name of the desired Movie file in a generic variable and then call it in a Load Movie command. Let's say the variable is "lm".

    In the pre-loader Movie, you set the value to your desired Movie:

    Set Variable: "/:lm" = "desiredMovie.swf"

    You then load your Intro Movie:

    Load Movie ("introMovie.swf", 1)

    In your Intro Movie, you can use the following statement:

    Load Movie (Eval("_level1:lm"), "_level1/MC1")

    where "MC1" is an empty Movie Clip. This will load your desired Movie into the empty Movie Clip "MC1" and then you can reference this MC1 using the Tell Target command because it has an Instance name. Using this approach will allow you to use your generic Intro Movie in multiple Movies.

    There are other ways, but this should work.

    Markus B

    [Edited by Markus B on 06-13-2001 at 01:29 AM]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center