Xml 卡在交互式地图上

Xml 卡在交互式地图上,xml,map,actionscript-2,tooltip,externalinterface,Xml,Map,Actionscript 2,Tooltip,Externalinterface,因此,我正在着手完成一个HTML/Flash混合交互地图的最后期限,而且它还没有完成。我一直在接近解决每个问题,却发现了更多的bug。当你看这部作品时,它们中的大多数都是显而易见的。我想至少压扁大错误,所以我非常感谢任何建议。请帮忙 基本上,我以两种方式使用工具提示:[0]传统上基于MouseMove的Flash(工作正常),以及[1]非传统地从HTML列表中定位Flash电影中的某个点。工具提示显示得很好,但由于地图通过TweenLite移动和缩放,因此位于错误的位置。onMouseOver/

因此,我正在着手完成一个HTML/Flash混合交互地图的最后期限,而且它还没有完成。我一直在接近解决每个问题,却发现了更多的bug。当你看这部作品时,它们中的大多数都是显而易见的。我想至少压扁大错误,所以我非常感谢任何建议。请帮忙

基本上,我以两种方式使用工具提示:
[0]
传统上基于MouseMove的Flash(工作正常),以及
[1]
非传统地从HTML列表中定位Flash电影中的某个点。工具提示显示得很好,但由于地图通过TweenLite移动和缩放,因此位于错误的位置。onMouseOver/onMouseOut事件也有一些bug,onMouseOver在onMouseOut中再次触发,当工具提示的_alpha值为0时,工具提示仍然可见

链接到工作:

----大问题#1:HTML-onMouseOver在mouseout上再次启动,有效地“打开”了我的工具提示。当工具提示不会消失时,看起来真的很糟糕。没有错误,所以我不明白为什么onMouseOver会发射两次。似乎是HTML问题,而不是Flash问题

----大问题#2:页面左侧HTML列表触发的工具提示显示在错误的位置,因为父剪辑正在使用TweenLite缩放和移动。工具提示附加到_root,但在几个容器剪辑中“瞄准”一个点(下面未指定路径)。我试图获得如下工具提示位置:

Tooltip._x = ( dot._x + parentClip._x ) * parentClip._xscale/100;
Tooltip._y = ( dot._y + parentClip._y ) * parentClip._yscale/100;

交互式地图详细信息:
  • 动态生成XML内容 HTML和Flash地图数据(id、名称、, 链接、简介、类别编号[艺术, 购物等]、清单编号 [数字在 类别)。使用Magic解析器呈现Flash使用的同一XML文件的HTML输出

  • HTML/Javascript与自定义AS2对话 通过外部接口映射组件

  • 贴图最初放大到140%,并使用TweenLite移动到某个点

  • Flash电影中点的滚动显示带有地名的工具提示,更改点颜色

  • 放大/缩小按钮设置父剪辑_xscale+_yscale并使用TweenLite onUpdate录制

  • HTML中列表的onMouseOver显示带有地图数据的工具提示,但位置错误,因为地图已使用TWEENLITE缩放和移动。使用TweenLite onUpdate记录父片段的缩放+放置值

  • 在MouseOver上更改HTML中点的颜色,在MouseOut上是“粘性的”(点保持黑色)

XML代码:(显示一个类别+列表,还有更多)

用于职位问题

import flash.geom.Point;

var pt:Point = new Point();
dot.localToGlobal(pt);//dot being the clip with the position you actually need ...
//pt.x and pt.y are the required positions now ...
关于奇怪的HTML行为,如果不调试我自己,我将帮不了你很多。。。我不是这方面的专家…:-D

为了延迟工具提示隐藏,一个快速的黑客修复方法可能是:

  • 前提是,您总是将活动对象存储在某个变量中,例如
    activeID
  • 当你得到一个鼠标,然后设置一个超时。。。也许100-200毫秒。。。(制作一个从JS调用的额外函数,它基本上执行
    setTimeOut(removeTip,100,bt,catNum)
  • 然后,由于一些未知的错误,鼠标指针将在稍后发送。。。如果鼠标悬停重新请求已处于活动状态的对象,请忽略它
  • 超时提供的暂停后,工具提示将隐藏
  • 请确保删除该对象ID,否则,如果不激活中间的另一个对象,将无法两次激活同一对象的工具提示。。。因此,将
    activeID=null
    放入removeTip
我希望,这是更不清楚的

嗯,从showTooltip中调用trickTip onUpdate对我来说似乎很奇怪。。。我想你真的应该把它清理干净。。。拥有一个函数,它既是tween的更新函数,又是从外部接口调用的,这真的很混乱。。。最好现在就改变它,因为你知道它的作用

好吧,希望这有帮助

格里茨


关于大问题的背景2:

我感觉我有点理解
localToGlobal
,但它正在为远离地图的每个点记录
x
y

父贴图剪辑为760 x 916像素(遮罩为400 x 600),但是我的代码输出记录了800到1600之间每个点的“
localToGlobal
”x值–远离舞台

在Flash电影的MouseOver中,每个
点都记录在100到300之间,父剪辑位于左上角的0,0处。。。那么877是从哪里来的呢?是否考虑到我正在动态设置父剪辑的
\ux
/
\uy
动画,并增加
\uxscale
/
\uyscale
(最初为140)

如何影响局部到全局x坐标?

我在启动dots的地方添加了建议的代码(同时在XML层次结构中循环)–有2个循环,每个XML类别一个循环
[I]
,清单
[g]
。诚然,我的代码变得复杂了。我尝试传递与移动地图时使用的“destX”值相同的工具提示,但没有成功–可能是因为我传递的是相对于地图本身的值,而工具提示位于
\u根上。这就是
localToGlobal
应该提供帮助的地方吗

 /////* Map.as */////

 private function initMap() {
    // contentArr = XML Array
    for(var i:Number = 0; i < contentArr.length; i++){
       categories = contentArr[i].childNodes;
       numCategories = categories.length;

      for(var g:Number = 0; g < numCategories; g++){

         dotIDs = categories[g].attributes.id;  
         dot = map_mc[dotIDs];
              // link dot movieClips on Stage to each XML listing   

         dot.catNum = i; // category number - Arts [0], Shopping[1], etc.
         dot.listingNum = g; // each indiv. listing number

         pt = new Point(); // New code
         pt = eval('pt_' + i + '_' + g); //Appending cat/list numbers for unique ids
         ptArray.push(pt);
         ptArray['pt_' + i + '_' + g] = {x:dot._x, y:dot._y};
         dot.localToGlobal(ptArray['pt_' + i + '_' + g]);
         }
    }
 }

 // ˘˘being called from externalInterface
 public function showTooltip(bt, catNum, listNum){ 

      var newBT = eval(_root.mapContainer_mc.map_mc + '.' + bt); 
      // so I don't have to use the entire path in HTML
      goto(newBT, catNum, listNum); 
 }
 public function goto(bt, catNum, listNum){ // moves map, calls Tooltip.trickTip()
      destX = 0-(bt._x-(mask_mc._width/3));
      destY = 0-(bt._y-(mask_mc._height/3));

      if(destX < 10-(map_mc._width-mask_mc._width)) destX = 10-(map_mc._width-mask_mc._width);
      if(destY < 10-(map_mc._height-mask_mc._height)) destY = 10-(map_mc._height-mask_mc._height);
      if(destX > 10) destX = 10;
      if(destY > 10) destY = 10;

      TweenLite.to(map_mc, 1, {_x:destX, _y:destY, ease:'easeOutQuad', overwrite:3, 
      onUpdate:trickTip, 
      onUpdateParams:[ bt, 
                       catNum, 
                       listNum, 
     /* theText*/      contentArr[catNum].childNodes[listNum].attributes.name
                       ]
       });
 }

 /////* Tooltip.as */////

 public function trickTip(catNum:Number, listNum:Number, theText:String):Void {

      theTip._x = ptArray['pt_'+catNum+'_'+listNum].x; //Somewhere way off stage
      theTip._y = ptArray['pt_'+catNum+'_'+listNum].y;
 }
//*Map.as*/////
私有函数initMap(){
//contentArr=XML数组
for(变量i:Number=0;ipublic function showTooltip( bt:MovieClip, catNum:Number, listNum:Number ){ //MOVES MAP & SHOWS TOOLTIP
      TweenLite.to(map_mc, 1, {_x:destX, _y:destY, ease:'easeOutQuad',
          onUpdate: trickTip, 
          onUpdateParams: [bt, contentArr[catNum].childNodes[listNum].attributes.name] 
       });

}
public function trickTip( btnID:MovieClip, btnName:String ){    //CALLED FROM EXTERNAL INTERFACE
      theTip.theText.text = btnName;
      theTip._x = ((btnID._x + btnID._parent._x) * (map_mc._xscale/100)) - (theTip._width *.75);

      theTip._y = ((btnID._y + btnID._parent._y) * (map_mc._yscale/100)) + 20;

      TweenLite.to(theTip, .01, {_alpha:99, overwrite:1});
}

public function removeTip( bt:MovieClip, catNum:Number ){
       TweenLite.to(theTip, .01, {_alpha:0, overwrite:1});
 }
import flash.geom.Point;

var pt:Point = new Point();
dot.localToGlobal(pt);//dot being the clip with the position you actually need ...
//pt.x and pt.y are the required positions now ...
 /////* Map.as */////

 private function initMap() {
    // contentArr = XML Array
    for(var i:Number = 0; i < contentArr.length; i++){
       categories = contentArr[i].childNodes;
       numCategories = categories.length;

      for(var g:Number = 0; g < numCategories; g++){

         dotIDs = categories[g].attributes.id;  
         dot = map_mc[dotIDs];
              // link dot movieClips on Stage to each XML listing   

         dot.catNum = i; // category number - Arts [0], Shopping[1], etc.
         dot.listingNum = g; // each indiv. listing number

         pt = new Point(); // New code
         pt = eval('pt_' + i + '_' + g); //Appending cat/list numbers for unique ids
         ptArray.push(pt);
         ptArray['pt_' + i + '_' + g] = {x:dot._x, y:dot._y};
         dot.localToGlobal(ptArray['pt_' + i + '_' + g]);
         }
    }
 }

 // ˘˘being called from externalInterface
 public function showTooltip(bt, catNum, listNum){ 

      var newBT = eval(_root.mapContainer_mc.map_mc + '.' + bt); 
      // so I don't have to use the entire path in HTML
      goto(newBT, catNum, listNum); 
 }
 public function goto(bt, catNum, listNum){ // moves map, calls Tooltip.trickTip()
      destX = 0-(bt._x-(mask_mc._width/3));
      destY = 0-(bt._y-(mask_mc._height/3));

      if(destX < 10-(map_mc._width-mask_mc._width)) destX = 10-(map_mc._width-mask_mc._width);
      if(destY < 10-(map_mc._height-mask_mc._height)) destY = 10-(map_mc._height-mask_mc._height);
      if(destX > 10) destX = 10;
      if(destY > 10) destY = 10;

      TweenLite.to(map_mc, 1, {_x:destX, _y:destY, ease:'easeOutQuad', overwrite:3, 
      onUpdate:trickTip, 
      onUpdateParams:[ bt, 
                       catNum, 
                       listNum, 
     /* theText*/      contentArr[catNum].childNodes[listNum].attributes.name
                       ]
       });
 }

 /////* Tooltip.as */////

 public function trickTip(catNum:Number, listNum:Number, theText:String):Void {

      theTip._x = ptArray['pt_'+catNum+'_'+listNum].x; //Somewhere way off stage
      theTip._y = ptArray['pt_'+catNum+'_'+listNum].y;
 }