# SWFAddress change Event Problem

**URL:** https://forum.kirupa.com/t/swfaddress-change-event-problem/308401
**Category:** flash
**Created:** [April 22, 2010, 9:49am UTC](https://forum.kirupa.com/t/swfaddress-change-event-problem/308401 "2010-04-22T09:49:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![LS05](https://avatars.discourse-cdn.com/v4/letter/l/e19b73/32.png) [@LS05](https://forum.kirupa.com/u/LS05)
#### Post date: [April 22, 2010, 9:49am UTC](https://forum.kirupa.com/t/swfaddress-change-event-problem/308401/1 "2010-04-22T09:49:40Z")

</div>

Hi guys,  
I’ve added the swfaddress library to my class for the changing of my website sections. I see the site in the browser but nothing change.  
I’ve debugged this class and i’ve seen that flash goes into the **addressChange** function but the fact is that nothing change in the browser address.  
Why? I must add something?  
Please Help me 😉

Here the code:

```auto
package
{
import flash.text.*;
import flash.display.*;
import flash.events.MouseEvent;
import flash.text.*;
import flash.utils.*;
import flash.net.*;
import com.greensock.*; 
import com.greensock.easing.*;
import com.asual.swfaddress.*;
import flash.events.*;
import flash.display.*;

public class Main extends MovieClip
{

    public var loaderBG:Loader = new Loader();
    public var urlRequest:URLRequest;
    public function Main()
    {
        stage.align = StageAlign.TOP_LEFT;
        stage.scaleMode = StageScaleMode.NO_SCALE;
        var strURL:String = "main.xml";
        mcmenu.x = mcmenu.width / 2;
        mcmenu.y = 43;
        mcmenu.company.buttonMode = true;
        stage.addEventListener(Event.RESIZE, sizeListener);
        full.addEventListener(MouseEvent.MOUSE_DOWN, Fullscreen);
        full.buttonMode = true;
        full.x = stage.stageWidth - 70;
        loadxml(strURL);
        
        
        / *********GESTIONE MENU************** /
        SWFAddress.addEventListener(SWFAddressEvent.CHANGE, addressChange);

        mcmenu.company.addEventListener (MouseEvent.CLICK, clickMenu);
    }

    private function addressChange(e:SWFAddressEvent):void
    {
        if(e.value != "/")
            SWFAddress.setTitle("Andra Lingerie - " + e.value.substring(1));
        else
            SWFAddress.setTitle("Andra Lingerie");
    }

    private function clickMenu(e:Event):void
    {
        var menuloader:Loader = new Loader();
        var menuReq:URLRequest;
        var b;
        if(e.target == mcmenu.company){
            SWFAddress.setValue("Company");
            menuReq = new URLRequest("company.swf");
            addChild(menuloader);
            menuloader.x = (stage.stageWidth / 2) - (674 / 2);
            menuloader.y = (stage.stageHeight / 2) - (410 / 2);
            menuloader.load(menuReq);
        }
    }

    private function Fullscreen(e:MouseEvent){
        stage.displayState = StageDisplayState.FULL_SCREEN;
    }
    
    private function loadxml(stringaURL:String):void{
        var loader:URLLoader = new URLLoader();
        loader.addEventListener(Event.COMPLETE, handleComplete);
        loader.load(new URLRequest(stringaURL));
    }
    private function handleComplete(e:Event):void{
        var myXML:XML = new XML(e.target.data);
        var myURL:String = myXML.sfondo;
        var sfondoURL:URLRequest = new URLRequest(myURL);
        trace(myXML);

        sfondo.addChild(loaderBG);
        sfondo.x = 0;
        sfondo.y = 0;
        loaderBG.load(sfondoURL);
        loaderBG.contentLoaderInfo.addEventListener(Event.COMPLETE, sfondoCompleto);
        loaderBG.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, sfondoCaricamento);
    }
    private function sfondoCaricamento(e:ProgressEvent){
        var perc:Number = e.bytesLoaded / e.bytesTotal;
        bar.width = Math.ceil(perc*100);
    }
    private function sfondoCompleto(e:Event){
        backgroundHandle();
    }
    
    private function backgroundHandle(){
        scaleProportional();
        centerPic();
    }
    
    private function scaleProportional():void {
        var picHeight = sfondo.height / sfondo.width;
        var picWidth = sfondo.width / sfondo.height;
        if ((stage.stageHeight / stage.stageWidth) < picHeight) {
            sfondo.width = stage.stageWidth;
            sfondo.height = picHeight * sfondo.width;
        } else {
            sfondo.height = stage.stageHeight;
            sfondo.width = picWidth * sfondo.height;
        }
    }

    private function centerPic():void {
        sfondo.x = 0;
        sfondo.y = 0;
    }
    
    private function sizeListener(e:Event){
        scaleProportional();
        centerPic();
    }

}
}

```
