Solved

loadMovie question

Posted on 2004-05-02
4
410 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 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

762 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now