ActionScript 2.0 :: Sound Object - Buffering The Next Track?
Sep 16, 2004
I've got the next track to load, when the first one is done, and after that everything works fine.I'm trying to make it so that two tracks will buffer in the same manner - but feel like I'm doing things the hard way.....http:[url]....that is the code
and
http:[url]....that is the fla, txt, and audio files.
View 2 Replies
Similar Posts:
May 26, 2011
I'm working on the development of a tool that plays two audio files and one video file simutaneously.All the files need to play together at the exact same time, so that the audio syncs with the video.
Our situation right now is that each one of the files start playing at different times depending on how fast they are loading. The problem is, my programmer is telling me that there is no way to track the buffer of the audio, so for example, the video only starts playing when at least 30% of the audio is loaded. Is it possible to do this?
The video player would then display something like:
[Code]...
View 4 Replies
Nov 21, 2010
I have a long mp3 file hosted on a standard apache server (30 minutes long so far, but I would like it to work with longer sounds too).I'd like to start playback of this audio within at a specified point. When attempting to use Flash Actionscript 3, my basic tests show that ALL the audio from the start to the position I choose is buffered before playback (Sound.bytesLoaded was my friend here). If I start one second in, it takes about 3 seconds to start playback, 30 seconds in, takes about 25 secondsObviously with a really long mp3, like skipping playback to the middle of a 3-hour audiobook, this isn't going to be practical.Here's the ActionScript 3.0 code I'm using:
button.addEventListener(MouseEvent.MOUSE_DOWN, function():void {
var s:Sound = new Sound();
var req:URLRequest = new URLRequest("http://example.com/audio.mp3");
[code].....
View 1 Replies
Aug 21, 2010
I'm trying to play some sounds that I recorded of a person singing 7 notes. Each sound contains a single note. I then want to create buttons that will play the notes.
But the notes take forever to buffer when the buttons are clicked for the first time.
What are the best SoundBooth settings to make my notes load fast?
View 1 Replies
Mar 19, 2009
I know that manipulate sound with as2 is limited. I wondered is it possible to manipulate a sound/track is possible with AS3?
View 3 Replies
Jun 13, 2010
I am using an addChild() method to place an intro MovieClip into a website. It has a short ten second musical track. I also have a skip intro button on the stage which does a removChild(). I keep trying to write code that will also stop the sound, which continues to play. I tried loading the sound separately and used the channel.stop(); So far nothing is working. It seems like I've been here before.
[Code].....
View 5 Replies
Jan 1, 2012
I have some audio files on my http server, and I would like to write a Flash client in ActionScript3 to load those audio file and play them smoothly. Of course I can just create a Sound object and load it by .load() with a URL request. But for saving the bandwidth, I prefer to load audio file chunks on demand. For example, there is an audio file let's say 100MB. If we try to load as fast as possible when user open the page
<--------- 100MB ----------->
The downloading may finished within minutes, but let's say, if user stop listener in halfway, that's kind of waste to load whole soundtrack at first.
<--------- 100MB ----------->
^--- user may stop here
To solve the problem, I think it's better to split the big audio file into small chunks, load and play them on demands.
<--- 10MB ---><--- 10MB ---><--- 10MB ---> ...
^--- user current position
I want to design the player, let it load audio chunk by chunk, and only load it when it's near the end of current chunk.
How to load those chunks and play them smoothly? I can probably create Sound object for each chunks. But how to play them seamless?
View 1 Replies
Aug 18, 2010
does anybody maybe know how to track/trace the current position of a sound file while it is playing?So that it is updated every frame or second?I figured something with trace(sound.position) onEnterFrame, but didn't succeed in realizing this yet.
View 1 Replies
Jul 19, 2009
I've got a video with a black rectangle that moves, tilts and zooms...is there any way flash can match an object to that? (for example, if I want to put an image over the black box?? Is there any way to detect where objects are in a video from flash? I've seen some things with web cams where snow collects on people in the cam, etc. so there's got to be some way to "find" things.
View 3 Replies
Jan 27, 2009
I wanted to create a shareed object to keep track of a when an AIR app was installed and set an expiration date. i was hoping to control where this sharedObject is created.. but it seems that flash will put it somewhere secret.. is it possible to change where the LSO is created? and where it is looked for?
ActionScript Code:
var firstRun:SharedObject = SharedObject.getLocal("/firstRun");
//firstRun.clear();
if(firstRun.data.userInfo==undefined){
trace("this is the first time you are here");
[Code]...
View 0 Replies
Jul 6, 2011
Right now, I have a car object named car that I want to animate around a track. I did the animation using a motion tween, then used the Copy Motion as AS3 option, the code looks something like this (arrays have been simplified so as not to take up too much room). The code works just fine, the car moves around the track like I wanted it to, but I was wondering is it possible to press a button to stop the animation at a certain point, then resume playing it again when pressing a different button?
ActionScript Code:
var motionGuide:MotionBase;
if(motionGuide == null) {
motionGuide = new Motion();
motionGuide.duration = 20;
[Code] .....
View 2 Replies
Jan 15, 2008
I'm trying to write a function that keeps a running count whenever a button is clicked - and then writes the count to a Shared Object cookie. Here's the code:
Code:
function counterVar() {
var elemSharedObject:SharedObject = SharedObject.getLocal("elementChoices", "/");
[Code]....
Everytime it runs the count gets reset to "1", endlessly.
View 2 Replies
Nov 24, 2009
I am making a dynamic banner system which can handle img banners, as well as flash banners done with object/embed. The entire site makes heavy use of jQuery, including handling the 'click' events.
This obviously isn't a problem when it comes to tracking the clicks on the image itself (i track the click on the parent DIV tag. However, it fails when the advert is an SWF, as I suspected it would.Is there a jQuery workaround that would allow me to capture a click on a Flash element with the DOM?
View 3 Replies
Oct 27, 2011
I have an arbitrary number of object instances on the stage. At any one given time the number of objects may be between 10 and 50. Each object instance can move, but the movement is gradual, the current coordinates are not predictable and at any given moment I may need to retrieve the coordinates of a specific object instance. Is there a common best-practice method to use in this case to track object instance coordinates? I can think of two approaches:
I write a function within the object class that, upon arbitrary event execution, is called on an object instance and returns that object instances coordinates.
Within the object class I declare global static variables that represent x and y values and, upon arbitrary event execution, the variables are updated with the latest values for that object instance.
[Code]...
View 2 Replies
Jan 28, 2010
I need to make a local shared object (or javascript cookie function- below) that I can use to calculate the time since an ad was last loaded. It's an expanding ad, and I only want it to expand once every 2 hours. (Trying to keep the expanding-annoyance to a minimum!) I understand the basics of creating an "lso" but the action script for retrieving the time, placing it as a variable in the lso, and later retrieving it to figure the time is well beyond me. I considered a normal browser cookie, set to delete after the session, bypassing all time calculations... Forcing javascript to create a cookie ONLY when flash tells it to (after the ad has expanded) is tripping me up and creating a function to check for the cookie on the first frame to decide whether or not to continue is also beyond my simple animation skills.
View 0 Replies
Jan 31, 2012
Is there any AS3 library or code-snippet that can create altered versions of a Sound object on-the-fly (at runtime)? Either based on:
An existing Sound object; A ByteArray object;
For example, say you have a "dry" sound of a gun-shot. You could:
[Code]...
View 1 Replies
May 20, 2011
I am using the following to extract the byte info from a sound object - however if I go back to the same sound object and run this again, The byteArray has no bytes available.
var data:ByteArray = new ByteArray;
sound.extract(data,sound.length*44.1);
data.position = 0;
return data;
Is this the correct behavior? Is there not a way to do this multiple times on the same sound object?
View 3 Replies
Mar 15, 2008
I have been at this for about 19 hours straight! I am going to go to bed immediately after this post, but for crying out loud, I have NEVER had this problem before today! Before anyone reads ahead and says 'you have to attach your sound object to a completely separate mc to be able to control it independently from all other sound/root volumes.' see if the following code accomplishes just that:
[Code]...
View 2 Replies
Nov 15, 2010
Is it possible to take two Sound objects and combine them into one Sound object so that one Sound plays, and then the second plays right after it? I can just play the first Sound and then the next right after it, but it would be much cleaner to combine them before playing the audio.
View 1 Replies
Jun 14, 2004
I have a streaming sound that is loaded into my flash movie (will end up on CD) that is very distorted, it sounds like someone is slowing down the audio, the voice sounds deep and slow
View 1 Replies
Apr 26, 2010
tell me if there is something wrong with this? playbtn_mc is a button with that instance name.... The button is on the main timeline not in another mc, I tried _root.my_sound.start(); also. The mp3 name is correct and is in the same folder as the fla and swf
playbtn_mc.onRelease = function(){
var my_sound:Sound = new Sound();
my_sound.loadSound("backtoschool.mp3", true);
my_sound.start();
}
I've been to the kennybellew as2 tut but cant seem to get it working with onload?
View 1 Replies
Jul 27, 2008
I'm using Flash CS3, running code in ActionScript 3. I use the Loader class to load a child SWF file, which then takes over the entire area on my website that is reserved for Flash. If the user decides to stop watching the SWF file before it is completed, he hits the "close" button within the child SWF, ultimately causing the Loader.unload() method to be executed. So far, so good, only the sound from the remaining portion of the SWF file keeps playing. According to the Flash Docs for the Loader.unload() method:
"As a best practice, before you unload a child SWF file, you should explicitly close any streams in the child SWF file's objects, such as LocalConnection, NetConnection, NetStream, and Sound objects. Otherwise, audio in the child SWF file might continue to play, even though the child SWF file was unloaded."
It then gives an example that assumes you already have access to the Sound object, so closing the Sound object is done by: mySound.close();
The only problem is that I have no idea how to access the Sound object when I use the Loader.load() method. I can't seem to find anything in the documentation that tells me how to find the Sound object after calling Loader.load(). As a temporary fix, I modified the target SWF file so that when the "close" button is hit, it calls the "stop()" function; however, this only stops the sound, it does not close the associated Sound object, and I presume it continues to lurk around in memory with nothing useful to do. (When the user hits the "close" button in the child SWF file, it creates a "bubbling" event so that the Loader class can call the Loader.unload() method on it.) I've attached code for your reference.
View 13 Replies
Mar 22, 2010
I'm recording and playing back mic input using Flash Media Server, and even though it's just audio, we're saving the output as FLV. I'd like to get a waveform of the recorded audio. Ideally, since we already have a lot of saved/recorded audio, I'd like something that can take a loaded FLV and get the waveform, as opposed to generating it at record or playback time.
AS3 has the new Sound.extract() method that can be used for this (plenty of online tutorials), but it seems like it only works for MP3. Is there a way to use this method on FLV audio? Or is there another to extract a waveform from a FLV?
View 1 Replies
Jan 18, 2012
In AS3 i've created a code that load a sound and execute it in streaming.
var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
mySound.load(new URLRequest("surrender.mp3"));
myChannel = mySound.play();
Considering that the mp3 file is placed on the server, i need to trace if it's already begun or still receiving initial data from the server. Once it's effectively started i've to call a function that initialize some things.
how i can trace if a sound or channel object "is playing" ?
View 2 Replies
Jan 27, 2009
Has anyone got an angle on the interference that linkage can create when the "export in first frame" option is ticked? I am using attachSound and the sound object to load an mp3 but it is wreaking havoc with the preloader.If I uncheck the "export in first frame" box the sound does not seem to be instantiated. I believe that a way around this is to drag the sound onto the stage, but if you have 8 sounds for buttons for example, then you would have to create 8 sound layersMy preloader code is:
Code:
stop();
_root.preloaderGraphics._visible = false;
[code]....
View 9 Replies
Dec 8, 2010
I am feeding a player from xml, and I'm not able to get the track to change.
ActionScript Code:
private var _currentTrackNum:int;
public var playlistdata:ArrayCollection = new ArrayCollection();
public var locationarray:Array = new Array();
[code]....
The previous track function is basically the same. It does nothing, however. I can trace out _currentTrackNum and see that changing, but the song playing stays the same, even if i stop and start again, or build the stopping and starting into the function. BUT. I can change the value of currentTrackNum at the outset and it wil effect which song plays.. !?
I'm thinking maybe there is some kind of sound.unload function I need to try, but am quite confused as to why it doesn't work. The locationarray.length is coming out as 0 for some reason I don't fully understand, so I disabled that 'if' statement for incrementing track number but that didn't help..
View 3 Replies
Jan 7, 2012
i'm creating an interactive experience and I need to move a bar on screen reacting to the volume of people sreaming at a microphone. Like a CLAP-O-METER... is this possible with ActionScript?
View 1 Replies
Nov 28, 2005
I have a movie with three songs using the following code in frame 2:
Code:
song1 = new Sound();
song1.attachSound("song01", "song001", 1);
song2 = new Sound();
song2.attachSound("song02", "song002", 1);
[code]....
In frame 1 i have the following preloader script:
Code:
this.onEnterFrame = function(){
tb = this.getBytesTotal();
lb = this.getBytesLoaded();
[code]....
and a text saying that the sound is loading. But when I play the movie i doesn't show the text.
View 4 Replies
Apr 5, 2006
I can't seem to figure out how I set the volume of a single sound object. Everytime I use setVolume on a sound, it is applied to *all* sound objects playing The code that I'm using :
Code:
music = new Sound();
music.attachSound("music");
[code].....
View 1 Replies
Jun 8, 2009
I'm creating a bunch of movieclips, associating a sound object with them, and then updating them with a progress bar, like so:
var theClip:MovieClip = new MovieClip;
theClip.track = new Sound;
[load sound from URL pseudocode here]
theClip.track.addEventListener (ProgressEvent.PROGRESS, onLoadProgress);
function onLoadProgress (erogressEvent):void {
How do I reference the movieClip the sound is a child of? e.target refers to the sound object; e.target.parent returns an error. And you can't assign properties to sound objects.
View 1 Replies