Solved

loadMovie question

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I change text in a Flash (FLA, SWF) file? 3 1,004
Streaming to Flash Media Server with ffmpeg, crashes on start 3 248
Action Script commands 4 314
PDF: Display my cards game? 8 111
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. …
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…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
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…

777 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