Interaction between Flash, ASP, PHP, and Javascript

Source: Internet
Author: User
Alas, I was very nervous when I wrote an article for the first time. This is the result of checking the information on the Internet and my own research a few days ago. I hope it will be useful to some friends. The level is limited and there must be mistakes and omissions. I am very grateful to you for correcting them!
The following is the story:
Flash uses Javascript as the intermediary to interact with ASP/PHP
Our class has a record, which is popular. Some time ago, the administrator asked me to write an HTML-based player and put it on the class message. The requirement is simple, that is, loop playback. So I wrote one, which is relatively easy. It is nothing more than the interaction between Javascript Operations and ActiveX controls. I checked MSDN and decided to use the WMP ActiveX plug-in. After writing, the playback effect is always unsatisfactory. I do not know whether the Javascript I have written is faulty or the Javascript interface of WMP is faulty. Sometimes, it cannot be cyclically played. Later, I suddenly thought that Flash 7.0 can play mp3, so I started the design (I have never learned the system engineering, so it is not a standard, I hope I will not smile ):
1. Play mp3, basic playback control function (pause, continue, index, volume control, etc );
2. Current track loop and list track loop
1. Dynamically retrieve the music list from the database
2. Provides an interface for adding music URLs
Here, my idea is: User access ASP (PHP) page => ASP (PHP) request database => return dataset => ASP (PHP) write the dataset as a Javascript variable => javascrui write the dataset to the DynamicText variable in Flash using the Flash Interface function => Flash displays the list
In this case, the number of file lists is variable. How can I set several variables in Flash? My solution is (it may not be a good solution, but it is very simple. If you have a better method, please don't hesitate to ask, thank you): set two variables in Flash, one is to save the file name varSongname and the other is to save the URL varUrl. The form is generated on the Server side (the English quotation marks in this article are automatically replaced with Chinese quotation marks, please note ):
Var strSongname = "Songname1, Songname2, Songname3";
Client Javascript variable definition/value assignment statement, and then use the SetVariable () statement to pass this variable into Flash, Flash will split the string () into an array, then, don't you want to teach me? Let's show you everything.
Under the guidance of this idea, three files (sFMP stands for simple Flash MP3 Player) are generated. 1) sFMP.swf-Flash file is used as the user interface; 2) sFMP. asp (. php)-request the database to write the file list as a Javascript variable to the returned HTML file; 3) add. asp (. php) add a URL page. The following describes the program logic and work steps of each file:
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.