PDA

View Full Version : flash btn



Rukawa
07-07-2005, 05:35 AM
hi..
can anyone teach mi how to make the buttons show in
www.knowledgeplatform.com
i know is attached to a movie clip..
i can make the sub btns movie in..
but once i leave the main btns.. the sub btns will not stay.. and i cant select my choice of the sub-btns..
i need help... thanks a lot...

NTD
07-07-2005, 08:04 AM
Hi,

The demo link you posted uses movieclips as buttons. To understand how it works, create a movieclip to experiment with. Draw a circle on the stage, convert it to a movieclip and give it an instance name. Select the movieclip on stage and double click to get inside to it's timeline. Put a stop action on the first frame and insert another keyframe. Add some text or other content and a stop action on frame 2. Now, from the main timeline, you can control this mc with actionscript like.....


myMC.onRollOver=function(){
this.gotoAndStop(2);
}
myMC.onRollOut=function(){
this.gotoAndStop(1);
}


This should give you the basic rollover concept. Now all you need is to add another movieclip on frame 2 and control it's timeline in the same manner....


myMC.onRollOver=function(){
this.gotoAndStop(2);
myMC.slideMC.gotoAndStop(2);
}
myMC.onRollOut=function(){
this.gotoAndStop(1);
myMC.slideMC.gotoAndStop(1);
}


For this demo, frame 2 of slideMC would be an animation of the menu sliding out. This doesn't account for the slide in, but the same method applies, just send the movieclip timeline to the frame that slides the menu back in.

Hope it helps
NTD

Rukawa
07-08-2005, 02:34 AM
yes.. it helps a lot.. thanks..
i understand the logic.. but i not gd at scrpits..
it give mi this error..

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler
myMC.onRollOver=function()

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 5: Statement must appear within on/onClipEvent handler
myMC.onRollOut=function()

Total ActionScript Errors: 2 Reported Errors: 2
hm.. wat does this means?

NTD
07-08-2005, 03:31 AM
Hi,

You get that error when placing frame code on an object. The code sample I posted is frame code and as such belongs on the first frame of the movie. It applies the actionscript to the object by instance name...

Frame code...

_root.movieClipInstanceName.onRollOver=function(){
//do something;
}

_root.movieClipInstanceName.onRollOut=function(){
//do something;
}


Object code will always use an on event handler and is placed on the object itself....

button...
on(rollOver){
//do something;
}

movieclip...
onClipEvent(enterframe){
//do something;
}

Rukawa
07-08-2005, 04:46 AM
hi.. hm..
button...
on(rollOver){
//do something;
}

movieclip...
onClipEvent(enterframe){
//do something;
}

means we nid create a button..
er.. i'm sorry i not gd at flash but my company wans me to do that
animation btn.. need help a lot..
sorry to trouble u lots... and thanks lots

NTD
07-18-2005, 02:11 PM
Hi,

Try to create a test movie using the my first post to help understand how movieclips can function as buttons.