TypeError: Error #1009: Cannot access a property or method of a null object reference.
Code of frame 41
line 9 boton2_btn.addEventListener(MouseEvent.MOUSE_DOWN, playSplitDuct);
On the time line i have alone on its layer i have the boton2_btn placed where I need it. It first appears on frame 15 with brightness to the max then i do a classic tween to end up with the button as i want it on frame 19. I have several buttons with that same arrangment none of them can be recognized by the code.
How can i make sure the buttons are instantiated correctly?
Could the tween have anything to do with problem?
Or is ther a problem if i have mc inside my button?
the best way is to avoid using timeline tweening.
but once you are in the middle of a project that may have a lot of timeline tweening you can work around the problem by removing that instance name (boton2_btn) from all the existing instances, then create a new layer above your button and, in the frame where your button first exists, add a keyframe (if that's not frame 1). drag a copy of your button to the stage, position it over your existing button and assign its name to boton2_btn and its alpha to 0.
if there are certain frames (possibly including the first) where you don't want boton2_btn to be clickable, use actionscript to assign its visible (or mouseEnabled) property to false. in frames where you want it to be clickable assign it visble (or mouseEnabled) property to be true.
Europe, Middle East and Africa