# AS2 \_root to AS3 root

**URL:** <https://forum.kirupa.com/t/as2--root-to-as3-root/277513>\
**Category:** flash\
**Created:** [December 12, 2008, 9:02pm UTC](https://forum.kirupa.com/t/as2--root-to-as3-root/277513 "2008-12-12T21:02:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaFranco](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@LaFranco](https://forum.kirupa.com/u/LaFranco)\
**Post date:** [December 12, 2008, 9:02pm UTC](https://forum.kirupa.com/t/as2--root-to-as3-root/277513/1 "2008-12-12T21:02:54Z")

</div>

Hello, im a having a few issues with root when i converted to AS3, what i need is when im on a certain page like services.html , i need the swf to go to a certain frame in the main timeline. Any ideas

```
							 								 								 															 								 									 										 										Attach Code 										 											

```

if (root.what\_page == “services”) {  
gotoAndPlay(“services”);  
}  
if (root\_mc.what\_page == “work”) {  
gotoAndPlay(“work”);  
}  
if (root\_mc.what\_page == “templates”) {  
gotoAndPlay(“templates”);  
}  
if (root\_mc.what\_page == “contact”) {  
gotoAndPlay(“contact”);  
}

var buttonA:Array = [home\_mc,services\_mc,work\_mc,temp1\_mc,contact\_mc];

for(var i:int=0;i\<buttonA.length;i++){  
buttonA\*.addEventListener(MouseEvent.ROLL\_OVER,rollOverF);  
buttonA\*.addEventListener(MouseEvent.ROLL\_OUT,rollOutF);  
buttonA\*.addEventListener(MouseEvent.CLICK,clickF);  
}

function rollOverF(e:MouseEvent){  
MovieClip(e.currentTarget).gotoAndPlay(“over”);  
}  
function rollOutF(e:MouseEvent){  
MovieClip(e.currentTarget).gotoAndPlay(“out”);  
}  
function clickF(e:MouseEvent){  
var mc:MovieClip = MovieClip(e.currentTarget);  
var linkS:String = mc.name.substring(0,mc.name.indexOf("\_"));  
navigateToURL(new URLRequest(linkS));  
}
