PDA

View Full Version : need help about buttons with as



Devric
October 2nd, 2007, 04:29 AM
something is wrong with my action script, when i click on a button and f9 the action script say the action script aint availible for current section Oo???? this dosent happen b4 when i using another comp with flash mx..... all i want to do is just use playmovie command on button release. anyone know what i might be doing wrong???

Devric
October 2nd, 2007, 05:10 AM
i found out dis problem is done by publishing in action script 3, but i need action script 3 for some of my components so i would like to stay in action script 3,

so does anyone have any idea how i can apply on(release) {play()} to the button in action script 3??? as it dosent work when i selelct the button and use action script(f9) is says is not appliable

robgungor
October 4th, 2007, 04:42 PM
so does anyone have any idea how i can apply on(release) {play()} to the button in action script 3??? as it dosent work when i selelct the button and use action script(f9) is says is not appliable

Hey Devric,

Check this post I wrote about making movieclips buttons in AS3. (http://www.iheartactionscript.com/coding-movieclips-as-buttons-in-as3/)

You can no longer put code directly onto a movieclip in AS3 - you need to put it in the timeline. So name your button something like myButton and then pu t in this code:


myButton.addEventListener(MouseEvent.CLICK, onClickHandler);
function onClickHandler(m:MouseEvent)
{


play();
}

Hope that helps!

rob
iheartactionscript.com (http://www.iheartactionscript.com)