# Failiure of setAudio used with flv

**URL:** https://forum.kirupa.com/t/failiure-of-setaudio-used-with-flv/210497
**Category:** flash
**Created:** [December 19, 2006, 11:15am UTC](https://forum.kirupa.com/t/failiure-of-setaudio-used-with-flv/210497 "2006-12-19T11:15:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![arkum](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/arkum/32/1951_2.png) [@arkum](https://forum.kirupa.com/u/arkum)
#### Post date: [December 19, 2006, 11:15am UTC](https://forum.kirupa.com/t/failiure-of-setaudio-used-with-flv/210497/1 "2006-12-19T11:15:01Z")

</div>

Hello,

I’m well and truely stuck. Using the following code to attach the audio of a netstream to an mc to enable volume control:

```auto
 
 private function init():Void{
  netCon = new NetConnection();
  netCon.connect(null);
  netStr = new NetStream(netCon);
  netStr.setBufferTime(buffer);
  container.screen_mc.attachVideo(netStr);
  setAudio();
 }
 
 private function setAudio():Void{
  var myClip:MovieClip =      
                container.createEmptyMovieClip("audio_mc", container.getNextHighestDepth());
  myClip.attachAudio(netStr);
  audio = new Sound(myClip);
  audio.setVolume(0);
  trace(audio.getVolume);//Traces as 0, but actual volume unchanged
 }
 

```

If I use the code as above declaring the audio var above the constructor like so:

```auto
 [LEFT]private var audio:Sound;

```

The trace will show the volume has changed, but the actual volume is uneffected.

However if I declare the audio var locally within the setAudio function, it works fine (but I can’t access audio from outside the function (which is the whole point).

[LEFT]

```auto
var audio:Sound = new Sound(myClip);

```

[/LEFT]

I’m well and truely stuck. Tried using this.audio, but no difference.  
[/LEFT]
