ActionScript 3.0 :: Swapping The Sound Files?
Sep 17, 2010
I am working on a Flash / AS3 project which has several audio tracks and starts off with an intro track. When the user clicks a button a window opens and the audio track changes, the new audio track continuously loops until the user closes the window. When the window is closed the audio track switches to a default audio track which is similar to the intro track. The problem I am having is that when the user clicks on the button and the window opens, the audio track plays as expected, but when it reaches the end, it doesn't loop, instead the intro track starts to play instead (and loop I assume).
Here is the code I am working with:
Code:
package {
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.MouseEvent;
import flash.media.Sound;
[code]....
I included trace statements to track what the value of "music" is doing. It appears that when the function repeat() occurs, "music" always seems to default to the intro music "audio/track-intro.mp3".
View 1 Replies
Similar Posts:
Aug 9, 2004
I am new to actionscript. I have created a script that will play server side sound object and client side mp3 files alternately. Now, I would like to play the client side mp3 first then only play server side sound object alternately. However, I have no idea how can I do so. The following is the code that need to be swapped:
[Code].....
View 2 Replies
May 2, 2010
I'm working on a game that loops a random sound file everytime the user goes to the menu. When I tried the simulate download in the preview menu, it took a long time to load the first frame (which is a preloader). I found the problem was that in the linkage for the sound files I said "Export on first frame" so i unchecked that box, but then when I tried playing again, the sound wouldn't load.So, I'm wondering, is there a way to play sound files through ActionScript without having to load them on the first frame?
View 1 Replies
May 6, 2009
If I use Publish Setting and choose a different folder for the .swf and .html file that Flash CS3 will be generating then the audio/sound will not work when open the .html file in a browser. However, if I choose to the "Publish" option or "Publish Setting" but choose the same folder for the .html and .swf folder then the sound will work when opening the .html file inside a browser.[code]
View 3 Replies
Jan 6, 2011
No matter the format no matter what the bit rate is, I can't import ANY audio files into flash CS4 without getting the error "One or more files were not imported because there were problems reading them"
This happens both when I import to the stage and import to the library. Please if you know anything about this issue please help otherwise the whole flash program is useless for me.
Also I found online that installing quicktime fixes the issue. It didn't work for me, I've reinstalled quicktime 3 times to make sure.
View 9 Replies
Dec 2, 2011
I have a problem while trying to import any sound file into flash CS5.5. I have not successfully done it since purchasing the program. I have tried opening the file in a sound editor and saving it, as well as trying to convert to a different sound type that is still Flash compatible. I'm trying with .mp3 and .wav files mostly. The error messages i receive are "Couldn't import C://*file location* or else i get"One or more files were not imported because there were problems reading them." I havent figured out a pattern as to why either might be showing or the connection to the file.
View 1 Replies
Nov 26, 2008
can we play audio "swf" files along with mp3 files in as3?
View 1 Replies
Jun 7, 2011
I had imported some sound files into an fla (CS5) and then i accidentally deleted the files.So those sounds are present as symbols in the fla. How do i export/extract those files from the symbols?
View 2 Replies
Nov 21, 2002
I've am trying to create a sound control to control the sound of an imported FLV file. The problem is like this. I recorded a video using a video camera and than using the iMovie, I've converted the movie to QuickTime format. Than I use Sorenson Squeeze for Flash MX to compress the video. I manage to compress the files into FLV format and than imported it to my Flash file. Now I want to add a sound control to the movie to control the volume.
View 2 Replies
May 7, 2009
From the Sound Class information, it says to use the SoundMixer Class to handle embedded Sound Files. I have two sound files embedded, that I have setup in 2 separate layers, starting at frame one in the main timeline. I needed to do this so I could see the wave files, and coordinate text with the waves. I do not want to load these files into the .swf file at runtime using URLRequest. How do I get a handle on those as they exist, to make each controllable by separate volume and mute controls for each sound?
This will be a challenging question, because, "it can't be done" doesn't work for me. I managed to create a way to use an external classfile to control the main timeline, the ROOT timeline, without having to create a sub movie to root. I can use my component to call play(); as though it were in code in a frame. But it isn't, it's in an external classfile. I passed root to the classfile and told the classfile to think of it as a movieclip - that put the handle on it. I tried similar way with root as a Sound, but that isn't detailed enough - I need to get a handle on the frame that contains the embedded sound file. I embedded, attached it, using the properties view for the frame.
I've attached, or whatever you want to call it, these sound files to a frame, and this frame is or should be attached to the layer I've created. So, under the assumption that the ROOT has everything attached to it in some manner (it is after all the foundation for the COM), the stage of the root contains the visual components, so ROOT has to have the layer objects attached to it, which should have the frame objects attached to the layers. I have two layers that each have a .wav file attached to frame one. Somehow Flash keeps track of that - I want to know how Flash does it so I can read what flash reads.
View 1 Replies
Jun 14, 2009
I am trying to import a swf I made that contains streaming sound. When I place it on the time line and press cntr enter my animation plays but with no audio. I see the symbols from the swf and the swf inside my library. When I open the swf file inside my project it is broken down frame by frame with no audio. I can add audio back into my movie clip so I know that movie clips can support streaming audio. But I would rather not have to do this.
I'm very new to flash so I am hoping there is something big that I am missing.In addition to my previous question: I need to embed a lot of objects over and over in this project I am working on. Each object will have controls for play back of itself. Is there some reason I cannot do this?
View 6 Replies
Jul 28, 2009
I am trying to put a few songs on a website, not as an .mp3 player, I just want to be able to assign individual buttons to control them.ow, and it works great. I would like to now how to add more and assign them to their own buttons seperate from the other songs.This is the code I have for one song
var url:String = "";var urlRequest:URLRequest = new URLRequest(url);var sound:Sound = new Sound();sound.load(urlRequest);var sc:SoundChannelvar startTime:uint=0;
playBtn.addEventListener(MouseEvent.CLICK,playF);stopBtn.addEventListener(MouseEvent.CLICK,s
[code]......
View 5 Replies
Sep 28, 2009
I imported 26 .mp3 files into my library, and linked their classes via AS3 to 26 instances of buttons.
My file size went from about 2MB before I imported them to about 1.6 GB after I imported them. Each of the files is only about 2-3 MB.
View 2 Replies
Feb 7, 2011
A wav or mp3 file will be taped or various. Is there any script to edit these files in batch ie: to Trim the beginnings ie: no sound parts. Or would I have to use a sound editor. As I say I don't want to do it manually. This sounds like a stupid use but it's important as I have children taping themselves and can't use a 3 party product to edit. Perhaps AIR has something in an API.
View 7 Replies
Feb 26, 2011
Is there any simple way you can access a very short sound file in flash without having to play it in an flv player. its just a ding sound to play when the user hits a button in the presentation.Also is it possible to access an external pic file and then convert it in to a symbol to be used within my presentation.I just don't want to store these files to keep my main swf small.
View 3 Replies
Feb 24, 2011
I loaded a flv into a uiloader. I have 4 buttons which load different projects in. A quiz, an animation and a video. Works great apart from when you click the buttons either the flv sound remains or if you click the flv button I have multiple instances of the audio. The main file AS3 is
[Code].....
View 0 Replies
Jan 15, 2007
The quick question is I can only get this to play sound once - then it won't do it again I am making a math game for my young kids - it adds numbers from 1 to 5 the variables A & B are randomly generated and make C
The sound reads out a string A + plus + B + equals + C (5 sound files)It does this the first time the flash is played, however, when the flash movie goes back to the previous frame, and generates new variables - it will not play the sound files anymore.
[Code]...
View 1 Replies
May 8, 2002
I did this e-card, and it seemed fine. Then I played it on another persons computer (both PC), and the sound failed to work. I'm using Flash 5. Other e-cards with sound produced by other people worked fine. So here's my code. On the first frame (root) I have:
[Code]...
View 4 Replies
Jun 24, 2009
I'm having a little issue with the sound on my flash website. The way my site is set up so far is that after the preloader, i have an enter site page that holds there until the user clicks on the "enter site" button. Once they click that button it takes them to the site. I would like to add 2 different sound files to this. One file for the enter site that loops over and over until the user enters the site and then that sound file will stop and the other sound file will start.
When I tried this I could not get the first sound file to quit playing once you enter the site. So basically when I am on the "enter page" it's playing the looping file fine but when I click "enter site" it plays the other audio file on top of the one looping. I hope this makes sense.
View 1 Replies
Nov 18, 2009
Say I recorded and imported sound files of my voice saying "Two", "Four", "Equals", and "Plus"Would it be possible to have Flash on click string together those sound files like a string so that the user would hear:
View 1 Replies
Mar 21, 2011
I'm porting a simple application from browser-based to iPhone. It plays some external sound files. There are 2 main steps:
1) Load an external XML file that contains sound file paths.
2) Load the sound files.
Can this be done with iPhone or do I need to move everything into the .fla file and then just publish it to iPhone?
View 3 Replies
Nov 11, 2010
Is it possible to play multiple sound files using a single sound object? (I've looked into this back when I was using Flash CS3, but I want to know if anything has changed.)
(I'm trying to make a playlist which will play music in the background of my SWF movie and then have a frame where users can change the song and the volume.)
View 2 Replies
Jan 22, 2011
I have a set of sound clips to be played one after another in a sequence with couple of time interval inbetween. In my case, its a question - followed by the set of four options.
When I write the below code, all the audop files start together at same time. How can I had time delay inbetween, so that the second clip plays only after the first one is over, and the third one starts playing, only when the second option is over.
[Code]...
View 3 Replies
Jun 23, 2009
I'm having an issue with sound that I'm playing from the library. With longer sound files, whenever I specify an offset in the play() method that's greater than 1000 milliseconds, it ends up messing the sound files timing. Specifically, it cuts about 1 second from the end so the sound file ends abruptly. I was wondering if any one else was having a similar issue.
View 0 Replies
Sep 25, 2009
I've created an audio player with actionscript 3 which plays one of 55 different sounds, depending on a variable set from which button a user clicks on. It works fine for the first 1 or 2 plays, but after that the sound begins to double-up, or even triple-up. I'm using the code below./First I declare a few variables:
var sound:Sound;
var controller:SoundChannel;
var pausePos:Number = 0;
var audioReset:Boolean = false;
var playerObject:Object = new Object();//
The sound functions are placed within another function so that it can be called again once a new button is selected:
function audiofunc() {
//if the user is selecting a second audio file, it runs this "audioReset function to try to clear the EventListeners[code]....
audiofunc(); I'm assuming that somehow an EventListener isn't getting removed, so it's causing a few versions of the audio file to play at once. If I trace the value of pausePos, it starts to appear in multiples (the same number, but 2, 3 or 4 times) after a few plays of the different audio files.
View 2 Replies
Oct 13, 2009
created a simple MP3 audio player, not dissimilar to the popular wordpress audio player seen here (ie, the mp3 is loaded via url like mp3player.swf?filename=mysong.mp3)With this audio player, if it is used multiple times on the same page, only one can actively play a song, which avoids multiple songs playing simultaneously. If you attempt to open more than one, the last one will play and the previous one will automatically stop playing the song and revert to a "closed" state.With regards to automatically stopping previous instances from playing in the background, my question is how do I achieve this same effect with actionscript?
View 2 Replies
Sep 3, 2004
I have a site where as you click links, you move forwards through a city. I want to fade sound files in and out, overlapping, depending on where you are in the city. (The site is [URL]). As yet, I can't have two sounds playing at once. I have found a site with the effect I want, it's at [URL]. (Great site, by the way)
My code is as follows. I have two sound loops at the moment, one of cicadas, one of a city at night, both saved as separate .swf files, which I have loaded onto the main timeline on layers 14 and 15. The code for the two loops is:
cicadas.swf, FRAME 1
var volPercent = 20;
cicadas = new Sound(cicadas);
cicadas.setVolume(volPercent*2);
city.swf, FRAME 1
var volPercent = 20;
city = new Sound(cityMC);
city.setVolume(volPercent*2);
Once I load these two onto different levels, I get no sound. If I delete one, the other will play. I have tried loading the sound objects into empty movie clips, but then the entire file has to load before it will start playing. I need a way to stream multiple sound files, and have control over their volume.
View 4 Replies
Nov 11, 2009
I am working on a simple game for kids. The game revolves around the alphabet and it is all voiced. So I have a good number of sound files that I need to call on at any given moment.In AS2 I would just link all of the sound files to variables at run-time and have them ready to play when the interaction dictated it.... with the way "linkage" has changed in AS3... I feel like it would be a bad idea to have over 50 different class files (one for each sound file) so I am looking for a cleaner solution... that and I am guessing that having redundant class files misses the point.I haven't had much luck finding a forum post or tutorial that talks directly about this type of issue but the idea is a little foreign right now so I am sure I have stared directly into the gold mine and not noticed. I am very interested any thoughts or links on the subject.
View 1 Replies
Jan 14, 2010
I am working on a project and I want to know if it is possible for flash to control the playback speed of sound files (mpeg). I dont care if they are external or imported since the project will only run locally. IT is a game where I want to slow down and speed up the sounds playing.
View 3 Replies
Jan 28, 2010
I am curious about where I can find sound files that I can use in Flash CS4 or some software that may be usefull in creating/editing/converting sound files to .wav or .mp3 for use in Flash. I should probably also note that although I do have Flash CS4 I am very low on funds for software
View 2 Replies