# CS3 Error #1009 when trying to use swf address in a document class

**URL:** <https://forum.kirupa.com/t/cs3-error-1009-when-trying-to-use-swf-address-in-a-document-class/268821>\
**Category:** Uncategorized\
**Created:** [August 19, 2008, 11:43am UTC](https://forum.kirupa.com/t/cs3-error-1009-when-trying-to-use-swf-address-in-a-document-class/268821 "2008-08-19T11:43:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![widecircle](https://avatars.discourse-cdn.com/v4/letter/w/ea5d25/32.png) [@widecircle](https://forum.kirupa.com/u/widecircle)\
**Post date:** [August 19, 2008, 11:43am UTC](https://forum.kirupa.com/t/cs3-error-1009-when-trying-to-use-swf-address-in-a-document-class/268821/1 "2008-08-19T11:43:36Z")

</div>

I’m trying to have a document class using SWFAddress & gSkinners framescript manager class but keep getting SWFAddress errors…  
This is the error:  
TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at com.asual.swfaddress::SWFAddress$/::\_getValue()  
at com.asual.swfaddress::SWFAddress$/::\_check()  
at flash.utils::Timer/flash.utils:Timer::\_timerDispatch()  
at flash.utils::Timer/flash.utils:Timer::tick()

This is the documentclass code:

> ```
> package {
> 
> ```

```
import flash.events.*;
import com.gskinner.utils.FrameScriptManager;
import flash.display.*;
import com.asual.swfaddress.*;  
import caurina.transitions.*;
import caurina.transitions.properties.*;
    
public class Website extends MovieClip {
        
// constructor:
    public function Website() {
        
        //FrameScript setup
        super();
        SWFAddress.addEventListener(SWFAddressEvent.CHANGE , handleSWFAddress);
        var fsm:FrameScriptManager = new 
                    FrameScriptManager(this);
        fsm.setFrameScript("$/",homeFunct);
        fsm.setFrameScript("$/about/",aboutFunct);
        fsm.setFrameScript("$/portfolio/",portfolioFunct);            
                    fsm.setFrameScript("$/contact/",contactFunct);
        
        
        
    }
    
// public getter/setters:

```

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// SWFAddress  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// Custom utilities  
public function replace(str, find, replace):String {  
return str.split(find).join(replace);  
}

```
    public function toTitleCase(str):String {  
    return str.substr(0,1).toUpperCase() + str.substr(1).toLowerCase();  
    }  
 
    public function formatTitle(addr):String {  
    if (addr.substr(addr.length - 1, 1) == '/') {  
    addr = addr.substr(0, addr.length - 1);  
    }  
    return 'Webbmall' + ((addr.length &gt; 0) ? ' / ' + toTitleCase(replace(addr.substr(1), '/', ' / ')) : '');  
    }
    
    // SWFAddress handling  
    public function btnClick(event:MouseEvent):void {  
    SWFAddress.setValue(event.target.link);  
    }  
     
    public function btnRollOver(event:MouseEvent):void {  
    SWFAddress.setStatus(event.target.link);  
    }  
     
    public function btnRollOut(event:MouseEvent):void {  
    SWFAddress.resetStatus();  
    }
    
    public function handleSWFAddress(event:SWFAddressEvent):void {  
    if (currentFrame == 2 && event.value == '') {  
    play();  
    } else {  
    gotoAndStop('$' + event.value);  
    if (currentLabel == null) {  
    gotoAndStop('$/error/');  
    }  
    }  
    SWFAddress.setTitle(formatTitle(event.value));  
    }  

// private methods, webbsidans olika sektioner:

```

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// Hem - home  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

```
    private function homeFunct():void {

```

// trace(“hem”);  
stop();

```
}    

```

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// About - Om oss  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

```
    private function aboutFunct():void {

```

// trace(“om oss”);  
//  
}

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// Portfolio  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// trace(“portfolio”);  
//  
}

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// Kontakt - contact  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
private function contactFunct():void {  
//trace(“kontakt”);

```
    }
    
    
}

```

}  
I would really appreciate some help with this one.  
I’ve read that it’s usually an issue of stage or root access but I’m not sure - still new to AS3.  
I also have some preload code on frame 1 in the movie:

> function enterFrame(e:Event){  
> var bl:int = loaderInfo.bytesLoaded;  
> var bt:int = loaderInfo.bytesTotal;  
> if (bl && bt && bl == bt) {  
> removeEventListener(Event.ENTER\_FRAME, enterFrame);  
> nextFrame();  
> } else if (loading\_mc.bar\_mc) {  
> loading\_mc.bar\_mc.scaleX = bl/bt;  
> }  
> }  
> addEventListener(Event.ENTER\_FRAME, enterFrame);  
> stop();  
> All the best, Niklas
