Sound Fx Problem
For some reason my sound FX layer wont work on my final movie. not a single sound will come out in the finished movie, when i test movie, or export movie. They play on the workplace will play the sounds but nowhere else. I can get sounds working in other movies.. just not this one.. any idea? thanks... .fla is to big. ill email it to you if you want. thanks
Sully
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Attach Sound, Play Sound & Stop Sound.
Hey there,
I was wondering if any of you could help me please.
I want to play a song which I have named "rundmc" The file extension is ".mp3"
I want a button to play this mp3 which I read you need to attach that sound, then play it and I want to a button to stop that sound, or preferably the play button to change into a stop button.
I've read the help files, but none of it works and I've changed the linkage for the mp3 to export for action script, but nothing works!!!
Please help,
NK.
Problem: [sound].setVolume(x) Controling Two Sound Objects In One Call...?
Hi there, hopefully some or at least one of you will be able to figure this out because it's wrecking my head!
Basically I'm writing a little looper player movie, that will play [x] number of techno/jungle/house/whatever music loops at the same time, and the user will be able to switch loops and turn loops on and off whenever they want to. I'd like to avoid putting sound in the timeline so I'm using sound objects to trigger the sound properties.
For a test, I've created two sound objects (these will later be in a 2D array), but for now- just two sound objects, I've attached the sound to the links in the library, and set the volumes on both sounds to 0. Both WAVs in the library have the linkage on "Export this symbol" and they are labelled/identified as "loop1_link", and "loop2_link"... (obviously without the quotes in the properties box). Here's the code:
// ---------------------------
loop_test1 = new Sound();
loop_test2 = new Sound();
loop_test1.attachSound("loop1_link");
loop_test2.attachSound("loop2_link");
loop_test1.setVolume(0);
loop_test2.setVolume(0);
loop_test1.start(0,999);
loop_test2.start(0,999);
// ---------------------------
So the sounds are triggered when the movie loads, and the start playing silently in the background for 999 loops.
Here's the problem:
In the interface of the movie, on click of a play button, I'm making a call to _root.loop_test1.setVolume(100) to turn that sound on, but when I make that call, the volume is set to 100 for BOTH loop_test1 AND loop_test2 !! I'm hearing both loops playing at the same time and I only want to hear just the one. Makes no sense to me because I'm only telling that ONE sound object to set it's volume to 100...
Any ideas? Any feedback/comments would be greatly appreciated.
Cheers,
Anthony
-Dublin, IE
.stop() For Sound Object Stopping Embedded Video Sound
I have a problem where the stop funtion for a sound object is stopping the audio in an embedded video. Has anyone ever encountered this? Ihave poured over my code and there is no cross-linked intance names, so I do not have a clue what is happening.
Is It Possible To Change The Sound Volume On Individual Attached Sound Clips?
For instance, I have 2 attached sound samples, both playing continuously. I want to be able to control the volume for both separately.
All I know I can use is setVolume, but that one seems to be global only and changes the volume on both.
I tried having different names on the attached sounds (sound1, sound2) and had the volume buttons refer to sound1.setVolume and sound2.setVolume, but each of them controlled both sounds. Also tried attaching the sounds into individual MCs, but got the same result .
So, can this be done?
Edit: oh, there was a forum for sound and music, my bad. Can seem to find how to delete this thread so have to leave it here or if some mod moves it.
Edit2: Ok, think I got it to work, was trying this method before posting (from FAQ), but couldn't get it to work... might have now... buggy it seems.
Quote:
Why is my sound object controlling volume or pan of all sounds in the movie?
a sound object without an associated mc is a "global" sound object and controls volume and pan of all loaded sounds.
to ensure that a sound object controls just one sound pass the target path of a unique movie clip to the sound function.
myuniquesound = new Sound(target path to unique mc);
OR
// dynamically create a mc and associate it with a sound object
soundobject = new Sound(createEmptyMovieClip("snd",getNextHighestDep th()));
Edit3: Problem solved .
AS3 - Sound Bug - Multiple Copies Of The Sound File Plays/loads
AS3
I have a script that loads an mp3 file. Then, there is some visualization with to the music. When first loading the flash file, there is one copy of the sound. When the flash file is loaded again, there are multiple copies of the sound file being played. When I used the stop button it only stops one of the copies.
Here is the script:
var url:String = "currentMix.mp3";
var request:URLRequest = new URLRequest(url);
var s:Sound = new Sound();
s.addEventListener(Event.COMPLETE, completeHandler);
s.load(request);
var song:SoundChannel = s.play();
song.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
var ba:ByteArray = new ByteArray();
var gr:Sprite = new Sprite();
gr.x = -850;
gr.y = 25;
var blur:BlurFilter = new BlurFilter(2, 8, BitmapFilterQuality.HIGH);
gr.filters = [blur];
addChild(gr);
var time:Timer = new Timer(10);
time.addEventListener(TimerEvent.TIMER, timerHandler);
time.start();
function completeHandler(event:Event):void {
event.target.play();
}
function soundCompleteHandler(event:Event):void {
time.stop();
}
function timerHandler(event:TimerEvent):void {
SoundMixer.computeSpectrum(ba, true);
var i:int;
gr.graphics.clear();
var mat:Matrix = new Matrix();
mat.rotate(1.57079633);
gr.graphics.beginGradientFill(GradientType.LINEAR, [0xFF0000, 0x000000], [1, 1], [66, 175], mat);
gr.graphics.moveTo(0, 0);
var w:int = 5;
for (i=0; i<550; i+=w) {
var t:Number = ba.readFloat();
var n:Number = (t * 55);
gr.graphics.drawRect(i, 0, w, -n);
}
}
//tracking playing
var isPlaying:Boolean=true;
var pos:Number=0;
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
play_btn.addEventListener(MouseEvent.CLICK, playSound);
pause_btn.addEventListener(MouseEvent.CLICK, pauseSound);
function stopSound(e:Event):void
{
song.stop();
nowPlaying.stop();
pos=0;
isPlaying = false;
}
function playSound(e:Event):void
{
if(!isPlaying)
{
song = s.play(pos);
nowPlaying.play();
isPlaying = true;
}
}
function pauseSound(e:Event):void
{
pos = song.position;
song.stop();
nowPlaying.stop();
isPlaying=false
}
stop();
How To Control The Sound Volume On A Timeline Base Streaming Sound?
Hello everyone,
I have a MovieClip "Animation" with added sound as a Streaming. I have also created a Volume SiderBar which I would like to use to adjust the volume of the sound on my Flash.
The Volume SliderBar work fine and I need to some how assign the volume to the position (Value of) volume. I was wondering if someone can tell me how I can do this on a sound which is timeline based?
Thank you very much and have a great day,
Khoramdin
How To Use A Value Of A String Variable As A Sound Class (as Linkage Name Of A Sound File)?
Hi,
I need to use the value of a string variable as a linkage name of the sound imported in the library, I have this code:
var SoundArray:Array=new Array;
SoundArray[0]="S1";
SoundArray[1]="S2";
SoundArray[2]="S3";
var MySound = new SoundArray[0];
B1.addEventListener(MouseEvent.CLICK,PlaySound);
function PlaySound(event:MouseEvent) {
MySound.play(0,0);
}
where S1,S2,S3 is the name of the classes in the linkage name for the 3 sound files in the library.
I get this Error for the highlighted line of code:
TypeError: Error #1007: Instantiation attempted on a non-constructor.
at Untitled_fla::MainTimeline/frame1()
How Do I Call Sound Files For A Sound Player Created In Flash
I want to create a sound player for a website in Flash 5. However, i do not know how to play the files without importing them into the flash movie. If i imported all of the sound files i am using, my flash file would end up being about 25meg in size. This would obviously be stupid, as it would take forever to load up. Could someone please tell me what action i eed to use to play a sound file which is stored in the same directory as the swf file.
Im only just learning flash so im not 100% sure that this is the way to do it. Is there a way of telling flash flash to only load a certain part of the movie as it is neded.
I want to create something similar to the player found at this address
http://www.newfoundglory.com/player.html
Any help you can give me would be much apreciated
Thank you
David
Sound Problem. Doesnt Sound That Complicated But No One Has Answered Yet.
im posting this question for the third time now, because noone has answered it before or the answer didnt help. so if you know how this is done please answer. for my animation site, i have a song in the beginning. and when you click on animations i want the song to PAUSE and have the movie go to a different frame. so something like
on (release) {
gotoAndPlay (99);
sound.pause
}
except have it work(lol).
and when the user clicks back, the sound would unpause.
thanks in advance.
Sound Control Volume For Multiple Sound Objects?
I've got a file with several scenes.
Each scene has controls with different sound object defined on the first scene. There is a constant background sound object playing over all scenes. I need to control the volume of multiple sound objects playing simultaneously and setting each to different volumes from these scenes.
e.g
_root.bgmusic.setVolume(20);
_root.s001.setVolume(100);
can this be done? When I try, all sounds playing are set to the same volume.
Thanks heaps in Advance!
Stoping And Playing Sound At A Particular Point (using Sound Object)
Hi,
I have a movie in which i have a voice over and some animations which is in sync with the VO. I have a play button and stop button.
I am using the sound object method to play the sound and the animations are in timeline.
I have to stop the movie at any point in time and when i click on play the sound should start from the point where it stopped..But it is not happening.
Please help me..
am having a deadline today..
lamus
Sound Control Volume For Multiple Sound Objects?
I've got a file with several scenes.
Each scene has controls with different sound object defined on the first scene. There is a constant background sound object playing over all scenes. I need to control the volume of multiple sound objects playing simultaneously and setting each to different volumes from these scenes.
e.g
_root.bgmusic.setVolume(20);
_root.s001.setVolume(100);
can this be done? When I try, all sounds playing are set to the same volume.
Thanks heaps in Advance!
Adding Sound Buttons, Cutting Off Prev Sound
Hi - I want to add a few audio narration clips via buttons to this page, inside each section:
http://www.chartscans.com/csalerts.swf
When the movie starts, it autoplays a bg music + narration nonlooped single track.
How can I add say a button that loads/plays an external mp3 And also shuts off the first sound that had started?
any ideas?
thx flash dudes..
Is Sound.onLoad Triggered When Sound Fully Loaded?
Hi everyone,
i'm loading mp3s as event sounds into empty movie clips.
i'm getting confused about how/when exactly the sound.onLoad event is triggered.
If onLoad is triggered, does that mean that the sound has been fully downloaded? Or could onLoad success be true if the player has successfully started loading the mp3 file, but hasn't fully downloaded it yet?
So far i'm only aware of onLoad success being false if flash can't find the file to load. Is there anything else that could result in onLoad success being false?
I don't care much about displaying download progress, so if onLoad is only triggered when the file is fully downloaded (or if there's been an error trying to download), then is there any point in me using a sound preloader to check if all bytes are loaded? Couldn't i just do what i want to do with the sound when onLoad success is true?
Any advice would be much appreciated.
Thanks,
Skinnyot.
Glitch With Sound.position And External Mp3 Sound Object
Hi,
I am in the midst of build a flash mp3 player and have chosen to load all of my mp3s externally and streaming using this method:
sndAudio.loadSound(track01, true);
The problem I am running into is that when track01 starts playing and I switch to another sound i.e.:
sndAudio.loadSound(track02, true);
the value in sndAudio.position doesn't get reset. This is causing havoc for me in my pause function and my counter as well... I am guessing I have to somehow delete the sound object and repopulate it when I stop a sound or start a different one but I am having trouble figuring this out. Has anyone had any luck with this before? Here is how I am initializing my sound object:
this.createEmptyMovieClip("mcSoundHolder", this.getNextHighestDepth());
var sndAudio:Sound = new Sound(mcSoundHolder);
I am running Flash MX 2004.
Thanks to anyone who can lend a hand,
Cheers,
T-Dawg.
Stop Sound File Early (using Sound Object)
I know I can use the play() method of the Sound object to offset the beginning of a sound. Ex:
mySound.play(2000) - plays the sound beginning at 2 seconds
Is there a way to get a sound to stop early? For example, if it is a 20-second sound, can I get it to stop at 18 seconds? Thanks!
How Do I Load External Sound Into A Movieclip Vs. A Sound Object?
I have a sound player movie clip that is designed to play the sound loaded into the parent movie clip. In particular, it uses "_parent.gotoAndPlay(targetFrame);" to start playing the sound. And it works well for statically loaded sounds.
However, how can I use this sound player movie clip with dynamically loaded sounds? The player requires a sound to be loaded into the parent movie clip, but the only way I know of loading an external sound is instantiating a new Sound() object and then using .loadSound(...). But loadSound doesn't load the sound into a movie clip.
So, how do I load an external sound into a movie clip versus a Sound object?
Thanks!
On Press Play Sound On Release Stop Sound
I have a button that is inside a movie clip 'forward'.
When you press the button it plays another movie clip 'time' forwards
on (press) {
forward = "1";
}
on (release, rollOut, dragOut) {
forward = "0";
}
on the button and:
if (forward eq "1") {
tellTarget ("/time") {
nextFrame();
}
}
on the first frame of the 'forward' movie
I would like sound to happen when you press the button and stop when you realease the button
but I not sure how any help would be gratefully excepted
Sound.position And Sound.duration On Flash Lite 2.1
I'm using the code below to trace the position and duration of a loaded mp3 file. This works fine when I export as normal flash 9 version swf, though when I export as flash lite 2.0 or 2.1, the trace returns 0 for both position as well as duration. Here is suggested that the two members should be available for all flash lite 2.x versions. Is there a way to find the duration and position of an mp3 file in flash lite 2.x? Am I doing something wrong?
Thank you in advance,
Harry
Attach Code
var mySound:Sound = new Sound();
mySound.onLoad = function(success){
if(success == true) {
mySound.start(0, 0);
}
}
mySound.loadSound("sound.mp3");
function onEnterFrame() {
trace(mySound.duration + " " + mySound.position);
}
Edited: 02/05/2008 at 08:42:28 PM by Harry Vermeulen
Random Sound Load And Start Is Speeding Up The Sound. Any Help?
Hello,
My first post here at Kirupa. I thought I'd give it a try.
I'm trying to load sound dynamically into a clip and then play it randomly. The AS I came up with works great if the sound is embedded and I use the .attachSound() method instead of loadSound(). Now, when I load it dynamically and use the code below, the sound plays very fast and at a higher pitch.
I'm new to AS. Any help or insight into the issue would be much appreciated!
Thanks everyone!
ActionScript Code:
var crows = new Sound(this); crows.loadSound("Raven.mp3", false); crows.setVolume(100);rNum = function(){ var i = 0; var randNum = Math.round(Math.random()*500); if (i>=randNum) { crows.start(0, 1); }};randSound = setInterval(rNum, 100);
_global Sound Element/ Shared Object Sound
THIS IS DRIVING ME CRAZY
Im programing a childrens game that teaches music.
Needless to say there are a lot of sounds involved, so natuarrally I only want the sounds to load one time then just be referanced later to be played.
However, this game consists of about 10 different .swf files, that jump back and forth depending on user navigation.
I have tried defining the sounds as _global like so
_global.mysound = new Sound ();
_global.mysound.loadSound("noise.mp3")
playsnd = function(){
_global.mysound.start(0,0)
}
However this will only play in the clip it was defiend in, and I need it to be able to be called from any of the .swfs
I use this code to transpher between movies
unloadMovie(this)
loadMovie("new", this)
I have also tried converting the sound to a Shared:Object but it two only plays in the clip it was defiend in
user_so = SharedObject.getLocal("sndz");
_global.sndz = new Sound(this);
sndz.loadSound("soundz/parry.mp3");
user_so.data.song = _global.sndz;
_global.playsnd = function() {
trace("getting called");
user_so.data.song.start(123, 1);
};
user_so.flush();
OMFG, I have a deadline on Thursday, and I have not been making any progress
PLEAS HELP!!!!!!!!!!
Stopping Timeline's Sound But Continue The Video's Sound
Hi folks!
I need help to solve this problem. I can't seem to get it work out.
I have a music playing in Timeline (looping forever) when the flash site starts.
In some sections of the flash site, there is a video section where users can watch a video.
When the video is played, I would like to stop the sound in Timeline so it doesn't interfere with video's sound.
For loading the video, I am using Video Object, the code is simply:
var my_conn:NetConnection = new NetConnection();
my_conn.connect(null);
var my_stream:NetStream = new NetStream(my_conn);
my_video.attachVideo(my_stream);
my_stream.setBufferTime(3);
Many many thanks in advanced for your help!!
ps: I have tried following links, but no luck to me.
http://www.kirupa.com/forum/showthre...ht=sound+video
http://www.kirupa.com/forum/showthre...ht=sound+video
http://www.kirupa.com/forum/showthre...ht=sound+video
Drag N Drop Sound Vs Actions Script Sound
I've been putting together a flash demo the last few days, and until recently, I have always dragged the sound onto the stage and then modified it through the GUI (fade in/fade out etc.).
Before starting this project, I thought I'd do a little research into the new action scripting sound object from Flash 5 onwards, seeing as it seems to be 'the way to do it'.
Long story short, the action script sound object method seems like a huge pain in the a$$. It's slower to implement than just dragging and dropping it on the stage. Fading in/out is a hassle, and I really can't see the use of this technique.
Please convince me why I should keep working at learning this new technique, rather then just going back to the old way... Or, if you think the old way is still useful, let me know your opinion.
I'm usually all about keeping current with web dev trends, but I'm getting a little disheartened .
Thanks!
Turning Flash Movie Sound Off If Other Sound Begins?
Hello -
I'm not an expert Flash guy so I appreciate your help.
Currently there is a flash file with a sound file that plays continuously while a visitor is on the site. There have been new additions that add the ability to add sound files to different items.
How can I get the main flash sound turned off whenever one of the items with a new sound file begin to play?
Loop Sound ( Sound Class Preloader By Moock)
how can i loop the sound if i use the sound class preloader by collin moock?? here its the code :
ActionScript Code:
Sound.prototype.checkLoadProgress = function() {
var kbLoaded = Math.floor(this.getBytesLoaded()/1024);
var kbTotal = Math.floor(this.getBytesTotal()/1024);
var percentDone = isNaN(Math.floor(kbLoaded/kbTotal*100)) ? 0 : Math.floor(kbLoaded/kbTotal*100);
this.onBytesLoaded(this.getBytesLoaded(), this.getBytesTotal(), kbLoaded, kbTotal, percentDone);
};
Sound.prototype.clearLoadCheck = function() {
if (this.loaderID) {
clearInterval(this.loaderID);
}
};
Sound.prototype.preloadSound = function(url, isStreaming) {
this.clearLoadCheck();
this.loaderID = setInterval(this, "checkLoadProgress", 200);
this.loadSound(url, isStreaming);
};
music = new Sound();
music.onLoad = function(success) {
this.clearLoadCheck();
if (success) {
loadMsg_txt.text = "Done loading.";
} else {
loadMsg_txt.text = "Load failed.";
}
};
music.onBytesLoaded = function(bytesLoaded, bytesTotal, kbLoaded, kbTotal, percentLoaded) {
loadMsg_txt.text = "Loading: "+kbLoaded+" of "+kbTotal+"
"+percentLoaded+" percent complete.";
};
music.preloadSound("song.mp3", true);
thanks in advance
Sound Volume Control Using Streaming Sound In Timeline?
I am building a Flash 8 movie with animation that is synced to music in the timeline using streaming sound. At a few points I need the music to fade out and then play a video. When the video is done playing I need to come back into the timeline and have the music fade back up at the same point where it left off.
Is there a way to do this? turn down/up the volume of a streaming sound?
Sound Overlap When 2 Swf Play Sound At The Same Time P R O B L E M
Figure this:
I sen to my clients via mail an regular html with a swf embebed. They recibe the html and the flash starts playing the loop sound. Therere are, also the loop, severals sound trigered in different parts of the swf file.
the problem starts when my clients double click in the outlook inbox and the html pops up and there we have 2 html with 2 swf playing sound at the same time.
I tried stop all sounds at the begining of the movie. but it only stops the loop sound but not the trigered sounds of the rest of the time line.
is there a way to stop the sound of the first swf when the second pop up?
anyone?
Rollover W/sound , Stop Sound On Rollout
HI,
I've got rollovers w/sound, that are close to each other. When i roll over them, they ALL play...How do I stop sound on rollout WITHOUT stopping my Background sounds?
Help Appreciated, Thx
Rollover Sound On - Rolver Sound Stop
I am new to Flash but would like a little more control over a button sound than I currently understand. I would like a sound to play on rollover of a button but as soon as the mouse is outside that button, I would like the sound to stop. Is there an easy way to achieve this?
Thanks
Sound Causing Jerky Sound/video
in a flash movie i am making when a sound effect is streamed the movie get jerky as well as the sound for a second. I am pretty sure its not my cpu (3ghz 512 ddr). As of now.. i don't have a preloader but my whole movie is contained in the first frame of the main timeline. I heard somewhere that this means the movie will not start until everything is loaded. Anyway thanks for your help
Sound.getbytesload And Sound.stop() MXPRO2004
I've figured out a workaround for this, but was just posting to see if anyone has a better way to do this.
What I want to create is a streaming player that shows a bar of how much of the sound is loaded and an indicator on the bar of where the sound is currently at while playing. I would also like the sound to start loading as soon as the movie is loaded, but not start playing until the user presses the play button.
The problem I run into is if I stop the sound, the loading of the sound stops too. So, the only way to have the sound load is to also play it. The workaround I'm using is as follows:
When the sound first starts loading, I set the soundvolume to 0. If the user presses the play button, I begin playing the sound from the beginning. If the user presses the pause button, I record the duration of the sound into a variable, but instead of using mySound.stop(), I turn the volume to 0 and let the sound continue to play. If the user then unpauses the sound I start play from the duration number where it was last paused.
I'd like to be able to use sound.stop() on this, but I don't think it's going to work. Any ideas?
Synchronsing Sound Using Sound Object Method
before flash 7 you were able to synch the sound to the timeline with and option in the properties window (using the "stream" or "event" setting) - this would ensure any animation would keep up with the soundtrack, and if need be would skip frames.
how can you do this with the new sound object and actionscript??? - is there a method for it? at the moment im creating a new sound object and then use the attachSound method to bring the sound in from the library, but it doesnt automatically synchronise with the graphics on the timeline
anyone any ideas?
cheers
steve
Sound Controller Turns Off Video Sound...help
im trying find out why.......here is my set up
onClipEvent(load)
{
_root.soundstatus="on";
_root.mySound = new Sound(_level0);
_root.mySound2 = new Sound(_level1);
_root.mySound3 = new Sound(_level2);
_root.mySound4 = new Sound(_level3);
_root.mySound5 = new Sound(_level4);
maxvolume=100;
minvolume=0;
}
onClipEvent(enterFrame)
{
if(_root.soundstatus=="on") {step=5}
if(_root.soundstatus=="off") {step=-5}
maxvolume+=step;
if (maxvolume>100) {maxvolume=100;}
if (maxvolume<0) {maxvolume=0;}
_root.mySound.setVolume(maxvolume);
_root.mySound2.setVolume(maxvolume);
_root.mySound3.setVolume(maxvolume);
_root.mySound4.setVolume(maxvolume);
_root.mySound5.setVolume(maxvolume);
}
Sound Problems With In Custom Sound Class
im trying to make an Audio control Class... the class is working fine until i get to the add sound part..
i have two buttons, on and off.. when the movie loads, a looping background sound is playing, hitting off button will stop all sounds, the looping sound as well as the rollOver and Hit sounds...
how do i do this in my class code..
thanks
class SoundToggle extends Sound {
private var btnArray:Array;
private var lastClicked:MovieClip;
private var curBtn:MovieClip;
private var soundActive = true;
function SoundToggle(holder:MovieClip, btnLinkage:String, soundArray:Array, xSpace:Number, mySound:Sound, loopSound:Sound) {
//trace("soundToggle class instantiated");
// Init button array to keep track of all the buttons
btnArray = new Array();
//loopSoundToggle(true, "loopSound");
//_level0.mySound.attachSound("loopSound");
//_level0.mySound.start();
for (var i:Number = 0; i < soundArray.length; i++) {
// Attach button clip
var btn:MovieClip = holder.attachMovie(btnLinkage, "btn_" + i, holder.getNextHighestDepth());
//trace("btn" + btn);
// Store button's destination label
btn.myDest = soundArray[i];
// Set button text
setBtnText(btn, btn.myDest);
// Position button
positionBtn(btn, btn._width * i + xSpace * i);
// Position button on Stage
positionBtnStage(btn, (btn._width * i + xSpace * i + Stage.width / 2) - btn._width / 2, (Stage.height / 2) - btn._height / 2);
// Init button behaviour
initBtn(btn);
// Store a reference to the button to keep track of all the buttons
btnArray.push(btn);
}
}
private function setBtnText(btn:MovieClip, labelTxt:String) {
// Sets button label text
btn.labelTxtHolder.labelTxt.text = labelTxt;
}
private function positionBtn(btn:MovieClip, myXPos:Number) {
btn._x = myXPos;
}
private function positionBtnStage(btn:MovieClip, xPos, yPos) {
btn._x = xPos;
btn._y = yPos;
}
private function initBtn(btn:MovieClip, mySound:Sound, loopSound:Sound) {
// Initializes button behaviour
var thisClass = this;
// Sets On Button
for (var i:Number = 0; i < btnArray.length; i++) {
var theBtn:MovieClip = btnArray[i];
curBtn = btnArray[0];
//trace("curBtn " + btnArray[0]);
if (i == 0) {
curBtn.select = true;
lastClicked = curBtn;
curBtn.gotoAndStop("released");
curBtn.enabled = false;
} else {
curBtn.over = false;
curBtn.select = false;
}
}
btn.onRollOver = function() {
this.gotoAndPlay("rollOver");
//_level0.mySound.attachSound("rollOver");
//_level0.mySound.start();
}
btn.onRollOut = function() {
this.gotoAndPlay("rollOut");
}
btn.onRelease = btn.onReleaseOutside = function() {
_level0.playSounds("hit");
//_level0.mySound.attachSound("hit");
//_level0.mySound.start();
thisClass.lastClicked.gotoAndPlay("rollOut");
thisClass.lastClicked.enabled = true;
thisClass.lastClicked = this;
this.enabled = false;
trace(this + " this");
if (thisClass.lastClicked == _level0.btn_1) {
trace("sounds are off");
_level0.soundActive = false;
_level0.loopSound.stop();
} else {
trace("sounds are on");
if (soundActive) {
_level0.loopSound.start(0, 1000);
}
}
}
}
public function toggleBtns(val:Boolean) {
// Loops through button array & toggles each button
for (var i:Number = 0; i < btnArray.length; i++) {
var theBtn:MovieClip = btnArray[i];
// Ignore the currently selected button, it should always be disabled
if (theBtn !== lastClicked) {
theBtn.enabled = val;
}
}
}
public function playSounds(whichSound:String) {
if (soundActive) {
_level0.mySound.attachSound(whichSound);
_level0.mySound.start();
}
}
public function loopSoundToggle(val:Boolean) {
if (soundActive) {
_level0.loopSound.attachSound("loopSound");
_level0.loopSound.start();
}
}
}
HELP Sound Object Stop Kills Flv Sound Too
code:
if (!firstTime) {
_root.introMusic = new Sound();
_root.introMusic.attachSound("music");
_root.introMusic.setVolume(50);
_root.introMusic.start(0, 1);
firstTime = true;
}
music_btn.onRelease = function() {
if (!rockNow) {
_root.introMusic.setVolume(0);
this.gotoAndStop(2);
rockNow = true;
} else {
_root.introMusic.setVolume(50);
this.gotoAndStop(1);
rockNow = false;
}
};
stop();
This script for my "music on/off" btn kills ALL audio and not just the sounds object audio. It also pauses FLV playback (I'm using the FLVplayback component). Any insite?
I've tried modifying the above AS not using the "_root." to target the obj and also stop() and start() on the obj instead of just volume control. HELP!!!
Thanks,
1M.
Sound.duration Lags Behind Sound.getBytesLoaded()
This is crazy:
Code:
l = 1779801 t = 1782285 p = 99.8606283506846 dur = 210
l = 1782285 t = 1782285 p = 100 dur = 211
l = 1782285 t = 1782285 p = 100 dur = 212
l = 1782285 t = 1782285 p = 100 dur = 213
l = 1782285 t = 1782285 p = 100 dur = 213
l = 1782285 t = 1782285 p = 100 dur = 214
l = 1782285 t = 1782285 p = 100 dur = 215
l = 1782285 t = 1782285 p = 100 dur = 215
l = 1782285 t = 1782285 p = 100 dur = 216
ActionScript Code:
var l:Number = my_sound.getBytesLoaded();
var t:Number = my_sound.getBytesTotal();
var per:Number = (l/t)*100;
//
trace("l = " + l +" t = " + t +" p = "+per+" dur = "+Math.round((my_sound.duration/1000)));
Has anyone ever experienced this problem of the Sound.duration property lagging behind the Sound.getBytesTotal()? This seems rather ridiculuos! And yes, this happen online too, not just locally!
Multiple Sound-objects Causes Sound To Overdrive
hey guys..
I've built a small game with multiple enemies firing stuff at the same time. And here's the problem.. each shot makes a sound by simply creating a sound-object like this:
var es:explSound_1=new explSound_1();
es.play();
..it can get very crowdy, and multiple sounds of the same type are played at the same time. The sound now overdrives and gets disturbingly loud.
Does anyone know how to prevent this from happening?
Load New Sound Into Existing Sound Object
I have an extremely simple AS3 mp3 player that I'm trying to create but the problem I'm running into is that I can't seem to load a new song into my sound object when I switch tracks. Here's the basic code I'm using:
Code:
var sound:Sound = new Sound();
var sControl:SoundChannel = new SoundChannel();
var isPlaying:Boolean = false;
function triggerAudio(id:Number, path:String, type:String):void {
if(isPlaying){
sControl.stop();
sound.close();
isPlaying = false;
} else {
sound.load(new URLRequest(path));
sControl = sound.play();
sControl.addEventListener(Event.SOUND_COMPLETE, completeHandler);
isPlaying = true;
}
}
Right now, playing an initial song works
Stopping a song works
But loading a new song over top of a previously loaded song doesn't.
I'm brand new to AS3, what am I missing?
Is Sound.position Even A Property Of The Sound Class?
i found tons of AS3 tutorials on how to make an mp3 player and all of them have playingSound.position which is supposed to return the current song position.. but when i try to use it i get an undefined property error.. and i expect that error cuz i didnt find any sound.position property in the official documentation.. or is there?
Sound Position & Sound Length Dont Add Up
I've been trying to get sound files to loop seamlessly in flash for a little while. It's completely impossible so far.
If use the Sound_Complete event to trigger the next playback of the sound you hear a gap between the song ending and beginning again.
I you use
ActionScript Code:
sndChannel=sound.play(0,10)
You get perfect looping. This is no good for me though because I need to know when a sound ended for my project.
An approach that I was going to take was to use a timer.
The idea was to just fire a timer really quickly and keep on comparing the current position of the sound and the sound length. If they equal I would know that the clip had ended.
This sounded like a good fool proof idea but I'm getting really weird results.
If I am to trace out in my interval timer
ActionScript Code:
trace("position :"+this.sndChannel.position)
trace("length:"+this.sound.length)
When the sound finishes playing
this.sndChannel.position= 13606
BUT
this.sound.length=13792
So my mechanism to detect when a sound has ended will never work because the length of the sound dosnt match the position ???
Would anyone one know how this is possible??
How can the position NOT equal the length when the sound has ended??
Sound Fx Search Machine (sound Google?)
Hi, i once saw a sound fx searching machine posted here, i searched the whole actionscript forum but i didn't found anything. I only remember a chunk of the url, something with sound and google. If someone knows an sound fx searching machine, please post it.
Thanks!!!
Dont Play Sound Until Another Sound Finished
Hi guys
How do i wait until a sound has stopped playing before playing another sound. Ideally something along the lines of :
if (sound1.hasCompletedPlaying()) {
sound2.start();
}
im not sure what the boolean check is for if a sound is still playing or not though.
thanks in advance.
Mute Sound/Pause Sound Button HELP
I made a button (Flash CS3, AS2 file) and want it to mute a sound called 'GuitarLoop' which I've imported and have on 'Layer 3. My button's on 'Layer 3' and I need it to mute 'GuitarLoop' when pressed.
I searched on google but didn't really find anything, soooo.... Do you know how I could fill in the blanks?
on (release) {
not_set_yet.stop()
}
I'm guessing here but...
on (release) {
GuitarLoop.stop();
}
or
on (release) {
'GuitarLoop'.stop("Scene 3", "Layer 3", 1)
}
is it something like that?
also this is a looped sound.
Streaming Sound Distorted - Sound Object
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. its kinda funny, but I doubt my boss will think so.
anyone ever run into this before?
|