English 中文(简体)
Flash & external form fields
原标题:

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

问题回答

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.

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?

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();

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





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签