Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / July 2005



Tip: Looking for answers? Try searching our database.

How to Refer to Movie Clip Within Button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
unicorn - 31 Jul 2005 16:30 GMT
I have created a movie clip with two frames, labelled green and blue. I have
placed this movie clip as the background of a button. On RollOut, I want to
gotoandstop("green") to change the button background to green. However, I can't
seem to figure out how to refer to the movie clip. The movie clip has the
instance name BGFatalityNotice, and the button has the instance name
ROFatalityNotice. I've tried the code
on (rollout) {
    _root.ROFatalityNotice.BGFatalityNotice.gotoandstop("green");
    _root.toplevel.gotoAndStop("green");
}
on the button, but it doesn't work. It does successfully change the color of a
second instance of the movie clip, called toplevel, which is NOT in the button.
Any advice? I have tried every method I can think of to refer to this clip and
it's driving me nuts.
kglad - 31 Jul 2005 16:46 GMT
first, case counts (usually) in flash.  gotoandstop() isn't correct.

second, buttons don't have true timelines.  so, even though you think you gave
that movieclip an instance name, flash ignores that and gives the movieclip an
instance name it likes.  for example, instance1.

so, you could try:

on(rollout){
_root.ROFatalityNotice.instance1.gotoAndStop("green");
}

or just do the smart thing and don't use a true button.  use a movieclip
button.
unicorn - 31 Jul 2005 16:55 GMT
I *much* prefer the smart thing. Is there a tutorial/link you can refer me to on creating a movieclip button?
kglad - 31 Jul 2005 18:00 GMT
there's not much to it.  you've already done most of the work, though you may
want to add a "down" frame on your movieclip's timeline.  

drag your movieclip to the stage and give it an instance name, say
BGFatalityNotice and attach to a  _root frame:

BGFatalityNotice.onPress=function(){
gotoAndStop("down");
// do whatever
}
BGFatalityNotice.onRollOver=function(){
gotoAndStop("green");
// do whatever
}
BGFatalityNotice.onRollOut=function(){
gotoAndStop("up");
// do whatever
}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.