Interacting with actionscript 3.0 using javascript - Stack Overflow

As the title says... I'm trying to interact with my flash movie's actionscript via javascript

As the title says... I'm trying to interact with my flash movie's actionscript via javascript. Specifically I'm trying to send text to my flash movie. I've e across a couple sites that had some walkthroughs but I for the life of me could not get them to work.

From the adobe site. .do?externalId=tn_15683&sliceId=1

the really cool thing about that is their source file download link is dead. and ing across another post:

/

The download works... except the fla file is blank and running the html page you can receive text from the flash movie... but you can't send text from html to the flash movie.

I followed the steps pretty closely, can anybody see anything wrong w/ the instructions on the adobe site? And if ANYBODY can reeeeeally help me out, could you post a source example of this functionality? Thanks everybody for your time!

As the title says... I'm trying to interact with my flash movie's actionscript via javascript. Specifically I'm trying to send text to my flash movie. I've e across a couple sites that had some walkthroughs but I for the life of me could not get them to work.

From the adobe site. http://kb.adobe./selfservice/viewContent.do?externalId=tn_15683&sliceId=1

the really cool thing about that is their source file download link is dead. and ing across another post:

http://www.jesuscarrera.info/2009/01/05/munication-between-actionscript-3-and-javascript/

The download works... except the fla file is blank and running the html page you can receive text from the flash movie... but you can't send text from html to the flash movie.

I followed the steps pretty closely, can anybody see anything wrong w/ the instructions on the adobe site? And if ANYBODY can reeeeeally help me out, could you post a source example of this functionality? Thanks everybody for your time!

Share Improve this question edited May 21, 2013 at 6:33 justnajm 4,5346 gold badges38 silver badges56 bronze badges asked Jan 20, 2009 at 5:56 user56963user56963 691 gold badge2 silver badges11 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

The example you posted uses the ExternalInterface class to municate from Flash to Javascript. You can add callbacks using the ExternalInterface but if you need to trigger a function from the DOM (HTML) that goes to FLASH.

OK, now to get values from Javascript to Flash there are a few options.
You can set up a callback function using the ExternalInterface Class. Here is an example from Live Docs link text

If you need to call the Flash from Javascript without ANY Flash interaction (like to play a video or something), again you will use the ExternalInterface. Here is an AS3 example link text

Here is an AS2 example to answer your question:

//AS2
import flash.external.*;
function helloWorld():Void
{
    //Do something
}
ExternalInterface.addCallback("myFunction", helloWorld);

// HTML
<script language="JavaScript">

    flashObject.myFunction();
</ script>
...
<object id="flashObject"...>
    ...
    <embed name="flashObject".../>
</object>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745476021a4629350.html

相关推荐

  • Interacting with actionscript 3.0 using javascript - Stack Overflow

    As the title says... I'm trying to interact with my flash movie's actionscript via javascript

    4小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信