# SWF Address index page problem

**URL:** <https://forum.kirupa.com/t/swf-address-index-page-problem/296224>\
**Category:** flash\
**Created:** [September 11, 2009, 7:38am UTC](https://forum.kirupa.com/t/swf-address-index-page-problem/296224 "2009-09-11T07:38:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![goeiste](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/goeiste/32/2741_2.png) [@goeiste](https://forum.kirupa.com/u/goeiste)\
**Post date:** [September 11, 2009, 7:38am UTC](https://forum.kirupa.com/t/swf-address-index-page-problem/296224/1 "2009-09-11T07:38:43Z")

</div>

Hello,

For a new site I’m implementing swfaddress to enable deeplinking. Everything works fine when i test the movie in flash. However when I upload the file on the web, the content\_mc keeps returning to its first position (the content\_mc is a movieclip containing five pages on the timeline). Also the title in the title bar does noet change consistently.

The strange thing is that it works fine while playing the swf file itself.

The as3 code is:

```auto
import SWFAddress;
import SWFAddressEvent;

var pageTextArray:Array=new Array("Click a Button",
									"Button 1",
									"button 2",
									"button 3",
									"button 4");

function handleSWFAddressChange(event:SWFAddressEvent) {
	trace("SWF Address Value == "+SWFAddress.getValue());

	switch(SWFAddress.getValue()){
		case "/":
		title_txt.text=pageTextArray[0];
		SWFAddress.setTitle(" SWF Address Example: Home ");
		break;
	}
					//By using getValue() and a switch statement I am able to determine if 
					//the value is "/" and therefore at the main page
			
			
			
	switch(SWFAddress.getParameter("page")){
		case "page1":
			title_txt.text=pageTextArray[1];
			content_mc.gotoAndStop ("one");
			SWFAddress.setTitle(" SWF Address Example: Page 1 ");
		break;
				
		case "page2":
			title_txt.text=pageTextArray[2];
			content_mc.gotoAndStop ("two");
			SWFAddress.setTitle(" SWF Address Example: Page 2 ");
		break;
				
		case "page3":
			title_txt.text=pageTextArray[3];
			content_mc.gotoAndStop ("three");
			SWFAddress.setTitle(" SWF Address Example: Page 3 ");
		break;
				
		case "page4":
			title_txt.text=pageTextArray[4];
			content_mc.gotoAndStop ("four");
			SWFAddress.setTitle(" SWF Address Example: Page 4 ");
		break;
	}

}

function changePage(p:String):void{
	SWFAddress.setValue("?page="+p);
}

function handlePageOne(e:MouseEvent):void{
	changePage("page1");
}

function handlePageTwo(e:MouseEvent):void{
	changePage("page2");
}
		
function handlePageThree(e:MouseEvent):void{
	changePage("page3");
}
		
function handlePageFour(e:MouseEvent):void{
	changePage("page4");
}

SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleSWFAddressChange);
one_btn.addEventListener(MouseEvent.CLICK, handlePageOne);
two_btn.addEventListener(MouseEvent.CLICK, handlePageTwo);
three_btn.addEventListener(MouseEvent.CLICK, handlePageThree);
four_btn.addEventListener(MouseEvent.CLICK, handlePageFour);

stop ();

```

The code in my index file is:

```auto
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
	<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<script type="text/javascript" src="swfobject.js"></script>
		<script type="text/javascript" src="swffit.js"></script>
		<script type="text/javascript" src="swfaddress.js"></script>
		<script type="text/javascript">
			var flashvars = {};
			var params = {};
			var attributes = {};
			swfobject.embedSWF("swfAddressTest.swf", "altContent", "100%", "100%", "10.0.0", false, flashvars, params, attributes);
		</script>
	</head>
	<body>
		<div id="altContent">
			<a href="http://www.adobe.com/go/getflashplayer">
				<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
			</a>
		</div>
	</body>
</html>

```

I’ve uploaded the example on:  
[http://www.xs4all.nl/~karhen/swfaddress/](http://www.xs4all.nl/~karhen/swfaddress/)

Anybody got any ideas?
