When you call an action from a hotspot, is there a way to get the name of the hotspot you called it from?
get current hotspot name
-
-
Hi,
when a code/action was called from a plugin or hotspot event (onclick,onloaded,onhover,...) then the attributes of this "caller" plugin/hotspot can be accessed direct,
e.g.
or
Code<hotspots name="hotspot1" ... onclick="action(show_my_name);" /> <action name="show_my_name"> trace(name); </action>
that will work also for all following calls, tweens, delayedcalls, ...
best regards,
Klaus -
Hi,
when a code/action was called from a plugin or hotspot event (onclick,onloaded,onhover,...) then the attributes of this "caller" plugin/hotspot can be accessed direct,
Code<hotspots name="hotspot1" ... onclick="action(show_my_name);" /> <action name="show_my_name"> trace(name); </action>
that will work also for all following calls, tweens, delayedcalls, ...
Yup the example above works but I can't do nothing much with the variable.
Consider this:Code
Display More<hotspot name="mytest".... onclick="action(narrate-ex-info,name)" /> <action name="narrate-ex-info"> trace(%1); trace(name); trace("%FIRSTXML%/assets/",%1,".mp3"); txtadd(plugin[soundinterface].toload,%FIRSTXML%,"/assets/",%1,".mp3"); trace(plugin[soundinterface].toload); playsound(auto,"%FIRSTXML%/assets/%1.mp3"); </action>
When run it produces this output:
CodeINFO: mytest INFO: mytest INFO: %FIRSTXML%/assets/mytest.mp3 INFO: %FIRSTXML%/assets/name.mp3 ERROR: soundinterface - loading of "/pano/src/assets/name.mp3" failed
I can't make sense of it.
-
Hi hitodenashi,
Try using get() in line 8:
Code
Display More<hotspot name="mytest".... onclick="action(narrate-ex-info,name)" /> <action name="narrate-ex-info"> trace(%1); trace(name); trace("%FIRSTXML%/assets/",%1,".mp3"); txtadd(plugin[soundinterface].toload,%FIRSTXML%,"/assets/",get(%1),".mp3"); trace(plugin[soundinterface].toload); playsound(auto,"%FIRSTXML%/assets/%1.mp3"); </action>
SAlut.
-
Oh, ok that worked. Thanks!
BTW, are there other ways of getting the caller/hotspot name?
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!