• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Loading Movies with Variables

I am trying to call movies using telltarget but with a variable.  By that I mean...I have numerous buttons that all call a movie clip.  When the called movie clip reaches it's end, I want it to call another movie clip  loaded within the current movie clip.  I do not want to make 7 duplicate clips so I want to assign a variable that will determine which movie clip is called.  Problem 2...let's say that I can get the above to work.  When I click on another button, I want to remove the current current movie clip from the stage...how do I do that, too?
0
palare98
Asked:
palare98
  • 8
  • 7
1 Solution
 
ZefferCommented:
don't use tellTarget..it is deprecated from Flash5 on..
use..with..instead..tellTarget only targets the path or url of a movie..with.. targets the movie as an object.

and anyway for what you want to do you can use the loadMovie and unloadMovie actions..

but first put an empty movie clip on the as a 'container' or 'target' into which the movie clip will load....give this movie the instance name of ..say..container..

put this on your buttons..and use your movie names where I've got..firstmovie.swf...and..nextmovie.swf

on (release)}
  loadMovie("firstmovie.swf","container");
{

in the last frame of your movie clips..

stop()
loadMovie ("nextmovie.swf",container);
unloadMovienum (1);

Z

0
 
palare98Author Commented:
that might work if I was using external movies, but I am using internal movie clips.
0
 
ZefferCommented:
where are the clips located?levels,frames?
also you mention not wanting to make 7 duplicate clips..is this to run the movies sequentially..no matter which button is clicked first?

Z
0
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!

 
palare98Author Commented:
the movies are loaded in a frame.  No they are not to be run sequentially.  I ned to be able to use a variable (or something like) that is declared when the button is pushed and tells the movie which clip to run.  Then when another button is pushed, it removes the current clip from the stage and allows the next one to start.
0
 
ZefferCommented:
sorry but it is still not perfectly clear..are all the clips..in different frames..in the same movie?
 
0
 
palare98Author Commented:
no.  They are all in the same frame in the same movie on the same layer.  The clips are set to begin at frame 2.  Their first frame has a Stop action in it. This is what I was using the Tell Target for. I would use the tell target to call the instance of the clip and tell it to play frame 2.  I'm not adverse to doing it another way.  I just need o know how.
0
 
ZefferCommented:
give each clip an instance name..
select a clip..go..window/panels/instance and type in a name..say..one..(next..two..three etc)
go to the main timeline and select a button.
now open the actions panel.
in..actions(it is under method in MX)..go down and find..with.. and click it.

now click on the blue circle with a cross in it(bottom right on the panel)and you will see the instance named..one.(and the others)..the panel  should be set on dot syntax..by default.. with absolute also checked.
click on ..one..and then ok... and the actionsript will now read..

on (release){
  with(_root.one){
gotoAndPlay(2);
 }
}

repeat this for the others..


on(release){
with(_root.two){
  gotoAndStop(1);
 }
}
on(release){
with(_root.three){
  gotoAndStop(1);
 }
}

}
on(release){
with(_root.four){
  gotoAndStop(1);
 }
}

so when you click on this button..movie one plays and the player looks for and parks..two,three and four.

the next button would have..two..or whatever in the first on(release) and then the rest would park any movie that happened to be playing.(this is a similar logic to show/hide layers in DHTML)

The quick way to do all this scripting is to do the first button and  then click on the right pointing triangle on the actionscript panel (near the top right corner).
select..export as file.

on the next button..select..import from file (select that .as file that was exported) and you only have minor changes to make to the instance names.

Z


0
 
palare98Author Commented:
welll..that would work, except that you're forgetting the very beginning part.  You click on the button, it calls "testmovie" when "testmovie" gets to the end it calls the next movie clip which is in a frame within "testmovie".  All of the button movies are in "testmovie".  I need a variable named when the button is clicked, then when "testmovie" reaches the end it refers back to the variable to call the correct next clip.  I appreciate your helpfulness, but I think that you are thinking about this too basically.  Most of what you have told me, I already know.  What I need to know, is how to use the variable to call the correct movie clip, and then when the next button is used how to unload the previous movie clip before the next one starts.  I don't just want to cover it up.
0
 
ZefferCommented:
you can only use unloadMovie when a movie has been loaded using loadMovie..

yours have all been loaded to the player on the initial load...so all you can do is 'cover them up'...by replacing one with another. The others will stay loaded in the player.(but hidden)

you only need an action at the end of each clip that calls the frame which holds the next movie..and if you want the 'correct' next movie to play they are obviously sequential (in content).
With respect..because of the way your movie is structured, I think you are thinking about this too complexly..which is why I have had trouble understanding the question.

Z
0
 
ZefferCommented:
a thought..if testmovie is an intro to each clip..put it on the front of each clip using a shared library and call each one individually..if you use the last code I posted this would work fine.

Z

0
 
palare98Author Commented:
I can appreciate where what I am trying to can be confusing.  While, you have definitely answered the unloading or removing the movie clip from the stage (answer:  it can't be done).  I am still holding out for the variable answer.  I appreciate you trying to create a resolve for what I am trying to do, but it does not address how to use variables to solve my problem.  I could have easily found a workaround.  I WANT to know how to use variables to solve this issue.
0
 
ZefferCommented:
Fair enough.I'm working on it.

Z
0
 
palare98Author Commented:
It's really starting to bother me. I've read all of the online docs and the flash help...I cannot get it to work.
0
 
ZefferCommented:
You have made this incredibly hard to do by wanting to run the intro clip and then tacking on the selected movie...Now you did say you are prepared to be flexible about this..so...if you dropped a copy of the intro into the front of each clip (this is no increase in file size as they are all coming out of the same library)..then you can target the clips..using variables..which is very clearly explained in this excellent tutorial and work files for download by Bryan Gaffin on .."how to use variables to control movie clips".

http://www.flashkit.com/search.php?term=Bryan+Gaffin&cat=tutorials&version=--&per=10&field=Contact_Name&orderby=Rating&andor=or&page=1&submit=Submit

there are some small changes to the first couple of frames of the clips to enable the player to read the variable..but it is a good introduction to using variables.

and thanks for persevering..I've learned something too..:)

Z
0
 
palare98Author Commented:
While that was not exactly what I was looking for, and you are still making me use the first clip over and over...that was pretty cool and I will be able to use it.  Thanks.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now