There is a common practice of sending text out from a SWF to JavaScript by
using
getURL("JavaScript:myfunction(\""+myVariable+"\"");
and it worked fine for Internet Explorer 5
but there's a strange
bug that shows up with Internet Explorer 6 if you use that and try to send
out a large string (anything over about 500 characters?). But it is very
possible, and not very difficult to send strings of a fairly significant
length out to
JavaScript from a SWF. Note that this method doesn't work
for Netscape 6.0 - 6.1 or ANY version of Internet Explorer on the Macintosh.
THE CODE
| //ActionScript.. goes on frame one of the main timeline smalltext = "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat"; // build the BIGstring by adding a lot of the smalltext strings together // when the button is pressed grab the value of the scrollable text
area and call |
// getText detects whether the client is Netscape or IE and then |
Grab the FLA (source) file here
last updated 03/20/2006 by mike lyda
- 8/25/2003 added the info about this not working on Netscape 6 and IE on Mac.
Thanks to S.Waters for bringing that to my attention.
- 3/20/2006 slight changes to get it working in firefox.. gosh this is old..
- 5/30/2006 -- note.. you could be using the Flash / JavaScript Integration Kit or maybe the new External Interface