Flash variable to html javascript function

CS3 - AS2

I have a flash SWF that passes a variable as a parameter to a javascript function in my HTML page. Somehow I need to put that value of that parameter into a global variable I can use outside the html javascript function that actually receives it from the SWF function that passes it. Ultimately I will store that value in a hidden form field in the HTML so I can reuse it elsewhere.

Using an alert box, I can see my desired variable data is being passed by the AS2 function but I can’t figure out a way to access it from outside the javascript function.

Here’s a screen print of the alert and what I see when I try to reference it outside the function. Here is a link to a screen pic that demonstrates that

This is a code snippet that starts with the javascript function that receives the variable. YES, I know the"mailLink = str" is not valid. It just demonstrates how off the mark I am.

<script language="JavaScript" type="text/javascript">
    var mailLink = null;
    function callJavascript(str) {
        alert(str);
        mailLink = str;
        return
    }
</script>    
        <form name="mailIt" method="POST" action="sendvm.php" enctype="multipart/form-data">
        <p>    User <label>ID:</label><!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="4" i-maximum-length="4" --><input type="text" name="acct" size="4" tabindex="1" maxlength="4">
        <label>&nbsp;Sender:</label><input type="text" name="sname" size="30" tabindex="2"> <label>Recipient:</label><input type="text"name="rname" size="30" tabindex="4"></p>    
        <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Email&nbsp; &nbsp;:</label><input type="text"name="semail" size="30" tabindex="3"><label> Email&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</label><input type="text" name="remail" size="30" tabindex="5"><br>
    <p>    <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Message:</label><textarea rows="4" name="message" cols="60" tabindex="6"></textarea></p>
    <p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
        <input type="submit" value="Send" name="B1" tabindex="7">&nbsp;&nbsp;&nbsp;</p>
        <input type="hidden" name="dynamiclink" value="hidden">
    </form>
    <script language="JavaScript" type="text/javascript">
        document.mailIt.message.value = this.mailLink;
    </script>

I know there’s gotta be a way to do it but I also know I’m not smart enough to figure it out.

The issue I have is how to get the value of str into the global variable. That’s my road block.

What’s going on is the SWF is creating a file name for a video recording when it loads. I need to send that file name back to a form in my HTML page so it can be Emailed or used in an IM program.

I’ll be adding a checkbox to turn the camera feed off for those that just want and audio message and I’m working on passing a message with an http link to their video to yahoo, msn, and googletalk for videos created on this page.

My goal is to consolidate 4 web pages into 1 SIMPLE to use page. I currently have audio recorder and player pages as well as video recorder and player pages. When done I’ll have 1 page that’s a no brainer and creates substantially better quality videos on the fly than my old videorecording.swf

Regards - Jimb