Link in Zwischenablage kopieren
Kopiert
Hello,
I have created a flash website using AS3 and I want my background music to to soften while a video is playing and pick back up again when someone clicks to go to another page. Any suggestions?
Thank you
my error. use:
var st:SoundTransform=this.soundTransform;
st.volume=.2;
this.soundTransform=st;
Link in Zwischenablage kopieren
Kopiert
use your sound's soundchannel soundtransform property or your movieclip's soundtransform property.
if you don't understand the above, do you create your sound using actionscript or using a timeline?
Link in Zwischenablage kopieren
Kopiert
Using a timeline.
Link in Zwischenablage kopieren
Kopiert
then that sound is on the timeline of a movieclip (eg, mc) and you can use:
var st:SoundTransform=mc.soundTransform;
st.volume=.2;
mc.soundTransform=st;
Link in Zwischenablage kopieren
Kopiert
It isn't working. I think I did something wrong. Does the layer need to be assigned a label?
Link in Zwischenablage kopieren
Kopiert
what timeline contains your sound?
to what timeline did you add the code?
copy and paste the code you used.
Link in Zwischenablage kopieren
Kopiert
It is all in the same timeline there is a layer for actions and a layer for the music separately. I copy and pasted the same code you posted above. I tried changing mc to the music file name and then the frame label but it didn't work.
Link in Zwischenablage kopieren
Kopiert
then use:
var st:SoundTransform=this.transform.soundTransform;
st.volume=.2;
this.transform.soundTransform=st;
Link in Zwischenablage kopieren
Kopiert
I am getting these two error messages.
Error Scene 1 Later Actions Frame 60 Line 8 1119: Access of possibly undefined property soundTransform through a reference with static type flash.geom:Transform.
1119: Access of possibly undefined property soundTransform through a reference with static type flash.geom:Transform.
Link in Zwischenablage kopieren
Kopiert
my error. use:
var st:SoundTransform=this.soundTransform;
st.volume=.2;
this.soundTransform=st;
Link in Zwischenablage kopieren
Kopiert
Thank you that worked. But how do I get it to go back up when someone clicks back to another page?
Also, I have two "pages" where videos play when I tried to paste the script in another actions panel I got the following error message.
1151: A conflict exists with definition st in namespace internal.var st:SoundTransform=this.soundTransform;
Link in Zwischenablage kopieren
Kopiert
any time after that code executes you should use:
st.volume=1; // full volume.
this.soundTransform=st;
Link in Zwischenablage kopieren
Kopiert
1)That worked except for the page before it. I get this message.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Home_fla::MainTimeline/frame42()
2)Also, I am still having a problem when I try to use the same code again for another page with video on it. I get the following error message.
1151: A conflict exists with definition st in namespace internal.
Link in Zwischenablage kopieren
Kopiert
in frame one use:
var st:SoundTransform=this.soundTransform;
then use the other two lines (shown in message 11) whenever you want to change the volume of the sound embedded in this timeline.
Link in Zwischenablage kopieren
Kopiert
Thanks I think I got it all working correctly. I really apprecitae all the help.
Link in Zwischenablage kopieren
Kopiert
you're welcome.
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen