0
votes

I've been searching for a solution to my problem for hours now but I can't find one. My problem is that I have some buttons inside a MovieClip and I want to control them from the Main timeline. But here's the weird part. The button I have in the first frame in the MovieClip works just fine, but the other two buttons, which is in frame 2 and 3, wont work when I click on them and I get this error message because of the buttons:

TypeError: Error #1009: Cannot access a property or method of a null object reference. at Eksamen_fla::MainTimeline/frame1()

Thank you!

1
What do the buttons do? Can you give some code?puggsoy
The buttons job is to push a value into an array, summing up values in an another array I've made, and also go to the next frame and previous frame. Here is the code: mc.btn1.addEventListener(MouseEvent.CLICK, btn1Action); function btn1Action (evt:MouseEvent) { regUt.push(mc.txt1.text); point.push(int(mc.txt2.text) + int(mc.txt3.text) + int(mc.txt3.text)); mc.nextFrame(); } mc.btn2.addEventListener(MouseEvent.CLICK, btn2Action); function btn2Action(evt:MouseEvent) { mc.prevFrame(); } The code is outside the MovieClip and in the Main timeline in frame 1. Maybe that's the problem?user2201775
Well it doesn't matter what the buttons do, because even there's nothing in the button's function, I will still get the error message I typed above :/user2201775
I think I see the issue now. You're trying to access buttons that are on other frames than the first, but from the main timeline. I don't have much experience with coding on the timeline, but I don't think this is possible. This page seems to talk about a similar issue, maybe it'll help: board.flashkit.com/board/…puggsoy
Thanks for your help! Now I finally understand whats the problem! :Duser2201775

1 Answers

0
votes

Okay, your problem might be on your timeline. Try to place each button on a single keyframe. Then use yourMovieClip.visible = true or false to hide/show your movieclips on different frames.