网上有些例子不是不完善就是pay money的.自已整蛊了个.
部分代码:
/*------------------------------------------------*/
stop();
tipBord.visible=false;
mapBord.addEventListener(MouseEvent.MOUSE_MOVE,mapMove);
mapBord.map.addEventListener(MouseEvent.MOUSE_OVER,mapHit);
mapBord.map.addEventListener(MouseEvent.MOUSE_OUT,mapOut);
mapBord.textBord.addEventListener(MouseEvent.MOUSE_OVER,visibleTip);
mapBord.map.addEventListener(MouseEvent.CLICK,openURL);
tipBord.addEventListener(MouseEvent.MOUSE_OVER,visibleTip);
//鼠标点击事件
function openURL(event:MouseEvent):void {
var url:String = returnURL(event.target.name);
if(url.length > 4)
{
navigateToURL(new URLRequest(returnURL(event.target.name)));
}
}
function returnURL(t:String):String {
return resetString(resultXML.area.(@id==t).@url);
}
appBg.appTitle.text=loaderInfo.parameters.t;
function mapMove(event:MouseEvent):void {
//mapBord.x=32-(mouseX-stage.stageWidth/2)/12;
//mapBord.y=30-(mouseY-stage.stageHeight/2)/12;
}
//鼠标移动到某个省市上的事件
function mapHit(event:MouseEvent):void {
//得到输入的xml中的value值
var s :String = returnValue(event.target.name);
//鼠标放到具体省市上的相应图变色
event.target.nextFrame();
//有值
if(s.length > 2)
{
//显示
showTip(event.target.name);
}
else
{
//隐藏上次显示的tip
tipBord.visible=false;
}
}
function mapOut(event:MouseEvent):void {
event.target.prevFrame();
//hideTip();
}
function showTip(t:String):void {
tipBord.visible=true;
tipBord.t.htmlText=returnValue(t);
var tz:Object={x:0,y:0};
tz.x=mapBord.textBord.getChildByName(t).x;
tz.y=mapBord.textBord.getChildByName(t).y;
var p:Number=0;
var l:Number=0;
if(tz.x>stage.stageWidth/2) {
p=-120;
} else {
p=120;
}
if(tz.y>stage.stageHeight/2) {
l=-120;
} else {
l=120;
}
tipBord.x=tz.x+p;
tipBord.y=tz.y+l;
gs.graphics.clear();
gs.graphics.lineStyle(1, 0xFFFFFF,0.1);
gs.graphics.moveTo(tz.x+12,tz.y+6);
gs.graphics.beginFill(0x0077CC,0.2);
gs.graphics.lineTo(tipBord.x-32,tipBord.y-30);
gs.graphics.lineTo(tipBord.x-32+tipBord.width-8,tipBord.y-30);
gs.graphics.lineTo(tz.x+12,tz.y+6);
gs.graphics.endFill();
gs.graphics.moveTo(tz.x+12,tz.y+6);
gs.graphics.beginFill(0x0077CC,0.1);
gs.graphics.lineTo(tipBord.x-32+tipBord.width-8,tipBord.y-30);
gs.graphics.lineTo(tipBord.x-32+tipBord.width-8,tipBord.y-30+tipBord.height-8);
gs.graphics.lineTo(tz.x+12,tz.y+6);
gs.graphics.endFill();
gs.graphics.moveTo(tz.x+12,tz.y+6);
gs.graphics.beginFill(0x0077CC,0.2);
gs.graphics.lineTo(tipBord.x-32+tipBord.width-8,tipBord.y-30+tipBord.height-8);
gs.graphics.lineTo(tipBord.x-32,tipBord.y-30+tipBord.height-8);
gs.graphics.lineTo(tz.x+12,tz.y+6);
gs.graphics.endFill();
gs.graphics.moveTo(tz.x+12,tz.y+6);
gs.graphics.beginFill(0x0077CC,0.1);
gs.graphics.lineTo(tipBord.x-32,tipBord.y-30+tipBord.height-8);
gs.graphics.lineTo(tipBord.x-32,tipBord.y-30);
gs.graphics.lineTo(tz.x+12,tz.y+6);
gs.graphics.endFill();
}
function hideTip():void {
tipBord.visible=false;
tipBord.t.htmlText="";
gs.graphics.clear();
}
function visibleTip(event:MouseEvent):void {
tipBord.visible=true;
}
function returnValue(t:String):String {
return resetString(resultXML.area.(@id==t).@value);
}
function resetString(s:String):String {
var a:Array=s.split(",");
var t:String="";
for(var i:uint=0;i<a.length;i++) {
t+=a[i]+"\n";
}
return t;
}
源码下载
分享到:
相关推荐
flash map第一季,flash map第一季,flash map第一季
FLASH实现的截图功能 功能类似于QQ的截图功能
Flash as3调用外部AS脚本 很小的示例
pv3d实现的魔方效果的源文件,flash as3写的,非常棒的效果,可以实现魔方任意一个面的旋转,超酷。无论是pv3d的初学者或者是高手,都很值得学习和借鉴。
flash破解软件AS3Sorcerer,能确解最新的代码
抽奖程序 flash as3 分一等奖二等奖三等奖. 可以作弊,可以不作弊. 主要用到数组,随机数.
Flash as3 相册
flash actionscript3 as3通信 教程 socket与服务器通信, 多个swf之间通信.zip
flash actionscript3 as3 字符编码转换.zip
Flash as3 全网站
用flex开发的google map一样的地图引擎源代码,对学习flex3.0,actionscript3.0等相关技术都很大帮助。。
flash as3 拖动效果
通过代码实现的图片水波纹效果,非常逼真,as版本3.0,flash版本 flash CS3适用。
flash as3 调试工具
一个用as3 脚本写的小时钟,有传统的带表针的,也有电子时钟,还有秒表和闹钟功能 ! 代码有点粗糙,但是功能还是可以的!
Flash ActionScript3实现连连看游戏源代码 as3拖放物体连线.zip
Flash CS3 AS3声音视频高级编程
Flash as3 鼠标跟随
Flash 游戏编程大学 AS3 源文件Flash 游戏编程大学 AS3 源文件Flash 游戏编程大学 AS3 源文件Flash 游戏编程大学 AS3 源文件Flash 游戏编程大学 AS3 源文件Flash 游戏编程大学 AS3 源文件Flash 游戏编程大学 AS3 ...
FLASH AS3 雷达tuio+UDP协议示例