How does the sound name auto control parameters?
playsound (auto, music.mp3, false, 1);
set (sound [????]. onplay, 'trace ("!");');
sound [? ? ? ] .onplay How to get the name?
How does the sound name auto control parameters?
playsound (auto, music.mp3, false, 1);
set (sound [????]. onplay, 'trace ("!");');
sound [? ? ? ] .onplay How to get the name?
with action script you cant know the name if you use auto.
so better use a name
playsound(rocknroll, music.mp3, false, 1);
set(sound[rocknroll].onplay, 'trace ("!");');
When having used 'auto' as name for a new sound, then there will be also a global variable named autosound that refers to that last created sound object.
https://krpano.com/plugins/soundinterface/#soundobject
??????
I don't understand what he means
And after the sound is played, it ca n’t be played anymore, no sound name can be found.
playsound(auto, music.mp3, false, 1);
trace('autosound=', autosound);
set(sound[get(autosound)].onplay, 'trace ("!");');
read the documentation:
https://krpano.com/plugins/soundinterface/#soundobject
playsound(auto,music.mp3,false,1);
trace('autosound =',autosound);
INFO: autosound=[object Object]
No effect, no control
WARNING: Unknown action: sound[get(autosound)].toggle
well, if autosound is not a string (the name) but an object, what could it be ?
always read the docs, they are very exact !
(i didnt do that, first )
" there will be also a global variable named autosound that refers to that last created sound object. "
so...
playsound(auto,music.mp3,false,1);
trace('last name = ',autosound.name);
autosound.play(); // play later
of course autosound gets overwritten if you create another sound with auto
so it would be wise to backup the sound object for later use
playsound(auto,music.mp3,false,1);
copy(mysound, autosound);
trace('mysound name = ',mysound.name);
mysound.play(); // play later
but why not simple use your own name anyway?
playsound(mysound,music.mp3,false,1);
sound[mysound].play(); // play later
Thank you very much for your kind help
Because I want to understand how auto works
I'll test your code later
thank you
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!