Error #1056: Cannot create property

| en flex

the other day, i was doing (or trying to do) a sound fader.
I had the sound working already, working as property inside model, had to do it like that 'cause the sound had to be controlled by a sound toggle in a couple of places and didn't want to have two sound instances, and also want to have the controlled binded to the sound instance state (off, on)...anyways maybe that would be a tale for another time.

my first idea was to use a property, animate its value (AnimateProperty), and then updating the sound volume when the tween gets updated, pretty good on paper.

the scenario

I had all set up, the sound, the soundChannel and the AnimatePropery instance, also the volume property and the handler for the tween update.
_soundInstance = new Sound();
_soundPosition = 0;
_soundChannel = new SoundChannel();
//(properties).
private var _isMusicEnabled:Boolean;
private var _soundInstance:Sound;
private var _soundChannel:SoundChannel;
private var _soundPosition:Number = 0;
private var _volumeValue:Number = 0;
private var _fader:AnimateProperty;
.....
(contructor)
//sound fader
_fader = new AnimateProperty();
_fader.duration = 1000;
_fader.target = this;
_fader.addEventListener(TweenEvent.TWEEN_UPDATE, onTweenUpdate, false, 0, true);
_fader.addEventListener(TweenEvent.TWEEN_END, onTweenEnd, false, 0, true);
_fader.property = "_volumeValue";
....
(handlers)
private function onTweenUpdate(event:TweenEvent):void{
	_soundChannel.soundTransform = new SoundTransform(_volumeValue, 0);
}
private function onTweenEnd(event:TweenEvent):void{
	if(!_isMusicEnabled){
	_soundChannel.stop();
	}
}

when setting the sound off or on, all I did was changing the tween properties and the calling the play method.
fading out.

_fader.fromValue = _volumeValue;
_fader.toValue = 0;

and fading in.
_fader.fromValue = _volumeValue;
_fader.toValue = 1;

the error


but then I got this present from the player.
Error #1056: Cannot create property _volumeValue on com.site.project.model.data.SoundManager.
at mx.effects.effectClasses::AnimatePropertyInstance/onTweenUpdate()
at mx.effects.effectClasses::TweenEffectInstance/http://www.adobe.com/2006/flex/mx/internal::applyTweenStartValues()
at mx.effects.effectClasses::AnimatePropertyInstance/play()
at mx.effects::EffectInstance/startEffect()
at mx.effects::Effect/play()
...(more crap)..

The Fix


After "praying" to Google almighty and didn't find a fix, I started doing thing to see what would work, something the error message just got bigger, other times wasn't able to hear the sound, and other times there was a bunch of soundInstances with every click, but the problem mas here.
private var _volumeValue:Number = 0;
it turns that the sound-of-his-mother tweener wasn't able to access the _volumeProperty for just a single reason: the god damn thing was private, changing the property to be public fixes the issue.
public var _volumeValue:Number = 0;

stupid fix, but a 1 at the morning you're just glad to be done.