Actionscript 3
- Started
- Last post
- 11 Responses
- CFish
I am having a problem with a simple button action. My buttons arwe inside a tween and have the following action on the first frame of the tween:
home_btn.onRelease = function () {
gotoAndPlay(_parent.home);
}
gallery_btn.onRelease = function (){
gotoAndPlay(_parent.gallery);
}
faq_btn.onRelease = function (){
gotoAndPlay(_parent.faq);
}I have frame labels set up on the parent/main timeline – home, gallery and faq.
Does anyone know why this code does not work?
Also my fullscreen flv component doesn't seem to work although it did yesterday!
- gabriel20
Not sure if this is still the case but I thought you couldn't use a variable as the label name in a call to gotoAndPlay(). you had to use a string gotoAndPlay("thisFrame")
- joyride0
is home_btn on frame 1 of the tweened mc? or at the end of the tween?
i'm thinking you're setting the onRelease function to an object that does not exist yet, might want to move the code.
also, use trace() it's your friend when trying to solve a lot of these types of problems
- joyride0
yeah, use _parent.gotoAndPlay("home")
- CFish0
Still no luck... Yeah my actions and buttons are on frame 1 of a tween animation that is sat on the main time line where the labels are...
- maximillion_0
have you put traces in yr button funtions and do they fire off when you click the button?
- CFish0
What have i got to do with 'traces' and what is the syntax...
- maximillion_0
try this:
home_btn.onRelease = function () {
trace("this btn works - the problem is now with goto and play code");
gotoAndPlay(_parent. home);
}if you see the trac in the output panel the problem is with yr gotoAndPlay code, if you see nothing its with the button code
let us know how you get on
- CFish0
Still nothing...
- joyride0
did you name the button home_btn? if the button, that as is on the same frame and in the same timelime that trace should work.
- Gucci0
i thought you couldn't use functions to call button actions anymore.
I always got an error when my i tried to do that with my movieclip. It told me I needed to do something I'd never heard of before.
I hate as3.
- bcline0
i thought you couldn't use functions to call button actions anymore.
I always got an error when my i tried to do that with my movieclip. It told me I needed to do something I'd never heard of before.
I hate as3.
Gucci
(Jun 1 07, 07:57)that looks like AS 2 syntax to me