Javascript VS FScommand to communicate with IE

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1825
  • Loc: In the Great White North

Post 3+ Months Ago

Anyone know if Flash/Browser communication issues still exist when using javascript and IE?

fscommand +VB script is being recommended as more reliable for IE instead of

Code: [ Select ]

Is this still an issue with newer versions of IE?
  • joebert
  • Genius
  • Genius
  • User avatar
  • Posts: 13511
  • Loc: Florida

Post 3+ Months Ago

In newer versions of Flash there's the ExternalInterface class to handle communications with the movies container.
It has been alot easier to work with than FSCommand ever was & I've not had any issues with it working on the latest versions of browsers.

There's two very usefull methods of the ExternalInterface class.
1) call
2) addCallback makes it easy to call a javascript method from flash.
ExternalInterface.addCallback makes it easy to call a flash method from javascript.

I use both of the methods here to do a couple of things.

One of them being sync the current theme color between the HTML & the SWF header.
The other being accessing the browsers address bar to make videos bookmarkable.

You can take a look at the javascript to see how that part works.
The part you don't see, that works in the header animation is this.
Code: [ Select ]
import flash.external.ExternalInterface;

// Declare
var themeColor:Number = 0x00ff00;
var _ ="readCookie", "themecolor");
if(_ != null){
    if(_ == "color-blue"){themeColor = 0x0000ff;}
    else if(_ == "color-red"){themeColor = 0xff0000;}
    else if(_ == "color-pink"){themeColor = 0xff00ff;}
    else if(_ == "color-yellow"){themeColor = 0xffff00;}

// ...

ExternalInterface.addCallback("swfSetTheme", this, scan);
  1. import flash.external.ExternalInterface;
  2. // Declare
  3. var themeColor:Number = 0x00ff00;
  4. var _ ="readCookie", "themecolor");
  5. if(_ != null){
  6.     if(_ == "color-blue"){themeColor = 0x0000ff;}
  7.     else if(_ == "color-red"){themeColor = 0xff0000;}
  8.     else if(_ == "color-pink"){themeColor = 0xff00ff;}
  9.     else if(_ == "color-yellow"){themeColor = 0xffff00;}
  10. }
  11. // ...
  12. ExternalInterface.addCallback("swfSetTheme", this, scan);

The code for the video bookmarking is similar.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 7 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.