dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Button not responding with AS

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    8

    Button not responding with AS

    Trying to get my button to go to a particular frame in my timeline with this code:

    festive_btn.addEventListener(MouseEvent.CLICK, goback);

    function goback(event:MouseEvent):void{

    gotoAndPlay("return_normal");

    }



    But I keep getting this error message in the output:

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

    Have used the same code earlier in my timeline on a different button and it worked fine.

  2. #2
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    Are you sure the button you're trying to target has the same instance name as the one you're using?
    Also, if you're tweening the button, you will have to give it that same instance name on each keyframe it appears on, because the script will not find it otherwise..
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  3. #3
    Junior Member
    Join Date
    Aug 2009
    Posts
    8
    yep button has exactly the same instance name and the instance name appears throughout the tween. I honestly cant think what it could be??

  4. #4
    Junior Member
    Join Date
    Aug 2009
    Posts
    8
    Ok have figured it out. Basically i had to put my AScode in the frame after my button appears....
    Last edited by gwardle; 08-21-2009 at 10:12 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center