0
Javascript in flex application or alternative.
New Here
,
/t5/animate-discussions/javascript-in-flex-application-or-alternative/td-p/386167
Apr 22, 2008
Apr 22, 2008
Copy link to clipboard
Copied
Subject: Looking for java (or pseudo-java script) solution
I am hoping someone can help me develop a work around solution to read HTML within my Flex/Flash application.
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.
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. 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.
Is there a way to do this? I understand that much of the javascript is blocked, but is there a workaround solution that can accplish this? If it helps, I can work either in Flex 2 or Flex 3.
Thanks a lot.
I am hoping someone can help me develop a work around solution to read HTML within my Flex/Flash application.
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.
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. 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.
Is there a way to do this? I understand that much of the javascript is blocked, but is there a workaround solution that can accplish this? If it helps, I can work either in Flex 2 or Flex 3.
Thanks a lot.
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/javascript-in-flex-application-or-alternative/m-p/386168#M10852
Apr 22, 2008
Apr 22, 2008
Copy link to clipboard
Copied
you can use the externalinterface class to commuicate between
flex and javascript.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
CoderAmungus
AUTHOR
New Here
,
/t5/animate-discussions/javascript-in-flex-application-or-alternative/m-p/386169#M10853
Apr 22, 2008
Apr 22, 2008
Copy link to clipboard
Copied
While the externalinterface class provides the Flex
application funtionality with EXTERNAL javascript calls, is it
possible to call Javascript from WITHIN the Flex application. For
example, within the HTMLText of a TextArea. If not, is there a
workaround?
Thank You
Thank You
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/javascript-in-flex-application-or-alternative/m-p/386170#M10854
Apr 22, 2008
Apr 22, 2008
Copy link to clipboard
Copied
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."
> 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."
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
CoderAmungus
AUTHOR
New Here
,
LATEST
/t5/animate-discussions/javascript-in-flex-application-or-alternative/m-p/386171#M10855
Apr 22, 2008
Apr 22, 2008
Copy link to clipboard
Copied
You solved my problem. Thank You SO MUCH!!
-----------------------------------------------------------------------
<a href="event:param">click me</a>
myTextField.addEventListener(TextEvent.LINK, linkHandler);
function linkHandler(evt:TextEvent):void {
if (evt.text == "param") {
// do something
}
}
-----------------------------------------------------------------------
This was the solution I was looking for.
Thanks Again -CoderAmungus
-----------------------------------------------------------------------
<a href="event:param">click me</a>
myTextField.addEventListener(TextEvent.LINK, linkHandler);
function linkHandler(evt:TextEvent):void {
if (evt.text == "param") {
// do something
}
}
-----------------------------------------------------------------------
This was the solution I was looking for.
Thanks Again -CoderAmungus
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

