Flash + Javascript =

I have a small embedded flash widget that is doing some math and below it inside the HTML some regular text fields and a submit button all in a form.

I want that when a user hits SUBMIT to grab all the information in the page and send it to a DB. Besides the text in the text fields I would also like to grab some variables from the flash SWF.

Is there any way that with Javascript to go inside the SWF and grab a variable I need?
If not with Javascript how can I access a SWF?!
Thank you!