Share Posted January 6, 2010 Hi there, I have a class that I use to play music in as3. The thing is that I made a copy of that class and changed a few things to adapt it to a different movie clip, nothing in the core. But the TweeNLite is giving me an error... The error occurs in this line: song = soundFactory.play(pausePoint); song.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); TweenLite.to(song, 0, {volume:0}); TweenLite.to(song, 2, {volume:1}); If I comment the Tween it doesn't output any errors... Any ideas of what's happenning? I'm using tweens like that in other functions in the same class and they work perfectly... Definitions are: private var song:SoundChannel; private var soundFactory:Sound; private var pausePoint:Number = 0.00; The error says (translated from spanish): ReferenceError: Error #1069: Porperty volume not found on flash.media.SoundChannel and there't no default value. at com.greensock::TweenLite/init() at com.greensock::TweenLite/renderTime() at com.greensock::TweenLite() at com.greensock::TweenLite$/to() at com.epika::epika_music/playMusic() at com.epika::epika_music/completeHandler() Thanks a lot, Javier Link to comment Share on other sites More sharing options...
Share Posted January 6, 2010 You forgot to activate the VolumePlugin. It's automatically activated in TweenMax, but if you're using TweenLite, you must manually activate it: import com.greensock.plugins.*; TweenPlugin.activate([VolumePlugin]); (you only need to activate it once in your swf) Link to comment Share on other sites More sharing options...
Author Share Posted January 6, 2010 That solved it, thanks a lot... Weird thing though, the other tweens are working fine without that activation... :S Why is that? Link to comment Share on other sites More sharing options...
Share Posted January 6, 2010 Were the other tweens volume tweens? If so, I'm as baffled as you are. Maybe you were using TweenMax for the others instead of TweenLite? Link to comment Share on other sites More sharing options...
Author Share Posted January 7, 2010 Yeah, that's the weird part... They are volume tweens and are exactly the same as the ones that made the class not work... Link to comment Share on other sites More sharing options...
Share Posted January 7, 2010 Hm. Then please post a sample FLA that demonstrates the issue. I'm pretty sure there must have been some other problem in your file that was causing the volume tweens not to work on those other ones. It's tough to diagnose blind, though. Link to comment Share on other sites More sharing options...
Author Share Posted January 7, 2010 Here's the class: package { /// import flash.display.Sprite; import flash.display.MovieClip; import flash.events.*; import flash.media.Sound; import flash.media.SoundChannel; import flash.media.SoundTransform; import flash.media.SoundMixer; import flash.net.URLRequest; import flash.utils.Timer; import flash.utils.ByteArray; /// // GreenScock TweenLite / TweenMax - Version: 11.1, Updated 10/21/2009 /// import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; /// public class music extends Sprite { /// // VARIABLES /// private var url:String; private var boton:MovieClip; private var song:SoundChannel; private var soundFactory:Sound; private var FourierTransform:Boolean = false; private var arrayMixer:ByteArray = new ByteArray(); private var pan:int = 0; private var porcentLoad:Number = 0; private var pausePoint:Number = 0.00; private var isStarted:Boolean = true; /*----------------------- INIT -----------------------*/ /*----------------------- INIT -----------------------*/ /*----------------------- INIT -----------------------*/ /*----------------------- INIT -----------------------*/ /*----------------------- INIT -----------------------*/ /*----------------------- INIT -----------------------*/ public function music():void { /// } /*----------------------- UTILS -----------------------*/ /*----------------------- UTILS -----------------------*/ /*----------------------- UTILS -----------------------*/ /*----------------------- UTILS -----------------------*/ /*----------------------- UTILS -----------------------*/ /*----------------------- UTILS -----------------------*/ public function cargarMusic(mp3:String, que_boton:MovieClip):void { /// url = mp3; boton = que_boton; pausePoint = 0.00; /// SoundMixer.stopAll(); soundFactory = new Sound(); var request:URLRequest = new URLRequest(url); /// soundFactory.addEventListener(Event.COMPLETE, completeHandler); soundFactory.addEventListener(ProgressEvent.PROGRESS, progressHandler); soundFactory.load(request); } public function execMusic(e:MouseEvent):void { /// if(isStarted){ /// TweenLite.to(song, 1, {volume:0, onComplete:pauseMusic}); /// isStarted = false; } else{ /// song = soundFactory.play(pausePoint); song.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); /// TweenLite.to(song, 0, {volume:0}); TweenLite.to(song, 2, {volume:1}); /// isStarted = true; } /// MovieClip(boton.parent).clickMusicaHome(); } public function playMusic():void { /// song = soundFactory.play(pausePoint); song.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); /// //TweenLite.to(song, 0, {volume:0}); //TweenLite.to(song, 5, {volume:1}); } public function pauseMusic():void { /// pausePoint = song.position; song.stop(); } public function loopMusic():void { /// pausePoint = 0.00; song = soundFactory.play(pausePoint); song.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); } private function soundCompleteHandler(e:Event):void { /// song.removeEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); loopMusic(); } public function get MixerMusic():ByteArray { /// SoundMixer.computeSpectrum(arrayMixer, FourierTransform); return arrayMixer; } public function set FourierMusic(valor:Boolean):void { /// this.FourierTransform = valor; } public function get FourierMusic():Boolean { /// return FourierTransform; } /*----------------------- LISTENERS -----------------------*/ /*----------------------- LISTENERS -----------------------*/ /*----------------------- LISTENERS -----------------------*/ /*----------------------- LISTENERS -----------------------*/ /*----------------------- LISTENERS -----------------------*/ /*----------------------- LISTENERS -----------------------*/ private function completeHandler(event:Event):void { /// playMusic(); MovieClip(boton).lines_mc.play(); } private function progressHandler(event:ProgressEvent):void { /// porcentLoad = Math.round((event.bytesLoaded*100)/event.bytesTotal); } } } In there if I remove the comments from the playMusic function tween volumes it gives me the error I mentioned... And the plug-in isn't active :S Weirddddddddddddddd... Usage like this: var music_home:music = new music(); music_home.cargarMusic("music/music_site.mp3", music_mc); Hope it helps... Link to comment Share on other sites More sharing options...
Share Posted January 7, 2010 Sorry I wasn't clear enough - could you post a sample FLA that demonstrates the issue? I wasn't looking to dissect your class - I wanted something as simple as possible that reproduces the problem so that I could publish and see it for myself and add traces, poke around, etc. Also, are you using version 11.1? If so, please make sure you update your classes immediately - that version is pretty stale. Link to comment Share on other sites More sharing options...
Author Share Posted January 7, 2010 I'll go ahead and download the lastest version, just forgot about updating On the other hand, as soon as I have some free time (I'm running on a tight schedule) I'll post a quick example. Thanks, Javier Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now