ControlVR FAQ

Q : How do I load a new object into contolVR with a button?

A : First you need to give the controlVR component an instance name like myvr_mc and place the folowing script on the button.


on(release){

	myvr_mc.loadVR("http://www.mysite.com/objects/myobject.xml")

}

See also controlVR.loadVR()

Q : My component gives me a XML Error. How can I see what the Error was?

A : In the following example you will have to give your controlVR instance a name vr_mc and place the following code in the main timeline. The following code will generate a text field that will display any error that the vr_mc instance may generate.


vr_mc.onLoadError = function(error ,code){

	this.createTextField("error_txt",this.getNextHighestDepth(),1, 50, 200, 100);

	this.error_txt.multiline = true;

	this.error_txt.wordWrap = true;

	this.error_txt.border = true;

	this.error_txt.background = true;

	trace(error+code)

	if(error == "XMLLoadError"){

		this.error_txt.text += "sdfdfsgfd"+" : "+code+"\n";

	}

	if(error == "XMLParseError"){



		switch (code){

			case "-2" : this.error_txt.text += error+" A CDATA section was not properly terminated.\n";

				break;

			case "-3" : this.error_txt.text += error+" The XML declaration was not properly terminated.\n";

				break;

			case "-4" : this.error_txt.text += error+" The DOCTYPE declaration was not properly terminated.\n";

				break;

			case "-5" : this.error_txt.text += error+" A comment was not properly terminated.\n";

				break;

			case "-6" : this.error_txt.text += error+" An XML element was malformed.\n";

				break;

			case "-7" : this.error_txt.text += error+" Out of memory.\n";

				break;

			case "-8" : this.error_txt.text += error+" An attribute value was not properly terminated.\n";

				break;

			case "-9" : this.error_txt.text += error+" A start-tag was not matched with an end-tag.\n";

				break;

			case "-10" : this.error_txt.text += error+" An end-tag was encountered without a matching start-tag.\n";

				break;

		}

	}

	if(error == "URLNotFound"){

		this.error_txt.text = error+" : "+code+"\n";

	}

	if(error == "LoadNeverCompleted"){

		this.error_txt.text = error+" : "+code+"\n";

	}

	if(error == "VRObjectError"){

		switch (code){

			case "-2" : this.error_txt.text += error+" Not the same amount of images per layer.\n";

				break;

		}

	}

}