<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    我的漫漫程序之旅

    專注于JavaWeb開發
    隨筆 - 39, 文章 - 310, 評論 - 411, 引用 - 0
    數據加載中……

    China flashMap 的實現(AS3)

    網上有些例子不是不完善就是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(
    10xFFFFFF,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;
    }


    demo and source

    demo and source other address for download

    posted on 2009-02-12 17:29 々上善若水々 閱讀(2484) 評論(4)  編輯  收藏

    評論

    # re: China flashMap 的實現(AS3)  回復  更多評論   

    如果某個省市不需要顯示tip或url的時候用url="#" or value="#" 或干脆不寫這個屬性即可.
    2009-02-12 17:31 | 々上善若水々

    # re: China flashMap 的實現(AS3)  回復  更多評論   

    good
    2009-02-12 22:39 | first_learner

    # re: China flashMap 的實現(AS3)  回復  更多評論   

    靠,這也算?
    看看我的
    2009-02-12 23:44 | cnflex.org

    # re: China flashMap 的實現(AS3)  回復  更多評論   

    @cnflex.org
    側重點不同而已,別做了個Flex整站程序就在這裝.你牛B把源代碼來出來分享下,
    沒有分享精神,請Shut up your mouth.
    2009-02-13 08:58 | 々上善若水々

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 免费污视频在线观看| 久久精品国产亚洲AV电影网| 99免费精品视频| 美腿丝袜亚洲综合| 精品一区二区三区免费观看| av在线亚洲欧洲日产一区二区| 麻豆一区二区免费播放网站 | 免费播放一区二区三区| 亚洲桃色AV无码| 国产无遮挡色视频免费观看性色| 97国产在线公开免费观看| 亚洲五月激情综合图片区| 中文字幕免费在线观看| 国产成人精品日本亚洲直接 | 亚洲男女一区二区三区| 69xx免费观看视频| 国产亚洲福利在线视频| 国产伦精品一区二区三区免费下载| 亚洲三区在线观看无套内射| 国产成人久久AV免费| 亚洲麻豆精品果冻传媒| 午夜小视频免费观看| 一级毛片人与动免费观看| 亚洲日韩欧洲乱码AV夜夜摸| 99久久人妻精品免费二区| 亚洲日韩精品无码专区加勒比| 可以免费观看的毛片| 无码久久精品国产亚洲Av影片| 无码日韩人妻AV一区免费l| 国产亚洲一区区二区在线| 99视频免费观看| 久久久久久亚洲精品无码| 亚洲综合另类小说色区色噜噜| 中文字幕在线观看亚洲日韩| 无码国模国产在线观看免费| 亚洲精品视频免费| 亚洲国产最大av| 在线亚洲午夜理论AV大片| 免费无码又黄又爽又刺激| 中文字幕在线免费播放| 77777亚洲午夜久久多喷|