FIguring out the Javascript/Flash integration kit has lead to a much simpler solution. Looks like Macromedia has slipped in another nugget of usefulness in the Flash 8 release which, I might add, has penetrated the market remarkably fast. It's called External Interface. I gotta thank Bobby for finding this one.

So forget the last post if you're a progressive designer like myself, marching to the Flash 8 bugle. Using the same example as before replace your Actionscript with the following.

import flash.external.ExternalInterface;

ExternalInterface.addCallback("moveBall", this, moveBall);

function moveBall (p_x:Number, p_y:Number):Void {
    ball_mc._x = p_x;
    ball_mc._y = p_y;
}

And then replace your javascript with the following.

function move_ball () {
    x = document.moveball.x.value;
    y = document.moveball.y.value;

    if (navigator.appName.indexOf("Microsoft") != -1) {
        window['ball'].moveBall(x, y);
    }
    else {
        document['ball'].moveBall(x, y);
    }
}

Thats it! Just make sure you name your flash file "ball" and you've set allowScriptAccess to all or sameDomain. Get rid of all the extraneous files from before too, you don't need them! View example or download.

Comments

Jeff Croft http://jeffcroft.com

Wow, that's remarkably simple.

Xian

Very nice! I'm definitely going to have to get playing with this once my Flash finally gets here.

Mel Hogan http://www.resolutionink.com/portfolio

Hey Nathan, I altered the code slightly so we could see a bit of animation (i had this question, so i answered it). Check it out:

import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.external.ExternalInterface;

ExternalInterface.addCallback("moveBall", this, moveBall);

function moveBall (p_x:Number, p_y:Number):Void {
var tween1 = new mx.transitions.Tween(ball_mc, "_x", Strong.easeOut, ball_mc._x, p_x, 1, true);
var tween2 = new mx.transitions.Tween(ball_mc, "_y", Strong.easeOut, ball_mc._y, p_y, 1, true);}
Nathan Borror http://www.playgroundblues.com

Nice Mel. I'm really excited about the possibilities with this type of integration.

cheap fake watches http://www.samewatches.net/

cartier tank watches VII through the British as "the emperor's jewelers, jeweler's Emperor", is internationally acknowledged as the most effective of France's most revolutionary jewellery and view manufacturers. The tank view inspired from the Renault tank initially appeared for the duration of Globe War I, rolex fake watches Lu Yika to Asia towards the remarkable creativeness of several components from their tanks to the view style and in 1919 the formal marketplace. Considering that the start from the initial time in almost a century, how to tell a fake rolex the tank may be nicely acquired by royalty and nobility view and superstar connoisseur's Reporter has discovered that Chinese tanks view tour within a 2005 Cartier "Tank notable family" view touring exhibition in mainland China once again following the countrywide tour online watch store fake Tag Heuer , opened in Shenyang final yr, the north towards the south has arrived in Harbin replicawatches rolex diamond watches , Tianjin,

juicy handbags http://www.usjuicycoutureoutlet.com/

juicy couture outlets has multiple facets, including athletic, casual, dressy and of course couture! Juicy Couture clothing also branches to include outerwear, swim wear, denim and even sleepwear for the serious Juicy Kids. Creating new classic pieces is what started Juicy Couture and they continue to push the limits of fashion each season with statement pieces. Juicy Couture Flip Flops also has a line of adorable children’s clothing for girls. Now mother and daughter can both enjoy the spirit of Juicy Couture Panties.