Hi all,
does anyone knows how i am able to hide a MC on the stage when i click a button
and how i can make it visible by clicking another?
i cannot do this by telling them to goto frames becoz that will mess up my other functions.
can this be done using simple actionscripting?
any tutorials / sample files would be appreciated.
thanks…
flash 5 user
system
December 20, 2002, 4:14pm
2
Just place these actions on your buttons and give your MC a instance name of “myMC”
Button 1
on (release){
myMC._alpha = 0
}
Button 2
on (release){
myMC._alpha = 100
}
system
December 20, 2002, 7:46pm
3
You can change the alpah but that will mean it still exists o nyour stage. IF you want it truely gone use the _visable property.
on (release){
myMC._visible = flase; //Hides the MC
}
on (release){
myMC._visible = true; // Shows the MC
}
If you have a lot of objects on the screen this is best because it frees up some proccessor power for other things.
system
December 21, 2002, 6:57am
4
I see…thanks for all your help, i’ll try it out
<:} <:}
system
December 21, 2002, 6:58am
5
Yes, the _visible way is more effective. I read somewhere on this forum (I believe from david) that if you alpha something to 0, it can still be seen on machines that have low res and color monitors. (vaguely, but it is still there).
Of so I have read somewhere.
system
December 21, 2002, 7:15am
6
how can i make it do a gradual fade like from 0 alpha to 100 alpha
system
December 21, 2002, 7:17am
7
onClipEvent (load) {
this._alpha = 0;
}
onClipEvent (enterFrame) {
this._alpha += 5;
if (this._alpha >= 100){
this._alpha = 100;
}
system
December 21, 2002, 7:24am
10
one problem
it doesnt work
system
December 21, 2002, 7:26am
11
OOOPS, it would help to close the if statement I think.
That is what I get for typing it up in here :-\
onClipEvent (load) {
this._alpha = 0;
}
onClipEvent (enterFrame) {
this._alpha += 5;
if (this._alpha>=100) {
this._alpha = 100;
}
}
system
December 21, 2002, 7:28am
12
■■■■ now i feel stupid for missing that
thank you again
system
December 21, 2002, 7:28am
13
No problem.
I feel stupider for forgetting to close it in the first place
system
December 21, 2002, 7:32am
14
It is a slow night, and I am bored, so while I am at it, to fade it in and out, you can do this…
onClipEvent (load) {
this._alpha = 0;
trigger = 0;
}
onClipEvent (enterFrame) {
if (trigger == 0) {
this._alpha += 5;
if (this._alpha>=100) {
this._alpha = 100;
trigger = 1;
}
}
if (trigger == 1) {
this._alpha -= 5;
if (this._alpha<=0) {
this._alpha = 0;
trigger = 0;
}
}
}
system
December 21, 2002, 7:39am
15
omg you wer reading my mmind
i was trying to figure out how to make it do that with like a for loop and if then statements
lol much easier
thanks yet again
system
December 21, 2002, 7:53am
16
No problem, it sounds like you were going about it wrong anyway
Ok, I am still bored so… If you wanted it to look like a ball bouncing as seen from directly above, you could do this…
onClipEvent (load) {
this._alpha = 0;
trigger = 0;
this._xscale = this._yscale=0;
}
onClipEvent (enterFrame) {
if (trigger == 0) {
this._alpha += 5;
this._xscale = this._yscale += 5;
if (this._alpha>=100 && (this._xscale && this._yscale)>=100) {
this._alpha = 100;
this._xscale = this._yscale=100;
trigger = 1;
}
}
if (trigger == 1) {
this._alpha -= 5;
this._xscale = this._yscale -= 5;
if (this._alpha<=0 && (this._xscale && this._yscale)<=0) {
this._alpha = 0;
this._xscale = this._yscale=0;
trigger = 0;
}
}
}
system
December 21, 2002, 7:56am
17
wow thas a cool effect
thanks again:)
now make it rotae and sing the national anthem:crazy:
system
December 21, 2002, 8:00am
18
Wait, I updated the code…
onClipEvent (load) {
trigger = 0;
assets = this._xscale=this._alpha=this._yscale=0;
}
onClipEvent (enterFrame) {
if (trigger == 0) {
this._xscale = this._alpha=this._yscale += 5;
if ((this._alpha>=100 && this._xscale && this._yscale)>=100) {
assets = 100;
trigger = 1;
}
}
if (trigger == 1) {
this._xscale = this._alpha=this._yscale -= 5;
if ((this._alpha && this._xscale && this._yscale)<=0) {
assets = 0;
trigger = 0;
}
}
}
As for rotating, I can do that. Singing the national anthem I cannot do. Unless you have a .mp3 of it…lol.
system
December 21, 2002, 8:05am
19
Here it is with rotation…lol.
onClipEvent (load) {
trigger = 0;
assets = this._xscale=this._alpha=this._yscale=0;
}
onClipEvent (enterFrame) {
this._rotation += 10;
if (trigger == 0) {
this._xscale = this._alpha=this._yscale += 5;
if ((this._alpha>=100 && this._xscale && this._yscale)>=100) {
assets = 100;
trigger = 1;
}
}
if (trigger == 1) {
this._xscale = this._alpha=this._yscale -= 5;
if ((this._alpha && this._xscale && this._yscale)<=0) {
assets = 0;
trigger = 0;
}
}
}
WHY AM I SO BORED!?!?!?!
It is 3:00am…lol. I am not even tired.
system
December 21, 2002, 8:09am
20
aww man i got my hopes all up to man
oh well
j/p man very nice job
how can i make the background change color