Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Lower background music while video is playing

Explorer ,
Jan 10, 2013 Jan 10, 2013

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

TOPICS
ActionScript
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 11, 2013 Jan 11, 2013

my error.  use:

var st:SoundTransform=this.soundTransform;

st.volume=.2;

this.soundTransform=st;

Translate
Community Expert ,
Jan 10, 2013 Jan 10, 2013

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 10, 2013 Jan 10, 2013

Using a timeline.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2013 Jan 10, 2013

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;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 10, 2013 Jan 10, 2013

Screen shot 2013-01-10 at 9.40.53 PM.png

It isn't working. I think I did something wrong. Does the layer need to be assigned a label?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2013 Jan 10, 2013

what timeline contains your sound?

to what timeline did you add the code?

copy and paste the code you used.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 10, 2013 Jan 10, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2013 Jan 10, 2013

then use:

var st:SoundTransform=this.transform.soundTransform;

st.volume=.2;

this.transform.soundTransform=st;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 11, 2013 Jan 11, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2013 Jan 11, 2013

my error.  use:

var st:SoundTransform=this.soundTransform;

st.volume=.2;

this.soundTransform=st;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 11, 2013 Jan 11, 2013

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;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2013 Jan 11, 2013

any time after that code executes you should use:

st.volume=1;  // full volume.

this.soundTransform=st;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 11, 2013 Jan 11, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2013 Jan 11, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 12, 2013 Jan 12, 2013

Thanks I think I got it all working correctly. I really apprecitae all the help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 12, 2013 Jan 12, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines