dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: TypeError: Error #1009: Cannot access a property or method of a null object reference

  1. #1
    Aky
    Join Date
    Dec 2008
    Posts
    3

    Unhappy TypeError: Error #1009: Cannot access a property or method of a null object reference

    Hey,
    Can anyone help me with this problem? I'm trying to make a little project for my studies, and i'm trying to create a little flash movie but I keep encountering a "TypeError: Error #1009".

    So far i've come across with no problems until the point I added a new Listner onto the actions, which is for a button. Once I run the movie I came across with this problem:

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

    Code:
    var currentColor:Number;
    
    goCP.addEventListener(MouseEvent.CLICK,goCpanel);
    btNext.addEventListener(MouseEvent.CLICK,goNextFrame);
    btPrev.addEventListener(MouseEvent.CLICK, goBack);
    changeColor.addEventListener(MouseEvent.CLICK, colorChange);
    go.addEventListener(MouseEvent.CLICK,go1);
    
    function go1(event:MouseEvent):void {
    gotoAndStop(1);
    } 
    
    
    function goCpanel(event:MouseEvent):void {
    gotoAndStop('cpanel');
    } 
    
    function goNextFrame(event:MouseEvent):void {
    nextFrame();
    } 
    
    function goBack(event:MouseEvent):void {
    prevFrame();
    } 
    
    function colorChange(event:MouseEvent):void {
    var colorTransform:ColorTransform = gal.transform.colorTransform;
    currentColor = cpColor.selectedColor
    colorTransform.color = currentColor;
    gal.transform.colorTransform = colorTransform;
    gotoAndStop(1);
    }

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Hex color codes need to be stored as uint types (not Number)...try changing:

    var currentColor:Number;

    to

    var currentColor:uint;

  3. #3
    Aky
    Join Date
    Dec 2008
    Posts
    3
    Nup still dont work!

    thanks for your effort though.

  4. #4
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Does the error give a line number?

  5. #5
    Aky
    Join Date
    Dec 2008
    Posts
    3
    No it doesn't, say's the same from before. Which is:

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


    :S

    the problem comes in as soon as i type this in:

    go.addEventListener(MouseEvent.CLICK,go1);

    function go1(event:MouseEvent):void {
    gotoAndStop(1);
    }


    code looks fine, but i don't think it an syntax error. I think i'm missing something out.

  6. #6
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    It would seem that "go" is null at that point. Run the debugger (ctrl-shift-enter). It should let you find the line with the error.

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