One thing that's a little different in Flex is that you don't
call scripts inline like you can in Flash frame scripts. So
everything's going to be in a function. I'll attach a rough attempt
at doing what you're doing below. The other thing is if you're just
getting started, one thing that can through you is getting the
localhost to work. I'll assume you have that working so you see "
http://localhost...." in the
browser URL, not file://.. Finally, because I don't have time (or
maybe want to take time) to test the code below, I just refer to a
file called sample.txt in the same localhost folder as your
bin-debug output on the IIS (or whatever) server so we don't get
into any cross-domain issues.