Question about Flash and Javascript

I want to send a variable to javascript, then in the javascript for it to take that flash variable and then evalute it using an if statement. Can I use the loadvars command?

[COLOR=“red”][COLOR=“DarkOliveGreen”]import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;

// ----------------------------------------------------------------
// Assign a variable name for our URLVariables object
var variables:URLVariables = new URLVariables();
// Build the varSend variable
// Be sure you place the proper location reference to your PHP config file here
var varSend:URLRequest = new URLRequest([COLOR=“Red”]“Javascript.js”[/COLOR]);
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);

	variables.select = answer_txt.text;
	variables.sendRequest = "loaded";	
	
	varLoader.load(varSend);[/COLOR][/COLOR]

Once it sends the variable I want to insert it into an if statement in in the javascript file

[COLOR=“Blue”]// JavaScript Document

<script language=“JavaScript” type=“text/javascript”>
<!–
var SentVariable = “variable from Flash”;

if ( SentVariable = “loaded”) {
do something
}
//–>
</script>[/COLOR]