Skip to main content
Inspiring
March 19, 2021
Question

Link to a cloud sound

  • March 19, 2021
  • 1 reply
  • 216 views

Hello. I have this code that controls the download of a sound from my computer. This way it works fine. It has a loading bar. The problem is that I want it to upload a sound stored in the cloud. Specifically in Google Drive. For this I put the link that Google Drive gives. This link:

 

https://drive.google.com/file/d/1QI3CNpskb2Oa8yJ1_3FzlXyUZlP_l0Fc/view?usp=sharing

 

It does nothing and does not give an error.

 

This is the code

 

package  {
	import flash.display.Sprite;
	import flash.media.Sound;
	import flash.net.URLRequest;
	import flash.events.Event;
	
	
	public class ProgressBar extends Sprite {
		private var _sound:Sound;

		public function ProgressBar() {
			addEventListener (Event.ENTER_FRAME, onEnterFrame);
			_sound = new Sound (new URLRequest ("schubert.mp3"));
			_sound.play();
			
			}
		
			public function onEnterFrame (event:Event):void{
				var barWidth:int = 200;
				var barHeight:int = 5;
				var loaded:int = _sound.bytesLoaded;
				var total:int = _sound.bytesTotal;
				if (total >0){
					graphics.clear();
					graphics.beginFill (0xFFFFFF);
					graphics.drawRect (10,10,barWidth, barHeight);
					graphics.endFill();
					
					var percent:Number = loaded / total;
					
					graphics.beginFill (0xCCCCCC);
					graphics.drawRect (10,10,barWidth *percent,barHeight);
					graphics.endFill();
				}
			}

	}
	
}

 

 

 

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    March 19, 2021

    you're probably encountering a security issue trying to download from an https server.  ie, put the sound on an http server and retry.

     

    p.s.  terminate your loop when loading is complete.