[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

loadMovie question

Posted on 2004-05-02
4
Medium Priority
?
422 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
  • 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 300 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 300 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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,…
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 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
Course of the Month8 days, 3 hours left to enroll

607 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