A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: stage Issue (error 1009)

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    1

    stage Issue (error 1009)

    Hey guys,

    Im new to flash and Im really going crazy by now. I watched some TUT (http://www.developphp.com/Flash_tuto...r_1.0_Tutorial) and tried to remake it in a new AS3 File. That worked out fine. My problem now is that I get an error once I want to put it into an existing flash page. I know there are plenty of posts and I have read for the past 6 hours threads about this error but didnt find anything what really helped me. As I mentioned in the beginning Im pretty new to flash so it might be missing knowledge...Anyway I would really appreciate if anyone of you could help me!

    Error message: TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at kkcb6_fla::scrollMC_17/scrollMyContent()[kkcb6_fla.scrollMC_17::frame1:7]
    at kkcb6_fla::scrollMC_17/frame1()[kkcb6_fla.scrollMC_17::frame1:36]

    Code:
    PHP Code:
    // Scroll My Content function - AS3
    function scrollMyContent () {
        
    // Cache the TextField as a bitmap to improve performance.
        
    content_mc.cacheAsBitmap true;
        
    // Event Listeners
        
    scrollDragger.addEventListener(MouseEvent.MOUSE_DOWNscrollDraggerPress);
        
    stage.addEventListener(MouseEvent.MOUSE_UP,mouseUpOnStage);
        
    // Set variables
        
    var scrollbarHeight:Number scrollbarBG.height;
        var 
    contentHeight:Number content_mc.height;
        var 
    scrollDraggerHeight:Number scrollDragger.height;
        var 
    maskHeight:Number contentMask.height;
        var 
    scrollAmout:Number = (contentHeight-maskHeight)/(scrollbarHeight-scrollDraggerHeight);
        var 
    topBound:Number scrollbarBG.y;
        var 
    bottomBound:Number scrollbarBG.height-scrollDraggerHeight+scrollbarBG.y;    
        var 
    startPos:Number content_mc.y;
        var 
    leftBound:Number scrollbarBG.x;
        var 
    absNumSet:Number 0;
        
        
    // When scrollDragger gets pressed we do this
        
    function scrollDraggerPress(event:MouseEvent):void 
            
    // Set bounds using some of the scroller BG properties claimed above
            
    var bounds:Rectangle = new Rectangle(leftBoundtopBound0bottomBound);
            
    scrollDragger.startDrag(falsebounds);
            
    stage.addEventListener(MouseEvent.MOUSE_MOVEreportStageMouse);
            function 
    reportStageMouse(event:MouseEvent):void {
                
    absNumSet Math.abs(scrollbarBG.scrollDragger.y);
                
    content_mc.Math.round(absNumSet * - scrollAmout startPos);
            }
        }
        
    // When mouse is released while dragging we do this
        
    function mouseUpOnStage(event:MouseEvent):void 
            
    stopDrag();
        }
    }
    scrollMyContent () 
    The Debugging Function tells me that its line 7 and 36 so the following:

    stage.addEventListener(MouseEvent.MOUSE_UP,mouseUp OnStage);

    and

    scrollMyContent ()

    Thanks in Advance!
    Last edited by S7evin; 08-28-2011 at 02:07 PM.

  2. #2
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    well this is a nutso listener you are saying when the stage is clicked and the mouse is released then execute a function called...mouseUp OnStage......i don't believe spaces are allowed in a function name to make it worse i don't even see a function named mouseUp OnStage or any function name close to it. is it in a movieclip? I use oop so i'm not real familar with timeline code but maybe the firs example will work.

    PHP Code:
    stage.addEventListener(MouseEvent.MOUSE_UP,mouseUp.OnStage); 
    PHP Code:
    bad----stage.addEventListener(MouseEvent.MOUSE_UP,mouseUp OnStage);
    good---stage.addEventListener(MouseEvent.MOUSE_UP,mouseUpOnStage,false,0,true); 
    ~calmchess~

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