Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Using a timeline.
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
It isn't working. I think I did something wrong. Does the layer need to be assigned a label?
Copy link to clipboard
Copied
what timeline contains your sound?
to what timeline did you add the code?
copy and paste the code you used.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
then use:
var st:SoundTransform=this.transform.soundTransform;
st.volume=.2;
this.transform.soundTransform=st;
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
my error. use:
var st:SoundTransform=this.soundTransform;
st.volume=.2;
this.soundTransform=st;
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
any time after that code executes you should use:
st.volume=1; // full volume.
this.soundTransform=st;
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thanks I think I got it all working correctly. I really apprecitae all the help.
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now