卡在交互式地图上
所以,我正在抓紧时间制作 HTML/Flash 混合交互式地图,但它还远没有完成。 我不断地接近解决每个问题,却发现了更多的错误。 当你看作品时,其中大多数都是非常明显的。 我想至少消除大错误,所以我非常感谢任何建议。 请帮忙!
基本上,我以两种方式使用工具提示:[0]
传统上基于 Flash 的 onMouseMove(工作正常),以及 [1]
非常规地瞄准 Flash 影片中的某个点来自 HTML 列表。 工具提示显示正常,但由于地图移动和移动而位于错误的位置。 通过 TweenLite 进行缩放。 onMouseOver/onMouseOut 事件也存在错误,其中 onMouseOver 再次触发 onMouseOut,使工具提示在 _alpha 应该为 0 时可见。
链接到作品: http://muralapts.com/test/neighborhood.php
---- 大问题#1: HTML onMouseOver 再次触发onMouseOut,有效地“重新打开”我的工具提示。 当工具提示不会消失时,看起来真的很糟糕。 没有错误,因此我无法弄清楚为什么 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 Parser 从 Flash 使用的同一 XML 文件呈现 HTML 输出。
HTML/Javascript 与自定义 AS2 对话 通过外部接口的地图组件
地图最初放大到 140% 并使用 TweenLite 移动到某个点
Flash 中点的 onRollOver影片显示带有地名的工具提示,更改点颜色
放大/缩小按钮设置父剪辑 _xscale + _yscale 并在更新时使用 TweenLite 进行记录
HTML 列表中的 onMouseOver 显示带有地图数据的工具提示,但在错误的位置,因为地图已被缩放和放大。 与 TWENLITE 一起感动。 使用 TweenLite onUpdate 记录父剪辑的比例 + 位置值。
从 HTML 更改点的颜色适用于 MouseOver,在 MouseOut 上“粘性”(点保持黑色)
从
XML 代码:(显示一个类别+列表,还有更多)
<category title="Arts & Entertainment">
<loc id="artsWest_mc" name="Arts West" website="http://www.artswest.org/" cat="0" num="0">
<content><![CDATA[The Junction's thriving community playhouse & art gallery.]]></content>
</loc>
</category>
HTML 代码:
<script type="text/javascript"><!--
function showTooltip(btnID,catNum,listNum) {
thisMovie("map").showTooltip(btnID,catNum,listNum);
}
function removeTip(btnID, catNum, isExternal) {
thisMovie("map").removeTip(btnID, catNum, true);
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
} else {
return document[movieName]
}
}
//--></script>
<a onMouseOver="showTooltip( btnID, categoryNum, listingNum )" onMouseOut="removeTip()">Arts West</a>;
FLASH 代码:
public 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});
}
SO, I am getting down to the wire on a deadline for an HTML/Flash hybrid interactive map, and it is not anywhere near finished. I keep getting close to solving each problem, only to discover more bugs. Most of them are quite obvious when you look at the work. I would like to at least squash the big bugs, so I am VERY appreciative of any suggestions. PLEASE HELP!
Basically, I am using a Tooltip in two ways: [0]
conventionally Flash-based onMouseMove (works fine), and [1]
unconventionally targeting a point in the Flash movie from an HTML list. The Tooltip comes up fine, but is in the wrong place due to the Map moving & scaling via TweenLite. There are also bugs with the onMouseOver/onMouseOut events, where the onMouseOver fires again onMouseOut, leaving the Tooltip visible when it should have an _alpha of 0.
Link to the work: http://muralapts.com/test/neighborhood.php
---- BIG ISSUE #1: HTML onMouseOver is firing again onMouseOut, effectively "turning back on" my Tooltip. Really buggy looking when Tooltip won't go away. No errors, therefore I can't figure out why onMouseOver is firing twice. Appears to be an HTML issue, not a Flash issue.
---- BIG ISSUE #2: Tooltip triggered from HTML list on the left of page shows up in the wrong place due to parent clip being scaled & moved with TweenLite. Tooltip is attached to _root, but is "targeting" a dot within several container clips (paths not specified below). I am trying to get the Tooltip position like this:
Tooltip._x = ( dot._x + parentClip._x ) * parentClip._xscale/100;
Tooltip._y = ( dot._y + parentClip._y ) * parentClip._yscale/100;
INTERACTIVE MAP DETAILS:
XML Content dynamically generates
HTML and Flash map data (id, name,
link, blurb, category number [Arts,
Shopping, etc.], list number
[number within
category] ). Uses Magic Parser to render HTML Output from the same XML file that Flash is using.HTML/Javascript talks to custom AS2
map component via External InterfaceMap Initially zooms in to 140% and moves to a certain point using TweenLite
onRollOver of dots in Flash movie shows Tooltip with place name, changes dot color
Zoom In/Out buttons set parent clip _xscale + _yscale and record with TweenLite onUpdate
onMouseOver of list in HTML shows Tooltip w/ map data but in the WRONG PLACE, since Map has been zoomed & moved with TWEENLITE. Using TweenLite onUpdate to record parent clip's scale + placement values.
Changing color of dot from HTML works onMouseOver, is "sticky" onMouseOut (dots stay black)
XML CODE: (showing one category + listing, there are many more)
<category title="Arts & Entertainment">
<loc id="artsWest_mc" name="Arts West" website="http://www.artswest.org/" cat="0" num="0">
<content><![CDATA[The Junction's thriving community playhouse & art gallery.]]></content>
</loc>
</category>
HTML CODE:
<script type="text/javascript"><!--
function showTooltip(btnID,catNum,listNum) {
thisMovie("map").showTooltip(btnID,catNum,listNum);
}
function removeTip(btnID, catNum, isExternal) {
thisMovie("map").removeTip(btnID, catNum, true);
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
} else {
return document[movieName]
}
}
//--></script>
<a onMouseOver="showTooltip( btnID, categoryNum, listingNum )" onMouseOut="removeTip()">Arts West</a>;
FLASH CODE:
public 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});
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用
MovieClip::localToGlobal
对于位置问题...关于奇怪的 HTML 行为,如果不亲自调试,我无法为您提供很多帮助...我不是该领域的专家...:-D
一个快速的 hacky 修复可能是,延迟工具提示隐藏:
activeID
...setTimeOut(removeTip, 100, bt, catNum)
)activeID = null
放入removeTip我希望,这更不太清楚...
嗯调用showTooltip 中的trickTip onUpdate 对我来说似乎很奇怪...我认为你应该真正清理它...有一个函数,它既是补间的更新函数,又是从外部接口调用的,真的很混乱。 ..最好现在改变它,虽然你知道它的作用...
好吧,希望这有帮助...
greetz
back2dos
use
MovieClip::localToGlobal
for the position issue ...concerning the strange HTML behaviour, i can't help you a lot without debugging myself ... i am not that much of an expert on the field ... :-D
a quick hacky fix could be, to delay tooltip hiding:
activeID
...setTimeOut(removeTip, 100, bt, catNum)
)activeID = null
into removeTipi hope, this is more less clear ...
uhm calling trickTip onUpdate from showTooltip seems very strange to me ... i think you should really clean that up ... having a function, that is both an update function for a tween, and is being called from an external interface, is really messy ... better change it now, while you know, what it does ...
alright, hope this helps ...
greetz
back2dos
关于大问题#2:
我觉得我有点理解
localToGlobal
,但它正在记录x
和y 对于远离地图的每个点。
父地图剪辑为 760 x 916 像素(屏蔽 @ 400 x 600),但是我的代码输出记录每个点的“
localToGlobal
”x 值在 800 到 1600 之间 - 远离舞台。在 Flash 影片中的 OnMouseOver 中,每个
dot._x
都记录在 100 到 300 之间,父剪辑位于左上角的 0,0...那么 877 来自哪里? 是否考虑到我正在动态设置父剪辑的_x
/_y
动画并增加_xscale
/_yscale
(最初为140)?_xscale
/_yscale
如何影响 localToGlobal x 坐标?我在启动点的位置添加了建议的代码(同时循环遍历 XML 层次结构) – 有 2 个循环,一个循环用于每个 XML 类别
[i]
和列表[g]
。 不可否认,我的代码变得复杂了。 我尝试向工具提示传递与移动地图相同的“destX”值,但这不起作用 - 可能是因为我传递的是相对于地图本身的值,而工具提示位于_root
。 这是localToGlobal
应该提供帮助的地方吗?Regarding BIG ISSUE #2:
I feel like I sort-of understand
localToGlobal
, but it is recording anx
andy
for each point that is way off the map.The parent map clip is 760 x 916 pixels (masked @ 400 x 600), however my code output is recording each dot's "
localToGlobal
" x value between 800 and 1600 – way off of the Stage.OnMouseOver in the Flash movie, each
dot._x
is recorded between 100 and 300, with the parent clip at 0,0 in the top left corner... So where is the 877 coming from? Is it factoring in that I am dynamically animating the parent clip's_x
/_y
and increasing the_xscale
/_yscale
(initially to 140)?How does
_xscale
/_yscale
affect localToGlobal x coordinates?I added the suggested code where I initiate the dots (simultaneously looping through the XML hierarchy) – there are 2 loops, one for each XML category
[i]
and listing[g]
. Admittedly, my code has gotten complicated. I tried passing Tooltip the same "destX" value I am using to move the map, but that didn't work – probably because I am passing values relative to the map itself, while the Tooltip is on the_root
. Is that wherelocalToGlobal
is supposed to help?嘿,不太确定您对工具提示的问题,但是我在不同的应用程序上使用相同的概念。 我在一些增强现实 3D 模型上放置了工具提示,但遇到了鼠标悬停问题,即鼠标移开时工具提示会重复。 我 100% 在 flash 中执行此操作,因此我知道这不是 HTML 问题。
不管怎样,在谷歌搜索中发现了这个,我想让你知道这也发生在我身上,而且我不使用 HTML。
Hey Not really sure about your problems with the tooltip thing however I am using the same concept on a different application. I am putting a tooltip on some Augmented Reality 3D models and I am having a mouse over issue where the tooltip duplicates on mouse out. I am doing this 100% in flash so I know it is not a HTML problem.
Anyways, found this in a google search and thought I would let you know that it is happening to me too and I don't use HTML.