Solve the Problem of stable value transfer for js and

Source: Internet
Author: User

However, when Javascript is used to transmit values to flash, there is a probability that flash will obtain the values, sometimes it can be obtained, and sometimes it cannot be obtained. Later, it was discovered that it was actually because of <object...> </object> the corresponding flash is not loaded. In js, The ExternalInterface in flash is called. addCallback () is enabled, so that when flash has not obtained the value, it starts to play music. At this time, of course, it cannot play. To ensure normal value transfer, the value must be passed only after flash is loaded. But how can this problem be determined? In fact, you only need to use flash open js interface PercentLoaded. The details are as follows:
Js Code
Copy codeThe Code is as follows:
Var checkFlashLoaded = setInterval (function (){
If (flash. PercentLoaded = 100 ){
Flash. setBGMusic ("bkmusicloud ");
ClearInterval (checkFlashLoaded );
}
}, 10 );
Var checkFlashLoaded = setInterval (function (){
If (flash. PercentLoaded = 100 ){
Flash. setBGMusic ("bkmusicloud ");
ClearInterval (checkFlashLoaded );
}
}, 10 );

You can determine whether the flash load is complete by checking whether the PercentLoaded is 100%. If not, you can listen until the flash load is complete.
Pass the value again to ensure that the value is successfully transferred.

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.