global.sound.fade.out.onRelease

  • cosmic_billion
  • Newbie
  • Newbie
  • User avatar
  • Posts: 14
  • Loc: Amsterdam, the Netherlands

Post 3+ Months Ago

Hello Ozzu community,


There is this piece of syntax I found on another forum and was incomplete and dated from 2009 or 2011 or sometime long ago, whatever, it is still incomplete.

Basically I am looking for a piece that increments and decrements the transition between two externally loaded mp3's when a button is pressed. The code I found on the other forum has an existing conflict between the statements.

Code: [ Select ]
var url:String = "tree.mp3";
var treeSound:Sound = new Sound();
treeSound.loadSound(url, true);
treeSound.setVolume(0);
vol = treeSound.getVolume();

//fade Up

onEnterFrame = function(){
var fadeInt:Number = setInterval(fadeIt, 200);
fadeIt();
}
function fadeIt(){
if(treeSound.getVolume()<100)
{treeSound.setVolume(treeSound.getVolume()+10);
trace(treeSound.getVolume());
}
else{treeSound.setVolume(100);}
}

//fade down

leaf_btn.onRelease = function(){
var fadeOnt:Number = setInterval(fadeOut, 200);
fadeOut();
}
function fadeOut(){
if(treeSound.getVolume()>0)
{treeSound.setVolume(treeSound.getVolume()-10);
trace(treeSound.getVolume());
}
else{treeSound.setVolume(0);}
}

stop();
  1. var url:String = "tree.mp3";
  2. var treeSound:Sound = new Sound();
  3. treeSound.loadSound(url, true);
  4. treeSound.setVolume(0);
  5. vol = treeSound.getVolume();
  6. //fade Up
  7. onEnterFrame = function(){
  8. var fadeInt:Number = setInterval(fadeIt, 200);
  9. fadeIt();
  10. }
  11. function fadeIt(){
  12. if(treeSound.getVolume()<100)
  13. {treeSound.setVolume(treeSound.getVolume()+10);
  14. trace(treeSound.getVolume());
  15. }
  16. else{treeSound.setVolume(100);}
  17. }
  18. //fade down
  19. leaf_btn.onRelease = function(){
  20. var fadeOnt:Number = setInterval(fadeOut, 200);
  21. fadeOut();
  22. }
  23. function fadeOut(){
  24. if(treeSound.getVolume()>0)
  25. {treeSound.setVolume(treeSound.getVolume()-10);
  26. trace(treeSound.getVolume());
  27. }
  28. else{treeSound.setVolume(0);}
  29. }
  30. stop();



I want to get around this as quickly as possible and one solution is to choose is a global sound fade out statement, however is such a thing possible?


Any assistance will be appreciated.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • cosmic_billion
  • Newbie
  • Newbie
  • User avatar
  • Posts: 14
  • Loc: Amsterdam, the Netherlands

Post 3+ Months Ago

Ok, so I've resolved my issue, all my sound tracks are mastered so that they now increment slowly, I will use the fade out code between my transitions!

Its not rocket science but it works.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Is there anyway you could post what you did to resolve your problem? Wish someone could have helped you, but maybe you can help someone else in the future with your information.

Glad you got your problem fixed!

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.