Open-source project: Map flash component of China

Source: Internet
Author: User
Tags call back

This is the optimized version of the previously released China Map flash version. The source code is located in googlecode, which provides download and has the following features:

1. Divide administrative regions by province to display detailed information of each province (the content is customized in XML)
2. html display supported
3. Click "Province" to open the webpage link.
4. Support event listening (AS and JavaScript)

Demo address:

Www.richbox.net/files/demo.html

Usage:

Insert the flash into the webpage and configure the corresponding parameters (you need to set the map title and the XML address of the data source. If you want the flash to call back your JavaScript method, see the configuration of the third parameter). swfobject is recommended, for example.Code:
& Lt; Script Type = "text/JavaScript" & gt;
Function eventhandler (e ){
Alert (E. value );
}
VaR S1 = new swfobject(“chinamap.swf "," Ply "," 600 "," 500 "," 10 "," # ffffff ");
S1.addparam ("allowScriptAccess", "always ");
S1.addvariable ("title", "map of China ");
S1.addvariable ("xmlurl", "D. xml ");
S1.addvariable ("jshandler", "eventhandler ");
S1.write ("container ");
& Lt;/script & gt;

Data xml configuration example:

Www.richbox.net/files/d.xml

You can also apply the map to your flash or flex project and listen to the event clicked on the map. Sample Code:

Public class chinamapdemo extends Sprite
{
Public Function chinamapdemo ()
{
Super ();
VaR maploader: loader = new loader ();
Maploader. contentloaderinfo. addeventlistener (event. Complete, init );
Maploader. Load (New urlrequest(“chinamap.swf "));
Addchild (maploader );
}
Private function Init (E: Event): void {
E. currenttarget. content. loaderinfo. Parameters. Title = "map of China ";
VaR demomap: chinamap = E. currenttarget. content as chinamap;
Demomap. addeventlistener (mapevent. itemclick, clickhandler );
}
Private function clickhandler (E: mapevent): void {
Trace (E. value );
}
}

You can download the map file from here:

Code.google.com/p/chinamapforflash/downloads/list

The source code has been provided on Google code. You can modify and use it as needed:

Code.google.com/p/chinamapforflash/source/browse/

 

 

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.