dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Pls Help: mp3 loaded and playing, but the audio is muted.

  1. #1
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204

    Pls Help: mp3 loaded and playing, but the audio is muted.

    All,
    I have a volume slider that loads in mp3's and I know the mp3 is loaded because if I click anywhere on the volume slider the audio un-mutes. I am looking for the audio to start playing and be able to hear the audio. I have zipped up the FLA and mp3's (http://www.designchemist.com/downloa...umeControl.zip ), so any help is greatly appreciated!!!

    Thanks,
    Zach

  2. #2
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    from looking at your code this is what I found

    Code:
    onClipEvent (enterFrame) {
    	downloaded = mySound.getBytesLoaded();
    	total = mySound.getBytesTotal();
    	if (downloaded != total) {
    		_root.dl = "downloading song...";
    	} else {
    		complete = 1;
    		_root.dl = "";
    	}
    	mySound.setVolume(_root.volume*1);  //<<< undefined
    	mySound.setVolume(_root.volume = 50); // setting it to 50 works on load
    }

  3. #3
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    Thx wattsup! That un-mutes the audio, but then disables the volume control. I need to be able to turn down/up the volume.

    Thanks,
    Zach

  4. #4
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    Sorry - just a quick look at the code - let me look more in to it.

  5. #5
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    Thx wattsup! This issue is driving me crazy!

  6. #6
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    Okay I think this code will solve your problem.

    Layer 1 frame 1 in actions panel
    Code:
    var Loaded:Boolean = false;
    stop();
    Layer "Ball" on the movie clip
    Code:
    onClipEvent (load) {
    	_x = 0;
    	speed = 5;	
    	Loaded = false; //<<------------ ADDED
    }
    onClipEvent (enterFrame) {	
    	//these next if statements make it so always a whole bar is filled
    	if(endX < 180){
    		//so that always one bar is filled
    		finalX = 180;
    	}
    	if(endX > 40 && endX < 75){
    		finalX = 75;
    	}
    	if(endX > 75 && endX < 110){
    		finalX = 110;
    	}
    	if(endX > 110 && endX < 145){
    		finalX = 145;
    	}
    	if(endX > 145 && endX < 180){
    		finalX = 180;
    	}
    	if(endX > 180 && endX < 215){
    		finalX = 215;
    	}
    	if(endX > 215 && endX < 250){
    		finalX = 250;
    	}
    	//if greater than 2nd last slot then fills up last slot
    	if(endX > 250){
    		finalX = 285;
    	}
    	//makes the white move towards the endX
    	//note to not make the bars 'fill up'
    	//use _x = finalX
    	//but i don't think it looks as cool
    	_x += (finalX-_x)/speed;
    	//sets new volume (use endX so volume has small increments)
    	ratio = Math.round(endX*100/this._width);
            //------------------------------------------------//
    	if(Loaded == false) {  
    		_root.volume = 50;
    	}else{
    		_root.volume = ratio;
    	}
            //----------------------------------------------//
    }
    onClipEvent (mouseDown) {
    	if (_root._xmouse>0 && _root._xmouse<300 && _root._ymouse<150) {
    		Loaded = true; //<<------------ ADDED
    		endX = _root._xmouse;
    		
    	}
    }

    Hope this helps - problem was your volume was always loading at 0, until your click.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center