Solved

loadMovie question

Posted on 2004-05-02
4
416 Views
Last Modified: 2006-11-17
Hello everybody,

 I am qutie new to action
scripting, and althought there are resources for loadMovie, not exactly for
my case:

have timeline with four buttons: button1 takes you to frame #1, button 2 to
frame #2, ... button 4 takes you to frame 4.

in frame 4 is MC "showcaseMC". showcaseMC has 20 buttons.  when you click on
first, first.swf is loaded. when you click on second, second.swf is loaded and any other unloaded. (at least this is the idea...)

My question is: what is better to use? loadMovie, or loadMovieNum, or
movieClipLoader.LoadClip

How?  I tried loadMovie and loadMovieNum. loadMovieNum works only if only one button has assigned this action. if two it does not work.

Also: how should I unload the movie once one of the other movies is loaded.
Or, how to unload it if button1 (or button2, or button3...) is clicked on?

Could you let me know what exactly to put on buttons1-4 (in the main timeline) and what on buttons first, second, third (in the showcaseMC timeline)...

Thanks for advice.

Purmar

0
Comment
Question by:purmar
[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
4 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 10975328
Hi, here's my suggestion.

For your usage, using loadMovie is quite alright. What I suggest is, instead of assigning code to each button each time, convert your buttons to movieclips, then give them each an instance name like loadone, loadtwo, loadthree.

the way you name them is important, cause you can then write a single function which will tell each movieclip which swf to load, for example:

function loadSwf(which) {
      whichMovie = substring(which._name, 5);
      loadMovie(whichMovie add ".swf", movieClipLoader);
}

if you trace whichMovie, (assuming you've named your movieclips loadone, loadtwo etc, ) whichMovie will give "one", "two",
etc. so it loads the respective movie. I'm assuming you're loading into a movieclip called movieClipLoader, if that's the case you don't need to unload anything, once you load something new, whatever was there is replaced.

You just need to fiddle with the code according to where you place the code in terms of your pathing. In this example, the function is in the timeline of the movieclip with the 10 buttons.

the code for the movieclips to call the function is then:
on (press) {
      _parent.loadSwf(this);
}

hope that makes sense.
blu.
0
 

Author Comment

by:purmar
ID: 10982778
Hey Blue

I tried your suggestion, but for some reason could not make it work. Also, my buttons converted to movieclips did not work with mouse over.  ANyway, I am sure that I did something wrong.,..

I was looking more into this and finaly made work loadMovieNum. It works just fine. The only problem is that I don't know how to get rid of it once the the users clicks on one of the first four buttons on the main, root timeline.

Thanks again for help.

Purmar
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 75 total points
ID: 10984171
Purmar, to make a movieclip have simulated up down and over states like a button, you need to create those states in different frames and send the playhead to those frames accordingly.

then, to get rid of it (i'm assuming it refers to the swf that was loaded), you can use unloadMovie(moviename) or as i mentioned before, simply by loading something else into that same target will replace it.

blue.
0
 
LVL 5

Assisted Solution

by:elhy
elhy earned 75 total points
ID: 11002444
hi, just some thoughts on the movieclip button thingy. Actually there's no need for such trouble as too create those mouseover frames to simulate a button with a movieclip. You can just put the button you've created into the movieclip, meaning the movieclip contains the button symbol and your button symbol. To make the button communicate with the main timeline, just add _root to your commands (e.g. _root.gotoAndPlay("framelabel")). As for unloading of movie, it will automatic unload any movie that is in the level u are loading to. By default main movie is in level 0, so by writting loadMovieNum("abc.swf", 0); will unload any movie/the root movie.
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…
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 live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

628 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