Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 01-17-2008, 04:59 AM   #1
legacye
Registered User
 
Join Date: Jan 2008
Posts: 1
Question Fade-in sound effect without onEnterFrame event?

I have an audio player I made in Flash CS3 that runs off an XML Playlist.

I've been trying to add a fade-in effect to the mp3's that is triggered when the user clicks the play button but unfortunately, I've been running into a few problems...

I know that easiest way to code up the fade-in effect is using the this.onEnterFrame event, but due to the way my player's coded, I can't use this.

To make up for the event, I created two functions. The first is called when the user clicks on the play button:

Code:
function startFade()
{
	vols = 0;
	id = setInterval(volStep, 500);
}

Code:
function volStep(){
	
	if(stopfade==false)
	{
		
	step = 5;

	vols = vols + step;
	
	if(vols>=100)
	{ 
	     vols =100; 
	}
	
	_sound.setVolume(vols);

	}
	
	if(vols==100)
	{ 
	
			stopfade=true; 
			clearInterval(id);
			
	}
	updateAfterEvent();
	
}

Now, I've tested both these loops and the "vol" variable increments correctly the way it should. When I test out the value for _sound.getVolume() it's value is also correct after being updated..but for some reason...the actual sound levels for the object won't correspond to this (i.e I dont hear anything at all).

For reference sakes, I'm also including a snippet of where/how I'm using the above in my play button
Code:
                //redfine the object each time we change tracks
                _sound = new Sound(); 
		_sound.onSoundComplete = mp3.playNext;  

		
		var path = mp3.path;
		if (path.indexOf("://")<0) {
			path = _root.urlpath+path;
		}
	
		
		_sound.loadSound(path, true);
		
		startFade();
With the exception of the fade-in problems, everything else in the player works perfectly..

I'd love to get some help with this problem as I've tried over 5 or 6 different solutions from actionscript.org so far and neither have worked yet.
legacye is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sparkle image effect and button sound effect [email protected] Flash 8 General Questions 1 06-05-2006 02:43 AM
fade sound out at specific frame in timeline usr3712 ActionScript 1.0 (and below) 0 07-22-2004 10:11 PM
How can I play sound exactly on event without gap ? sces99 ActionScript 2.0 0 07-21-2004 07:34 AM
help with fade sound function Navarone ActionScript 1.0 (and below) 13 11-25-2003 09:06 AM
A button with a fade out effect on mouse out? Cyrus Animation and Effects 10 04-01-2003 06:03 PM


All times are GMT. The time now is 09:31 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.