CoderAmungus,
> Subject: Looking for java (or pseudo-java script)
solution
It's important not to confuse Java with JavaScript. They're
thoroughly
different languages, one of which requires a virtual machine
(Java), and the
other of which requires a host environment (usually a
browser) that supports
a JavaScript engine. Neither of these work within the Flash
Player plug-in
alone. The Adobe Integrated Runtime (AIR) supports
JavaScript, but it
doesn't sound like you're talking about an AIR application
here.
> I am hoping someone can help me develop a work around
> solution to read HTML within my Flex/Flash application.
I'll try. :)
> I have created a window within Flex that contains HTML
text. I
> want my users to be able to click anywhere on the text
and in turn,
> I want the Flex application to access the embedded
hypertext.
In bare-bones ActionScript, that can be handled with the
TextField.LINK
event. (I do use Flex Builder from time to time, but I'm not
especially
familiar with the Flex framework, so there may be other
avenues in the API
to handling hypertext clicks.)
> Maybe I should say that I need the script to work on the
client side
> and that I do not want to open a new window.
Sounds fine, so far.
> Instead I want to be able to embed values in the HTML
and then
> when the student clicks on the hypertext, this value is
made available
> to Flex.
Again, in AS3 alone, that's the TextField.LINK event.
e.g.
myTextField.addEventListener(TextEvent.LINK, linkHandler);
function linkHandler(evt:TextEvent):void {
// handle hyperlink click here
}
> I understand that much of the javascript is blocked, but
is there a
> workaround solution that can accplish this?
This is the part of your question that confuses me. Do these
hyperlinks
normally trigger JavaScript? Is this HTML content something
created
specifically for display in Flash Player? You needn't use
JavaScript at all
to be of use in ActionScript. Just use an "event" value in
your anchor tag:
<a href="event:param">click me</a>
myTextField.addEventListener(TextEvent.LINK, linkHandler);
function linkHandler(evt:TextEvent):void {
if (evt.text == "param") {
// do something
}
}
Does that make sense?
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design."