Papervision Menu Help / Advice Needed

Hi Guys, I am looking for some help creating a menu in Papervision. The project can be viewed here http://grayscale.wintertwilight.co.uk. It is kind of working but needs refinement, and that is the advice I am seeking. There are a couple of things that I need to do:

  1. Back button integration - when the user hits the back button currently the iFrame refreshes but the menu stays on the last selected item. Is there anyway of getting Flash to constantly poll the HTML to look for a variable and use that variable to set the position of the menu? Or if there are any other ways of doing this then I am open to suggestions

  2. kinda linked to 1) - The if the user refreshes the page, the menu refreshes to the default menu item but the iFrame obviously refreshes the current page being displayed.

I have a feeling that this may be a relatively simple fix but what do I know, I am pretty good with AS but this has me stumped at the moment and any suggestions would be much appreciated!

The actionscript used is as follows:

package
{
import flash.display.*;
import flash.display.stage.*;
import flash.events.*;
import flash.geom.ColorTransform;
import flash.utils.Dictionary;
//import this for URL requests
import flash.net.URLRequest;
import flash.net.navigateToURL;


// Import Papervision3D
import org.papervision3d.core.proto.*;
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;

public class main extends Sprite

{
	
	
	
	// ___________________________________________________________________ 3D vars

	private var container :Sprite;
	private var scene     :MovieScene3D;
	private var camera    :Camera3D;

	private var planeByContainer :Dictionary = new Dictionary();


	// ___________________________________________________________________ Album vars

	private var paperSize :Number = 0.9;
	private var cloudSize :Number = 200;
	private var rotSize   :Number = 360;
	private var maxAlbums :Number = 4;
	private var num       :Number = 0;
	private var radius    :Number = 500;
	private var anglePer  :Number = (Math.PI*2) / maxAlbums;


	// ___________________________________________________________________ stage

	public var myContent :MovieClip = new MovieClip();
	

	// ___________________________________________________________________ main

	public function main(){
		stage.quality = StageQuality.HIGH;

		init3D();

		addChild( myContent );
		this.addEventListener( Event.ENTER_FRAME, loop );
	}

	// ___________________________________________________________________ Init3D

	private function init3D():void{
		// Create container sprite and center it in the stage
		container = new Sprite();
		addChild( container );
		container.x = 368.5;
		container.y = 145;

		// Create scene
		scene = new MovieScene3D( container );

		// Create camera
		camera = new Camera3D();
		camera.zoom = 5;
		

		// Store camera properties
		camera.extra =
		{
			goPosition: new DisplayObject3D(),
			goTarget:   new DisplayObject3D()
		};

		camera.extra.goPosition.copyPosition( camera );
		
	}

	// ___________________________________________________________________ Create album

	private function createAlbum(){
		var material:MovieAssetMaterial = new MovieAssetMaterial( "Thumb" );

		material.doubleSided = true;
		material.lineColor = 0xFFFFFF;

		material.movie.gotoAndStop( num +1 );
		material.updateBitmap();

		var plane :Plane = new Plane( material, paperSize, 0, 4, 4 );

		// organise position
		var gotoData :DisplayObject3D = new DisplayObject3D();
		gotoData.x = Math.cos(num*anglePer) * radius;
		gotoData.z = Math.sin(num*anglePer) * radius;
		gotoData.rotationY = (-num*anglePer) * (180/Math.PI) + 270;

		plane.extra =
		{
			id: Number,
			goto: gotoData
		};
		plane.extra.id=num;
		// Include in scene
		scene.addChild( plane, "Thumb" + String( num ) );

		var container:Sprite = plane.container;
		container.buttonMode = true;
		container.addEventListener( MouseEvent.ROLL_OVER, doRollOver );
		container.addEventListener( MouseEvent.ROLL_OUT, doRollOut );
		container.addEventListener( MouseEvent.MOUSE_DOWN, doPress );
		planeByContainer[ container ] = plane;

		num++;
	}

	// ___________________________________________________________________ Button events

	private function doPress(event:Event):void{
		
		var plane:Plane = planeByContainer[ event.target ];
		plane.scaleX = 1;
		plane.scaleY = 1;
		
		var target :DisplayObject3D = new DisplayObject3D();
		target.copyTransform( plane );
		target.moveBackward( 350 );

		camera.extra.goPosition.copyPosition( target );
		camera.extra.goTarget.copyPosition( plane );

		plane.material.lineAlpha = 0;
	
		buttonName = plane.name;
		
		var url:String;
		
		switch(buttonName){
			
			case "10": url = "services/index.php";
			break;
			case "4": url = "contact/index.php";
			break;
			case "8": url = "portfolio/index.php";
			break;
			case "6": url = "preview/index.php";
			break;
			
		}
		
		var req:URLRequest = new URLRequest(url);
		
		navigateToURL(req,"page");
		
		trace(buttonName);
		
	};


	private function doRollOver(event:Event):void{
		var plane:Plane = planeByContainer[ event.target ];
		plane.scaleX = 1.02;
		plane.scaleY = 1.02;

		plane.material.lineAlpha = 1;
	};


	private function doRollOut(event:Event):void{
		var plane:Plane = planeByContainer[ event.target ];
		plane.scaleX = 1;
		plane.scaleY = 1;

		plane.material.lineAlpha = 0;
	};


	// ___________________________________________________________________ Loop

	private function loop(event:Event):void{
		if( num < maxAlbums )
			createAlbum();

		update3D();

	}


	private function update3D():void{
		var target     :DisplayObject3D = camera.target;
		var goPosition :DisplayObject3D = camera.extra.goPosition;
		var goTarget   :DisplayObject3D = camera.extra.goTarget;

		camera.x -= (camera.x - goPosition.x) /12;
		camera.y -= (camera.y - goPosition.y) /12;
		camera.z -= (camera.z - goPosition.z) /12;

		target.x -= (target.x - goTarget.x) /12;
		target.y -= (target.y - goTarget.y) /12;
		target.z -= (target.z - goTarget.z) /12;

		var paper :DisplayObject3D;

		for( var i:Number=0; paper = scene.getChildByName( "Thumb"+i ); i++ )
		{
			var goto :DisplayObject3D = paper.extra.goto;

			paper.x -= (paper.x - goto.x) / 12;
			paper.y -= (paper.y - goto.y) / 12;
			paper.z -= (paper.z - goto.z) / 12;

			paper.rotationX -= (paper.rotationX - goto.rotationX) /12;
			paper.rotationY -= (paper.rotationY - goto.rotationY) /12;
			paper.rotationZ -= (paper.rotationZ - goto.rotationZ) /12;
		}

		scene.renderCamera( this.camera );
	}


}
}

Thanks in advance!