JavaScript calls the Flash object's method (function) for five hours.

Source: Internet
Author: User

After a few hours, I found out that the road was wrong.

There is a problem with testing a JavaScript method to call an object in Flash on a Firefox browser today.

I had a whole afternoon of doing it.

I remember not having had such a problem before when I used Flash8.

My program is like this, I used flash to create a menu, by default, when the page opens, the menu is hidden, when the mouse is placed on a small icon, the menu is displayed, and will be based on the current page data situation, display a few items in the menu, while hiding a few items do not need to display the menu.

I used externalinterface.addcallback in Flash to register a method called: setmenuitemvisible (B:boolean)

Intended to be called in JavaScript in a Web page.

But who knows the program to write well, in the Internet Explorer run all normal, but in Firefox always prompt error:

The Setmenuitemvisible () method cannot be called in JavaScript.

I began to search Baidu, looking for one hours later, finally found a paper:

Http://www.coolcode.cn/show-291-1.html

I have this piece of content in my Baidu space to collect a bit:
Http://hi.baidu.com/personnel/blog/item/8c04cd119effe919b8127b47.html

Originally because of browser reasons, if you do JavaScript on most browsers outside of IE call the function in Flash, generally in window.onload=function () {Load Flash}
Otherwise, some external functions that are registered in Flash cannot be called in JavaScript.

It was thought that the reason for this was found, but then came a very headache problem.

Because my flash is hidden first, after the JavaScript triggers the event, it only shows that I am using the

Flash.style.display= "None";
Flash.style.display= "";

When testing on Firefox found that when in this show and hide the two state of the transition, each flash will reload once, really faint!

Then to Baidu search a bit, found such an article, now I collected a bit:

Http://hi.baidu.com/personnel/blog/item/a8f40fb3025decaed8335a43.html

The flash code was eventually rewritten because the previous code was logically not a good idea on Firefox.

2009-08-12

JavaScript calls the Flash object's method (function) for five hours.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.