Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
Chris Waters #1
play clip, remove clip, load new clip
I have an empty 'container' MC that has a MovieClip load into it when a
button is pressed.....when another button is pressed, it should play the
fade out tween of the current loaded MovieClip, remove it and then load the
new MovieClip into the container.
I am so close and I've tried all different ways that i can think of to get
it to work. The closest I have got is to do nearly what i want, only the new
movieclip loads and starts playing over the top of the existing movieclip as
it plays its fade out tween, which obviously doesn't look very nice.
Here is the current script I have on a button:
on (release) {
_root.container.cont.gotoAndPlay ("outro"); //"outro" is my fade out
tween//
_root.container.profb.gotoAndPlay ("outro");
_root.container.profc.gotoAndPlay ("outro");
_root.container.car.gotoAndPlay ("outro");
if (done=true) { //done=true is set at the end of the 'outro' sequence,
but does not have any effect at present//
_root.container.cont.unloadMovie ();
_root.container.profb.unloadMovie ();
_root.container.profc.unloadMovie ();
_root.container.car.unloadMovie ();
_root.container.attachMovie ("prof1", "profa", 1); //this loads the new
movieclip that is relevent to the pressed button //
}
}
PLEASE NOTE: all my movieclips are in the same flash file and are not
externally loaded swf's
If anyone has an idea of what i'm trying to do and can help, then i would be
most grateful....further info available if needed.
Regards
Chris W
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
Version: 6.0.587 / Virus Database: 371 - Release Date: 12/02/04
Chris Waters Guest
-
Random Movie clip play
I have 7 different MovieClips. I put them into the main MovieClip which is on the stage. I want the 7 clips to play randomly when the .swf is... -
How to play an animation clip from the MIDDLE?
Hi all, I have a question, when i'm in the flash 8 program does anybody know how to play an animation clip( a flash clip with sound) FROM THE... -
need help positioning movie clip relative to a resizing clip...
I am trying to attach a "caption" to the bottom right edge of a movie clip that resizes. I am using the resizing clip as a image holder for a... -
Need help getting movie clip symbol to play
I'm trying to use a movie clip symbol on one of my scenes. I've created a new layer for it and dragged it onto the stage from my library, but it... -
remove random clip?
I am trying to edit a FLA where it keeps randomly adding a clip to the screen, pretty soon there are way too many, how do I make a timer so each... -
Chris Waters #2
Re: play clip, remove clip, load new clip
sorry...I do have double = in place but forgot to include that in my last
posting of my code:
if (done==true);
Please help as Im getting a serious headache with this one as i know i'm
close!
:)
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
Version: 6.0.587 / Virus Database: 371 - Release Date: 13/02/04
Chris Waters Guest
-
Longest #3
Re: play clip, remove clip, load new clip
Obviously you think that "if (done=true)" waits until "done" switches to true.
Thats not the case. It just checks once (at the moment you release the button)
and then executes the code inside the brackets or not.
Try to move the code inside the "if" brackets at the place where you would set
the "done" variable to true.
Greetings, Longest
Longest Guest
-
Chris Waters #4
Re: play clip, remove clip, load new clip
Hi Longest,
firstly, thanks for your suggestion.
however, I can't move the code that's inside the 'if' brackets to the place
where I set done=true because that code inside the 'if' brackets loads the
movieclip that is relevant to the button that was pressed....if i move it to
the place you suggested (which is at the end of every 'outro' sequence of
each movieclip) then it would not know which buton has been pressed and
therefore which movieclip to load
any suggestions?
regards
chris w
Chris Waters Guest
-
Laiverd.COM #5
Re: play clip, remove clip, load new clip
First of all; if all if no movie is external and all are inside the
movieclip then unLoadMovie is useless as this is only for loaded movies not
for attached or duplicated mc's. To remove attached or duped mc's use
removeMovieclip() method. But ... if you attach the to the same movieclip
over and over again; there's no need for a removemovieclip as on each new
attach the old clip will be removed as long as you attach it to the same
depth. So in the following code:
container_mc.attachMovie("Symbol1","blah",1);
black_mc.onRelease = function(){
container_mc.attachMovie("Symbol2","blah1",1);
}
Symbol 2 will replace Symbol 1 because it is attached to the same movieclip
at the same depth.
John
--
----------------------------------------------------------------------------
-----------
RESOURCES
[url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
----------------------------------------------------------------------------
-----------
TUTORIALS at
[url]www.laiverd.com[/url]
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------
Laiverd.COM Guest
-
Chris Waters #6
Re: play clip, remove clip, load new clip
Hi John
thanks for that...I did have a feeling about the unloadMovie being useless
and knew that loading a movieclip into the same level removes the existing
one.
could yoy please tell me how i can get two actions to take place on one
mouse event. eg.
on (release) {
_root.container.cont.gotoAndPlay ("outro"); //this plays the current
loaded movieclip's 'outro' sequence
_root.container.profb.gotoAndPlay ("outro");
_root.container.profc.gotoAndPlay ("outro");
_root.container.car.gotoAndPlay ("outro");
_root.container.attachMovie ("prof1", "profa", 1); //this loads the new
movieclip
}
however, it instantly loads the new movieclip and does not show the 'outro'
sequence....i need it to wait till the 'outro' sequence has finished playing
before it loads the new movieclip....the closest i had played the 'outro'
sequence but also played the 'intro' sequence of the newly loaded movieclip
at the same time, so you saw them both over the top of each other....not
what i wanted :(
any ideas?
thanks
chris w
Chris Waters Guest
-
stwingy #7
Re: play clip, remove clip, load new clip
I think the method outlined by longest is correct but another way is just to
set up a function to test if done is true.
btn1.onPress = function() {
myInterval = setInterval(checky, 50);
};
function checky() {
if (container.mc2.done == true) {
trace("done");
clearInterval(myInterval);
}
}
//on the last frame of mc2
//this.done = true
stwingy Guest
-
Laiverd.COM #8
Re: play clip, remove clip, load new clip
Put:
_root.container.attachMovie ("prof1", "profa", 1); //this loads the new
movieclip
at the end of the outro animation at the point where it's finished. That
would be the easiest solution (depending on the setup, you'd have some
pathadjusting to do, but that shouldn't be too hard). The more complicated
solution would involve continuous checking of _currentframe of the outro and
if that has a certain value, then do the attachmovie.
John
--
----------------------------------------------------------------------------
-----------
RESOURCES
[url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
----------------------------------------------------------------------------
-----------
TUTORIALS at
[url]www.laiverd.com[/url]
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------
Laiverd.COM Guest
-
Chris Waters #9
Re: play clip, remove clip, load new clip
Thanks John....it's nearly there, I can sense it!
I'm having trouble with the clipToAttach variable.
at the end of my 'outro' I have:
_root.container.attachMovie (clipToAttach, "new", 1);
and on my button I have:
on (release) {
_root.container.cont.gotoAndPlay ("outro");
_root.container.profb.gotoAndPlay ("outro");
_root.container.profc.gotoAndPlay ("outro");
_root.container.car.gotoAndPlay ("outro");
clipToAttach = "prof1";
}
It's playing the outro ok, but not loading the clipToAttach movieclip.
you mentioned that I might have to specify the path for the clipToAttach,
such as _root. for example.
Do I do that on the button script or in the attachMovie script?....and what
am I specifying....the actual movieclip I want to attach?...because I've
tried putting an instance of that movieclip on the root, naming it and
referencing to that, but no luck.
Chris Waters Guest
-
Laiverd.COM #10
Re: play clip, remove clip, load new clip
You may wanna try
_root.container.attachMovie (_root.clipToAttach, "new", 1);
In a quick setup I made that works. But it really depends on how you've set
up your timelines. If you can't work it out; just put up the fla for
download and provide the url to that location.
John
--
----------------------------------------------------------------------------
-----------
RESOURCES
[url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
----------------------------------------------------------------------------
-----------
TUTORIALS at
[url]www.laiverd.com[/url]
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------
Laiverd.COM Guest
-
Chris Waters #11
Re: play clip, remove clip, load new clip
John, your a star mate!
I just worked it out after many trial and errors
I put _root.clipToAttach on both the button and at the end of the outro and
place the instance of the movieclip on the root and it works like a charm!!
many many thanks and much appreciattion for your time and effort.
I am now a happy man and can now go to bed :)
thanks again
Chris Waters Guest
-
Laiverd.COM #12
Re: play clip, remove clip, load new clip
Time for me to go to bed too. Glad you could work it out.
John
--
----------------------------------------------------------------------------
-----------
RESOURCES
[url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
----------------------------------------------------------------------------
-----------
TUTORIALS at
[url]www.laiverd.com[/url]
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------
Laiverd.COM Guest



Reply With Quote

