Groups | Blog | Home
all groups > flash actionscript > august 2005 >

flash actionscript : Movie Clip Button Help!



philzzz
8/12/2005 10:01:13 PM
Let me try to explain my situation as clearly as possible.

I have 5 buttons with each a fade-in and fade-out functions to them. I want to
be able to have the button freeze on a state (ex frame 10 once text faded into
blue) if pressed while puttin any other pressed button back to original state.

I want to know if there I could type something like this: (whereas identity is
instance name of button1)

Thank you!


identity.onRollOut=function() {
if onRelease was triggered
_root.identity.gotoAndStop ("10");
if not
_root.identity.gotoAndPlay ("10");
}
dondalinger
8/12/2005 10:08:42 PM
how about something like this..

on (release) {
_root.identity1.gotoAndStop ("1");
_root.identity2.gotoAndStop ("1");
_root.identity3.gotoAndStop ("1");
_root.identity4.gotoAndStop ("1");
_root.identity5.gotoAndStop ("1");
_root.thebutton.gotoAndStop ("10");
}

NSurveyor
8/12/2005 10:09:48 PM
identity.onRelease = function(){
//your on release code
this.wasReleased = true;
}
identity.onRollOut=function() {
if(this.wasRelease){
_root.identity.gotoAndStop ("10");
}else{
_root.identity.gotoAndPlay ("10");
}
this.wasRelease = false;
}

philzzz
8/12/2005 10:24:07 PM
Thank you so much NSurveyor for your help. I thought the code you gave me would
have worked... However it does not. Is there a bug you might be able to notice
in your code? The onRollOut still kicks in and makes the button fade back out
as soon as the cursor leaves the button canvas...

I am going berzerk!!!!! Please help!
NSurveyor
8/12/2005 10:49:31 PM
Wrote wasReleased in one part and wasRelease in another part... silly me. Also
there is an extra line. Just try:

identity.onRelease = function(){
//your on release code
this.wasReleased = true;
}
identity.onRollOut=function() {
if(this.wasReleased){
_root.identity.gotoAndStop ("10");
}else{
_root.identity.gotoAndPlay ("10");
}
}
NSurveyor
8/13/2005 12:00:00 AM
It's a frame rate issue. If you roll out faster than the frame rate, then the
movie does not notice it... what is your current fps? If it's less than 24,
make it 24. You might have to use setInterval and hitTest to make it perfect.
philzzz
8/13/2005 12:46:54 AM
Wow! Thanks! It really works! well, sort of! ;) The overall issue is now
solved, the buttons are now doing what I want them to.. However, for the
rollover and rollout to function, the cursor must absolutely rollover and
rollout at a slow speed. I was wondering why the buttons werent always working,
untill I noticed it was a speed issue...

Must I arrange the actionscript so it reads the rollout quickly or what else
can I do??? It looks very unprofessional this way, it looks kind of "buggy"
philzzz
8/13/2005 7:57:24 AM
Well, I had the movie set to 12 fps... which seems to be the default value; I
have now set it to 120, which is the only fps that is less apparent of the
problem... Now I must expand any tweens set in this movie clip so that it does
not seem to be as quick. I have tempted to search the Help regarding the
SetInterval and hitTest... However it seems way too confusing and not very
helpful... In what circumstances may they be of help????

I cannot thank you enough for your help!!
philzzz
8/13/2005 8:05:02 AM
I had set the movie clip to 120fps (lol) and worked fine in "test movie" mode.
But because it is a move set at approx. level 3 of the overall movie, it still
plays at 12 fps (and seems really slow since I have already expanded every
tween...) Opps, major problem now!
philzzz
8/13/2005 9:05:04 PM
AddThis Social Bookmark Button