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?


// ----------------------------------------------------------------
// 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; = variables;
// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler); = answer_txt.text;
	variables.sendRequest = "loaded";	

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