Using layer (DIV) and embedd Flash, the relevant properties are used to simulate the effect of magic expressions. (Ie, playing the swiff on the transparent background, you can see "Magic Expression" in QQ newer version Function). Because it is analog implementation in the web page, of course, you will close your browser or minimize your browser, and the magic expression of the simulated implementation will be "no" along with the web page.
I wrote a simple example with JS, and the demo page (DEMO) is submitted:
http://exp.univchina.org/univs/sjtu/tomato/simulatemagicface/tomato.html
Simply pay attention to the main attention to two places: First, in the code embedded in the flash, you need to set the parameters to make flash background transparency, , the second is to Put Flash into a dedicated layer, then the control layer can be displayed in the appropriate location. Of course, you can have two options, one is the code that is dynamically written to the Flash, the other is the dynamic control layer display attribute Nice, is it visible.
The JS code used in Demo is as follows:
1. Method for initialization and arrangement of the emoction;
function Ini () {var left; var top; var screenWidth = screen.availWidth; var screenHeight = screen.availHeight; left = (screenWidth-500) / 2; top = (screenHeight-500) / 2; var imgPath; document. Write (" Click the icon to view the corresponding magic expressions
"); for (i = 1; i <= 320; i ) { IF (i <100) {IF (i <10) {imgpath = "magicface // images // mf_00" i ". GIF";} else {imgpath = " i ". GIF ";}} else {imgpath =" MAGICFACE // images // mf _ " i ". gif ";} Document.write (" ");}}
2. Method for displaying magic expressions ShowmagicFace;
Function showmagicface (id, _left, _top, _width, _height) {INI (); var _path; if (id <100) {i (id <10) {_Path = "MagicFace // Flash // mf_00" ID ". SWF ";} else {_Path =" Magicface // Flash // mf_0 " ID ". SWF ";}} else {_Path =" MAGICFACE / / FLASH / / MF _ " ID ". SWF ";} Document.write ("