views:

51

answers:

4

Hey there...

Does anybody know if this is possible?

I am trying to create a flash movie that will show / preview what I am typing into a field in a normal HTML form. The call to update the flash movie would most likely be attached to an onKeyUp event.

Any advice or tutorials would be great

cheers! Decbrad

+1  A: 

Assuming you're using actionscript 3....

Check this out

You can also check this link out (its for Flex 3 though... AS3 should be similar for flash I believe)... I've used ExternalInterface in my Flex projects before.

Chris Klepeis
This just allows parameters to be passed into flash as it loads, it only happens as it loads. I don't think flash checks them again after it loads so you wouldn't be able to change them with javascript in response to an event.
MalphasWats
In my flex link you can do it based on a timer in flash... I'm more of a flex developer but I'm pretty sure you can do the same thing in plain ole flash
Chris Klepeis
... but yes, the client side won't be able to tell the flash when to update its info (as far as i know)
Chris Klepeis
the ExternalInterface thing looks interesting (was that link there when I commented?). I imagine it's a little sluggish though!
MalphasWats
A: 

As far as I'm aware, Flashplayer only listens to key events when it has focus (which it wouldn't have if you're typing into an HTML form. I'm not aware of any way to inject events into Flash with javascript.

Is there a particular reason why you can't use a text area in the actual flash movie itself?

MalphasWats
A: 

My advise would be to grab your favorite event utility for JavaScript and then pair it with ExternalInterface. That way, you can add a callback to the EI in Flash which would mean that you could do something like this:

ExternalInterface.addCallback( "keyboardClicked", dispatcherFunc );

function dispatcherFunc():void
{
    dispatchEvent( new Event( "javaScriptKeyClick" ) );
}


document.getElementById( "mySwf" ).keyboadClicked();
Christopher W. Allen-Poole
A: 

Hey guys, thanks for pointing me in the right direction! I haven't touched flash since version 4 so to say that i'm rusty... is an understatement!

The reason I haven't built the text area in the actual flash movie is because the system is 95% complete now and there's a lot of smarts on the server side. The flash preview is more or less the icing, as they say! Bit surprised there's not more of a hook into Flash.

Thanks again! Dec

Decbrad