The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Archived Forums
  • Sound
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Archived Forums
 Sound

  • stormBliss Author 
    • 684 
    • 0 
    • 8 
    preloading sound.
    Nutrox

    Last reply Nov 23 2006, 06:10 PM

    by Nutrox

    Posted: Nov 22 2006, 09:20 PM

    by stormBliss

     

Hey guys,

I have this issue:

My whole content, the flash site is 80kB.

If i load one mp3 as an ambient music, it jumps to 400kB, which is not so good.

I was wondering is there any possible way that I could load the content as 80kB, and once its completely loaded, to begin loading the ambient sound ? also perhaps this sound should stay in a different swf or something so that it does not extend my main swf too much?

Thanks in advance for suggestions.

  8 REPLIES
 
nonak
1  
nonak

Hi Stormbliss

you could try streaming the sound in..

if you need it loaded as an event sound , you can load it into a movie clip once the rest of the movie is playing…

just a couple thoughts..smilie

  • 22 November 2006 09:34 PM
  •  
stormBliss Author 
2  
stormBliss

Hey mate, thanks for your answer.

I need this sound to be my background music for the website, so its not an object event (well it is an event actually if you think of it as playing when the _root.onLoad=function() - so when the root loads).

I am a bit confused, can you please point me in the right direction about the streaming suggestion? a bit of code would be much appreciated.

So actually, all I need is that I load this sound file from outside my main swf , even if that means inserting it into another separate swf . by doing so, it will not modify the size of my main swf.

  • 23 November 2006 11:46 AM
  •  
BVX
3  
BVX

this topic is beaten to death, u could search a bit in the forums, anyway hope that helps:

http://www.kennybellew.com/tutorial/drag.htm

  • 23 November 2006 12:07 PM
  •  
BVX
4  
BVX

as simple as possible:

[AS]var audio:Sound = new Sound();
audio.loadSound(“URL”, true);
audio.start();[/AS]

true/false toggles stream/download mode

  • 23 November 2006 12:18 PM
  •  
Nutrox
5  
Nutrox

The Sound class also has getBytesLoaded() and getBytesTotal() methods, so you can check the load progress easily enough if you don’t want to stream the audio.

[as]var mySound:Sound = new Sound();
var loadInterval:Number;

function loadSound(url:String):Void
{
  if (loadInterval)
  {
    clearInterval(loadInterval);
  }
  mySound.loadSound(url);
  loadInterval = setInterval(this, “checkLoadProgress”, 100);
}

function checkLoadProgress():Void
{
  var percent:Number = 0;
  var bLoaded:Number = mySound.getBytesLoaded();
  var bTotal:Number = mySound.getBytesTotal();

  if (bLoaded && bTotal)
  {
    percent = (100 / bTotal) * bLoaded >> 0;
  }

  if (percent == 100)
  {
    clearInterval(loadInterval);
    loadInterval = null;

    mySound.play();
  }
}

//

loadSound(“ambience.mp3”);[/as]
good

  • 23 November 2006 02:58 PM
  •  
BVX
6  
BVX

thanks, Nutrox - flawless like always! good

  • 23 November 2006 03:05 PM
  •  
stormBliss Author 
7  
stormBliss

thank you BVX, and Splat - you are amazing, that was my next question stick out tongue

  • 23 November 2006 05:53 PM
  •  
Nutrox
8  
Nutrox

No problem. smilie

There is also the Sound.onLoad event that you can use when the sound has loaded… if you don’t need any load progress info.

[as]mySound.onLoad = function():Void
{
  trace(“mySound has loaded”);
}

mySound.load(“file.mp3”);[/as]

  • 23 November 2006 06:10 PM
  •  
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 779  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,728  Assets
  • Profiles 282,751  Members
  • Topics 93,776  Topics
  • Blog 4  Blog
  • Facebook 1,679  Facebook
  • Twitter 1,163  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 11, 2012 - 18:46:50