PDA

View Full Version : back to Flash 5 - Button instance


spazmaster
10-08-2002, 11:44 PM
i need to publish a movie in Flash 5 but the only thing that is holding me back is a button instance name - its targetted in some actionscript.

how can i target a "button" in Flash 5? if i made it a movieclip i cant use event handlers (dammit hehe) so i thought i should use hitTest so i could target it as movieclip and still make it play a "Over" state. heres the not working as:


onClipEvent (load) {
if (hitTest(_root._xmouse, _root._ymouse, false)) {
//the button has instance name "A"
_root.A.gotoAndStop("down");
} else {
_root.A.gotoAndStop("up");
}
}


am i using the right method?

Billy T
10-09-2002, 12:29 AM
if you put a button inside a movieclip and then roll over the button, it will go to the over state - you dont need to do a hit test or anything

maybe i have misunderstood your problem...

cheers

Billy T
10-09-2002, 12:36 AM
hmmm change

onClipEvent(load){

to

onClipEvent(enterFrame){

spazmaster
10-09-2002, 04:48 PM
cool thx dude...sometimes the answer is so simple :)

and i'll try enterframe..that code should have worked right?

Billy T
10-09-2002, 04:52 PM
Originally posted by spazmaster
that code should have worked right?

umm well that depends

if A is really the instance name of your "button" then it wont work - flash 5 doesn't recognise buttons instances and even if it did you can't tell a button to go to a particular state (up, down etc) like that...

cheers