做一个上图箭头指向的热点信息。
打开 tour.xml 文件,找到里的scene ,选择一个你将要添加热点的场景。
添加一下代码:
<style name="skin_hotspotstyle_title" url="img/default.png" scale="0.5" edge="top" oy="0" distorted="false"
tooltip=""
onclick="if(linkedscene, skin_hidetooltips(); tween(scale,0.25,0.5); tween(oy,-20,0.5); tween(alpha,0,0.5); looktohotspot(); loadscene(get(linkedscene),null,get(skin_settings.loadscene_flags),get(skin_settings.loadscene_blend)); skin_updatescroll(); );"
onloaded="add_all_the_time_tooltip();do_crop_animation(120,100, 50);"
/>
<style name="lookup_textfiled" background="true" backgroundalpha="0.5" backgroundcolor="0x000000"
css="calc:skin_settings.design_text_css + ' text-align:center; font-size:16px; color:#ffffff;'"
/>
<style name="text_title_up" background="true" backgroundalpha="0.6" backgroundcolor="0x000000"
css="text-align:center; font-size:16px; color:#ffffff; padding:2px 8px; border-radius:5px;" y="50"
/>
<style name="text_title_down" background="true" backgroundalpha="0.6" backgroundcolor="0x000000"
css="text-align:center; font-size:16px; color:#ffffff; padding:2px 8px; border-radius:5px;" y="-50"
/>
<!-- 热点标题显示 set_titlevalue(父热点名,子热点名); 父热点必须设置tooltip属性 -->
<action name="set_titlevalue">
set(layer[%2].html,get(hotspot[%1].tooltip));
</action>
<!-- 动画action -->
<action name="do_crop_animation">
<!-- add attributes to the hotspot -->
registerattribute(xframes, calc((imagewidth / %1) BOR 0));
registerattribute(yframes, calc((imageheight / %2) BOR 0));
registerattribute(frames, calc(xframes * yframes));
registerattribute(frame, 0);
set(crop, '0|0|%1|%2');
setinterval(calc('crop_anim_' + name), calc(1.0 / %3),
if(loaded,
inc(frame);
if(frame GE frames, if(onlastframe !== null, onlastframe() ); set(frame,0); );
mod(xpos, frame, xframes);
div(ypos, frame, xframes);
Math.floor(ypos);
mul(xpos, %1);
mul(ypos, %2);
calc(crop, xpos + '|' + ypos + '|%1|%2');
,
clearinterval(calc('crop_anim_' + name));
);
);
</action>
<!-- 动态热点图 -->
<hotspot name="animation1" tooltip="大门" style="skin_hotspotstyle_title" ath="41" atv="-30" linkedscene="scene_all02" />
<layer name="text_ani" url="%SWFPATH%/plugins/textfield.swf" bgroundedge="10" onloaded="set_titlevalue(animation1,text_ani);" parent="hotspot[animation1]" align="bottom" style="text_title_up" onclick="" />
<hotspot name="skin_buy" tooltip="商品名" url="img/skin_buy_min.png" onloaded="do_crop_animation(128,128, 1000);" scale="0.5" zoom="true" ath="45" atv="-40" onclick="" />
<!-- <layer name="skin_buy_title" url="%SWFPATH%/plugins/textfield.swf" parent="hotspot[skin_buy]" style="text_title_up"
onloaded="set_titlevalue(skin_buy,skin_buy_title);" onclick="hotspot_lookto(skin_buy);" scale="0.5"
/> -->
<!-- 跳转至香港 -->
<hotspot tooltip="香港是一个好地方" name="goto-xianggang" url="img/new_spotd01_txt_gif.png"
onloaded="do_crop_animation(100,120, 20);" scale="0.5" align="bottomcenter"
ath="40" atv="-5" onclick="" />
<layer name="title-xianggang" url="%SWFPATH%/plugins/textfield.swf" parent="hotspot[goto-xianggang]" align="bottom" y="-20" onloaded="set_titlevalue(goto-xianggang,title-xianggang);" style="text_title_down" handcursor="true" onclick="" />
这样就做好了如图的几个动态热点图.
注意 这里用了动画函数(do_crop_animation(x_width,y_height, time)), 动画函数加载图片时 是一帧一帧的 顺序是 从左向右 从上至下…
具体代码包在我的资源处可下载。