Jump to content
Sign in to follow this  
divinedesigns1

Question About AS3.0

Recommended Posts

hey sup guys, i have a quick question, isnt it possible to link a button inside of a movieclip using this script

btn1.addEventListener(MouseEvent.CLICK, button1);function button1(event:MouseEvent):void{gotoAndStop(1);}

or do i have to do something else to get that button to work inside of the movieclip?

Share this post


Link to post
Share on other sites

The code is generally fine, assuming btn1 is set to the correct object. gotoAndStop may need a different scope depending on what you're trying to do.

Share this post


Link to post
Share on other sites

pretty much what im trying to do is, link btn1 which is in a model movie then in another movie, and when you click on btn1 it takes you to another frame which pulls up a page of some kind, but for some reason that doesnt work

Share this post


Link to post
Share on other sites

Unless that code is running in the scope of the movie that you want to advance then you'll need to tell it which movie you want to control. You should also add some trace statements there to make sure it is calling that function when the button is clicked if you haven't done that.

Share this post


Link to post
Share on other sites

ok thanks, ill try that now

Share this post


Link to post
Share on other sites

ok, i did

btn1.addEventListener(MouseEvent.CLICK, button1);function Object(this).mymovie.btn_mc.btn1(MouseEvent){gotoAndStop(20);}

and it didnt work pssssh, can you tell me what im doing wrong?

Share this post


Link to post
Share on other sites

ok so i got the links working but now im getting this error TypeError: Error #1010: A term is undefined and has no properties. at office2_fla::mymovie_1/frame1() problem here is i dont have any movie that is named mymovie_1 on frame1, but i have a movie called mymovie on frame1 thohow do i fix this error?

Share this post


Link to post
Share on other sites

the output is generating the error, and im not using mymovie_1 im using mymovie, and imma have to look at it later today to see sup with it

Share this post


Link to post
Share on other sites

this is the code that is causing the output error

import flash.events.MouseEvent;cable_mc.cable_btn.addEventListener(MouseEvent.CLICK, cable_btn);function cable_btn(event:MouseEvent){gotoAndStop("20")}access_mc.access_btn.addEventListener(MouseEvent.CLICK, access_btn);function access_btn(event:MouseEvent){gotoAndStop("10")}access2_mc.access2_btn.addEventListener(MouseEvent.CLICK,access2_btn);function access2_btn(event:MouseEvent){gotoAndStop("17")}cctv_mc.cctv_btn.addEventListener(MouseEvent.CLICK, cctv_btn);function cctv_btn(event:MouseEvent){gotoAndStop("14")}snom_mc.snom_btn.addEventListener(MouseEvent.CLICK, snom_btn);function snom_btn(event:MouseEvent){gotoAndStop("5")}office_mc.office_btn.addEventListener(MouseEvent.CLICK, office_btn);function office_btn(event:MouseEvent){gotoAndStop("1")}

im not sure why thats happening, but its messing up the rotation of the model

Share this post


Link to post
Share on other sites

i found the problem, the problem was with this piece of code

access2_mc.access2_btn.addEventListener(MouseEvent.CLICK,access2_btn);function access2_btn(event:MouseEvent){gotoAndStop("17")}

for some reason its doesnt acknowledge that, that button have an instense name

Share this post


Link to post
Share on other sites

I would recommend against using the same function names that you're using for instance names.

Share this post


Link to post
Share on other sites

yea i change it to something else and it worked perfectly, thanks thesci

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×