Flash tutorials | Flash vs Javascript

11 articles about  communication between JavaScript and Adobe Flash

1.Passing varibles to Flash via FlashVars

I have to look this up all the time because I can never remember the syntax for using FlashVars in the various ways one embeds a SWF in an HTML file.

FlashVars is a way to pass data from the HTML containing page. You can

8-28-2008 2-17-14 PM

Read more

2.Tutorial Send Information to Flash with JavaScript

The aim of the tutorial is to learn how to send any information to Flash with JavaScript. This info could be a variable or a text message. There are two examples in this tutorial. One sends a text message and the other a variable. For those unfamiliar with programming: a variable is something that “varies”. It could be anything you want.

In the example below it is the width of the car:

Read more

3.Tutorial: Interaction between AS3 and JavaScript (video)

Controlling ActionScript 3.0 via JavaScript and JavaScript via ActionScript 3.0. Easier than expected!

as3-tutorial-10

Read more | Source

4.Actionscript calls Javascript - ExternalInterface class of Flash CS3

We often encounter the need to open a popup from Flash.
In this article, we will see how to do it, using an HTML file containing an image opened as a popup from Flash with Actionscript 3.0 and JavaScript.
Obviously, the user will need to have JavaScript and popup enabled on his browser for this to function.
Besides, we will see how to open different popup linking Actionscript and JavaScript.
Let us look at the examples”

8-28-2008 2-30-30 PM

Read more

5.AS3: Use HTML and JavaScript to send Text to Flash

This is the first of two ways to send Text to Flash using HTML and JavaScript. To follow my example, you must download and link to SWFObject http://blog.deconcept.com/swfobject/

Read more

6.Passing variable from JavaScript To AS3 (Flash CS3)

Passing vars from JS to AS3 is really easy, but it’s not as easy as it was with AS2.
Here I use the excellent SWFObjects (I use it in all my web projects now) to pass variables to the Flash Player

Read more

7.AS3 Javascript Call Sequencer + Omniture + Google Analytics

Here’s a little utility that I did for multiple Omniture calls to a javascript in the html page. It will also accept another call, such as an iFrame refresh. It delays each call a tiny bit to make sure that events are fired off. Also has a runtime environment detection so your browser window doesnt keep popping up during publishing. Source file below as well.

Read more

8.Bi-Directional Actionscript/Javascript Communication in AS3

Bi-directional Actionscript/Javascript communication is something that has been out for a while, but some Flash designers/developers still are saying, “I didn’t know you could do that.”

Well you can! And with just a little bit of code.

In the bad old days of AS2, Actionscript-to-Javascript was handled using fscomand(). In my experience with fscommand(), there were a lot of browser issues and its functionality was much more limited. Now, in AS3, we have a fully functional API that uses the ExternalInterface class.

8-28-2008 2-37-52 PM

9.JavaScript and VBScript Injection in ActionScript 3

In AS3 Script Injection, complete and unmodified JavaScript and/or VBScript functions, class objects and applications are stored inside AS3 files using XML, and are then parsed, sent to the browser, and executed, allowing Flash and Flex developers to create a robust browser experience without the need to rely on server-side support scripts.

This tutorial will show how to inject and execute complete JavaScripts and VBScripts into a webpage through ActionScript 3’s ExternalInterface Class. In addition, we will show how to store and modify complete JavaScript and VBScript scripts directly within AS3 sourcecode, where they may be safely kept until needed. Most of the techniques here may also be applied to AS2 applications with some minor modifications (which will be discussed).

Read more

10.Calling Flash AS3 functions from Javascript

Well, I spent all day figuring this one out, so I thought I would share it for everyone to learn from my mistakes. Basically, for this I used Adobe’s ExternalInterface about which Adobe says in the documentation “Adobe recommends using ExternalInterface for all JavaScript-ActionScript communication.” So once I saw that, I knew it had to be possible. Ok, enough with the intro, here’s my code. I will explain below.

Read more

11.Communication 1 (AS3)

Here is the ZIP file. This file shows various ways for Flash to communicate. This includes:

  • navigateToURL to load a Web Page from Flash
  • SharedObject to save a Flash “cookie”
  • FlashVars & SWF Query String to pass variables into Flash
  • ExternalInterface (replacing setVariable) to call a function in Flash from JavaScript
  • Loading a SWF with Loader and URLRequest to load a SWF file into Flash
  • FileReference to upload a local file to be used by flash

and does not include (see Communication 2 and XML in Flash links at top):

  • URLLoader and URLVariables to retrieve text or server output
  • XML to send and receive XML
  • Web Services to connect to scripts on other servers
  • Remoting to avoid serializing and deserializing data

8-28-2008 2-52-45 PM

Read more

Share/Save/Bookmark