FORUMS: list search recent posts

Stop(); not working, is my code correct ?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Steve George
Stop(); not working, is my code correct ?
on Nov 21, 2010 at 2:05:24 pm

i have created a movie clip button based on this tutorial..
http://www.schoolofflash.com/blog/2008/05/flash-cs3-tutorial-movie-clip-but...

with the aim of making similar buttons to this http://www.judgejules.net/

i have made the button look the way i want it to, and animate, but when i preview it, it just plays through, it doesn't stop.
i have added stop(); at frames 1,20 & 40 as explained in the tutorial.

I have this error code displayed in compiler errors ...

Scene 1, Layer 'actions', Frame 1, Line 7 1071: Syntax error: expected a definition keyword (such as function) after attribute Function, not onButtonOver.

this is the actions code i used

--------------------------------

import flash.events.MouseEvent;

btn_mc.buttonMode = true;
btn_mc.addEventlistener(MouseEvent.ROLL_OVER, onButtonOver);
btn_mc.addEventlistener(MouseEvent.ROLL_OUT, onButtonOut);

Function onButtonOver(e:MouseEvent):void
{
e.currentTarget.gotoAndPlay("over");
}

function onButtonOut(e:MouseEvent):void
{
e.currentTarget.gotoAndPlay("out");
}

----------------------------------------------

Here is a link to the .fla file
http://hotfile.com/dl/84007378/56d85c3/button_mc.rar.html

Im using flash profession cs5 on windows xp

Can anyone offer any hints to what i may be doing wrong ?

thanks in advance :-)

stevie


Return to posts index

Steve Brame
Re: Stop(); not working, is my code correct ?
on Nov 21, 2010 at 2:56:30 pm

"Function" is not the same as "function"

Steve Brame
creative illusions Productions


Return to posts index

Steve George
Re: Stop(); not working, is my code correct ?
on Nov 21, 2010 at 3:03:19 pm

Thanks for spotting that schoolboy error of mine :-(.
i made the change then got this error code.

TypeError: Error #1006: addEventlistener is not a function.
at buttonnotworking1_fla::MainTimeline/frame1()

The button now just stays black with text on top - no red bar under text.

How can i fix this please ?


Return to posts index


Steve Brame
Re: Stop(); not working, is my code correct ?
on Nov 21, 2010 at 3:56:03 pm

The error message is telling you exactly what the error is.

"addEventlistener" is not the same as "addEventListener".

Steve Brame
creative illusions Productions


Return to posts index

Steve George
Re: Stop(); not working, is my code correct ?
on Nov 21, 2010 at 9:13:41 pm

Thanks very much for your quick reply.

One more thing i am stuck on.

I have saved the button as a swf file and put it in my website. how do i add links to the swf files ? do i need to do it in flash or can i add in dreamweaver ?

Thanks in advance

Stevie


Return to posts index

Steve Brame
Re: Stop(); not working, is my code correct ?
on Nov 21, 2010 at 9:58:17 pm

Open both FLA's. Select the button symbol in the button FLA's library and copy it.

Switch to the main FLA, and paste. Should be that simple. Keep in mind that the newly pasted button in the main FLA will not have an instance name, so give it one.

Steve Brame
creative illusions Productions


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]