Hey everyone
How do i make a movie clip fade dynamically when i press a button.
Eg (Psuedo Code)
On press
Tell target BLAH BLAH to fade to alpha 0
I know its basic, but im haveing trouble!
Thanks Gang
Printable View
Hey everyone
How do i make a movie clip fade dynamically when i press a button.
Eg (Psuedo Code)
On press
Tell target BLAH BLAH to fade to alpha 0
I know its basic, but im haveing trouble!
Thanks Gang
could be easier ways, and with more complex maths - accelleration/decelleration etc,Code:// ---------------------------------------
// put this function in frame one of your main timeline
_root.alphaFade = function(ob, fadeOut) {
_root.createEmptyMovieClip("fader", 2000);
_root.fader.onEnterFrame = function() {
if (fadeOut) {
ob._alpha -= 10;
if (ob._alpha <= 0) {
this.removeMovieClip();
}
}else {
ob._alpha += 10;
if (ob._alpha >= 100) {
this.removeMovieClip();
}
}
}
}
// ------------------------------------------------------
// and call it from your buttons like this:
on(press) {
_root.alphaFade(theMovieClipYouWantToFade, true);
}
on(release) {
_root.alphaFade(theMovieClipYouWantToFade, false);
}
but this will work.
[Edited by sonwah on 04-22-2002 at 01:07 AM]
Does all this code go in the button?Quote:
Originally posted by sonwah
could be easier ways, and with more complex maths - accelleration/decelleration etc,Code:_root.alphaFade = function(ob, fadeOut) {
_root.createEmptyMovieClip("fader", 2000);
_root.fader.onEnterFrame = function() {
if (fadeOut) {
ob._alpha -= 10;
if (ob._alpha <= 0) {
this.removeMovieClip();
}
}else {
ob._alpha += 10;
if (ob._alpha >= 100) {
this.removeMovieClip();
}
}
}
}
on(press) {
_root.alphaFade(theMovieClipYouWantToFade, true);
}
on(release) {
_root.alphaFade(theMovieClipYouWantToFade, false);
}
but this will work.
nah, sorry should have commented that a bit better.
put the function in frame one of your main(_root) timeline.
only put the on(press){} and on(release){} bits on the button.
sorry :)
Hi SonwahQuote:
Originally posted by sonwah
nah, sorry should have commented that a bit better.
put the function in frame one of your main(_root) timeline.
only put the on(press){} and on(release){} bits on the button.
sorry :)
I know im being a bit of a pain, but i cannot get it to work.
Can i send you the file and u take a look at what im doing wrong?
If not, it's all good, and thanks heaps for your help!
AJ
sure fire it through if you like.
what I would do first however, is make a new movie, get it going in the most simple way possible, and apply what you learn to your project.
I got a simple example going at the same time I posted that code, just to check along the way. It is quite easy, all the code you need is in my post.
Thanks Sonwah, to tell you the truth, im not much a prgrammer, rather I am an animator. I have used flash for about 2 years now, tinkering with basic actionscripting but really got into it as a foot into the multimedia area. Im working in 3D at the moment, using Maya for commercial projects.
Do you have a preferred email address, or should i just send it to the B vitamin one? (delete)
thanks Sonwah!
[Edited by ajspencer on 04-22-2002 at 01:36 AM]
yup,
but can you edit that last post and take it out again?
cheers.
I know people can get it anyway, but i don't want to make it too easy for them to spam me :)