Skip to main content
Inspiring
July 14, 2008
Question

Calling Javascript (k)

  • July 14, 2008
  • 5 replies
  • 518 views
I've done this(calling a Javascript function from Flash) before, but
haven't done it in a while.

I want to get this HTML code:
<a href="JavaScript:void(0)" onclick="ChangeState('link1')">Link 1</a>

to work in Flash. Here is where I am with it. I attached this
ActionScript to a button in Flash. On the HTML page the flash file
resides is the Javascript.

on (release) {
getURL("javascript:void(0)" and "ChangeState('link2')");
}

Any ideas?

-Kirk
This topic has been closed for replies.

5 replies

Inspiring
July 15, 2008
After searching the web for a while I discovered that the
getURL("javascript: method I'd used in the past is not secure.

There's a new method that I don't understand at all.

Has anyone successfully done any Javascript connection through Flash
since the April 2008 security update?

If so, how do you do it?

-Kirk





W. Kirk Lutz wrote:
> I just tried simpler javascript that I got right from the Adobe website:
>
> getURL("javascript:alert('you clicked me')");
>
>
> It doesn't work either. Any thoughts? This happens in Safari and Firefox 3
>
> -Kirk
>
>
>
> W. Kirk Lutz wrote:
>> That code should work. Any thoughts why it doesn't:
>>
>> on (release) {
>> getURL("javascript:ChangeState('link2')");
>> }
>>
>>
>> -Kirk
>>
>>
>> W. Kirk Lutz wrote:
>>> Your version didn't work(thanks, though).
>>>
>>> That technote is beyond my knowledge of ActionScript. It also appears
>>> to want Javascript to control Flash. I need Flash to control a
>>> Javascript Function.
>>>
>>> Any other ideas?
>>>
>>> -kirk
>>>
>>>
>>>
>>>
>>> Rob Dillon wrote:
>>>> You could use:
>>>> on (release) {
>>>> getURL("javascript:ChangeState('link2')");
>>>> }
>>>>
>>>> but read through this tech note on using ExternalInterface:
>>>> http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683
>>>>
robdillon
Participating Frequently
July 15, 2008
Take a look at this example: http://www.ddg-designs.com/downloads/callJSfunction.zip. This is a very simple example using ExternalInterface.
Inspiring
July 15, 2008
I just tried simpler javascript that I got right from the Adobe website:

getURL("javascript:alert('you clicked me')");


It doesn't work either. Any thoughts? This happens in Safari and Firefox 3

-Kirk



W. Kirk Lutz wrote:
> That code should work. Any thoughts why it doesn't:
>
> on (release) {
> getURL("javascript:ChangeState('link2')");
> }
>
>
> -Kirk
>
>
> W. Kirk Lutz wrote:
>> Your version didn't work(thanks, though).
>>
>> That technote is beyond my knowledge of ActionScript. It also appears
>> to want Javascript to control Flash. I need Flash to control a
>> Javascript Function.
>>
>> Any other ideas?
>>
>> -kirk
>>
>>
>>
>>
>> Rob Dillon wrote:
>>> You could use:
>>> on (release) {
>>> getURL("javascript:ChangeState('link2')");
>>> }
>>>
>>> but read through this tech note on using ExternalInterface:
>>> http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683
>>>
Inspiring
July 15, 2008
That code should work. Any thoughts why it doesn't:

on (release) {
getURL("javascript:ChangeState('link2')");
}


-Kirk


W. Kirk Lutz wrote:
> Your version didn't work(thanks, though).
>
> That technote is beyond my knowledge of ActionScript. It also appears to
> want Javascript to control Flash. I need Flash to control a Javascript
> Function.
>
> Any other ideas?
>
> -kirk
>
>
>
>
> Rob Dillon wrote:
>> You could use:
>> on (release) {
>> getURL("javascript:ChangeState('link2')");
>> }
>>
>> but read through this tech note on using ExternalInterface:
>> http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683
>>
Inspiring
July 15, 2008
Your version didn't work(thanks, though).

That technote is beyond my knowledge of ActionScript. It also appears to
want Javascript to control Flash. I need Flash to control a Javascript
Function.

Any other ideas?

-kirk




Rob Dillon wrote:
> You could use:
> on (release) {
> getURL("javascript:ChangeState('link2')");
> }
>
> but read through this tech note on using ExternalInterface:
> http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683
>
robdillon
Participating Frequently
July 14, 2008
You could use:
on (release) {
getURL("javascript:ChangeState('link2')");
}

but read through this tech note on using ExternalInterface: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683