# How to "auto"-set volume to a sharedObject sound?

**URL:** <https://forum.kirupa.com/t/how-to-auto-set-volume-to-a-sharedobject-sound/319214>\
**Category:** Uncategorized\
**Created:** [February 12, 2011, 6:19pm UTC](https://forum.kirupa.com/t/how-to-auto-set-volume-to-a-sharedobject-sound/319214 "2011-02-12T18:19:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![liner986](https://avatars.discourse-cdn.com/v4/letter/l/bbce88/32.png) [@liner986](https://forum.kirupa.com/u/liner986)\
**Post date:** [February 12, 2011, 6:19pm UTC](https://forum.kirupa.com/t/how-to-auto-set-volume-to-a-sharedobject-sound/319214/1 "2011-02-12T18:19:04Z")

</div>

Basically I am trying to add a background music to my site, my import to library function isnt working so i decided to find a script that accesses my sound file when the swf is loaded instead of loading it on the timeline. the code which i found plays with default 1 volume and i want it to play, say at 0.5

heres the related script(AS3), omitting the mute function snippet:

var mySO:SharedObject = SharedObject.getLocal(“riacodes\_sound”);  
var song:Sound = new Sound();  
var channel:SoundChannel = new SoundChannel();  
var songPosition : Number = 0;  
song.load(new URLRequest(“sound.mp3”));

i tried fixin it myself through my twisted beginner mind and some looking about by adding;

var volumeAdjust:soundTransform = new volume();  
volumeAdjust.volume = 0.5;  
channel.soundTransform = volumeAdjust;
