FORUMS: list search recent posts

Getting Flash and JavaScript to communicate

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Peter Cutler
Getting Flash and JavaScript to communicate
on Jun 11, 2012 at 6:39:04 pm

Hey folks, what are some effective methods for getting Flash to communicate with JavaScript? I have an animation where various different buttons/hit areas move around the screen. Clicking them triggers certain behaviors within the animation, but it also needs to trigger some external JavaScript behavior (a link/window being pulled up).

What kind of methods are there to achieve this? Most of my research so far points me to the GetURL function and the ExternalInterface class. How would I use these, or would there be another method?

Return to posts index

demetri tashie
Re: Getting Flash and JavaScript to communicate
on Jul 11, 2012 at 3:08:35 pm

sorry if this is no longer relevant. i have been away and am jsut seeing this post now.

ExternalInterface is a tried method for communicating from a flash swf to trigger javascript. it has been discussed here several times, with code and/or tutorial examples.

here is one link: **
a search will reveal others.

good luck!

** i would update the coding to this:

import flash.external.ExternalInterface;

myMC.addEventListener(MouseEvent.CLICK , myAS3function );
function myAS3function(evt:MouseEvent):void {"myJavaScriptFunction", 'second alert'); }

and the HTML code:

<script type="text/javascript">
function myJavaScriptFunction (message){
alert('this alert works !');

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved