ActionScript 2.0 :: LoadSound Randomly On Initial Start?
Oct 15, 2007
I have an MP3 player that i want to put on my site, I would like to have the first song be played randomly so it dosent grow stale.
Here is the A.S. i'm using.
Code:
var musicFolderName:String = "music/";
var curTrackNum:Number = 0;
var curPlaybackPos:Number;
[Code]......
View 4 Replies
Similar Posts:
Jul 2, 2009
I am trying to play an MP3 using Actionscript 2. I have the following requirements: I don't want to wait for the MP3 to load before playing it. I want to know when enough of the MP3 has downloaded that I can start playing it. I don't want the MP3 to start playing immediately: I need to control when the play starts. An example scenario is that I need to start playing a 30-second MP3 exactly 8 seconds from now (at the top of the minute, let's say). Depending on the connection, I may or may not be able to download the entire MP3 by then, but I can almost certainly download enough to start playing without interruption.
[Code]....
View 2 Replies
Jul 27, 2010
I don't have quite a good enough grasp on AS3 just yet, but I'm getting there.I have a movie that has an intro to it. It also has buttons that take them to subsequent pages.Once they go back, I'd like the intro portion of the movie to not play. In other words, I'd like it to start at a particular frame after the initial visit to it.I think this can be done with Local Shared Objects,
View 2 Replies
Jul 27, 2010
I've made a banner that swaps through different images. I'd like it to start at a random image when the flash movie loads.
Currently, I'm using this code, and it works fine to an extend:
Code:
//function to get random frame
function getFrame() {
//Store frame numbers
[Code]....
View 2 Replies
Dec 11, 2009
I'm looking for a way to randomly start an ordered list of SWF's. Well, that's not all I have my main SWF calling up external SWF's. I have 2 groups of external SWF's. From my main SWF Actionscript, I want to randomly play one SWF in Group A and continue cycling through Group A (in order) until it is finished. Then I want to randomly start playing one SWF from Group B and continue cycling through that list (in order) until the Group B is cycled through. Then repeat Group A (random start, but staying in order), etc.
Does this make sense?? I realize it's a challenge My current ActionScript works for Group A to randomly select and play in order, I need it to stop after it gets to the random starting point again (so it doesn't repeat) and start up Group B (which isn't in there yet)
[Code]...
View 7 Replies
Dec 18, 2003
I found this code online. it is for a image gallery that fades in and out as it transition from one image to the next.. the images are load through an array command... it loads the first image, etc.... what I wanted to know is where should i put a Math.floor(Math.random()*this.pic_arr.length); in the string of code... to make the gallery start randomly in the array and then continue onto the next image... also, for some reason, there is not a common directory for all the images, like this script:
[Code]...
View 1 Replies
Sep 24, 2007
Onmy stage I have a MC, and when I click it a random MC from the Library should appear and move around randomly.
I'm using this to make it move around randomly [URL]
how to make the random MCs appear from the library. And should I put the random moving script on each of my ten MC?
View 8 Replies
Jan 28, 2010
actionscript and i have a mp3 player that loads an mp3 file from a certain url. my code is this:ow can i change this to load an mp3 file from a php code exactly like this:
<?php echo base_url(); ?>uploads/<?php echo $artist_id; ?>/music/<?php echo $filename; ?>
View 1 Replies
Nov 3, 2004
i have a script on a frame at the root of the movie.
[Code].....
the problem is, that the sound isnt loading in Internet Explorer. I thought it may have been SP2 causing problems but i went and tested it on school's computer SP1 and it still didnt work. In firefox it works fine, so the AS must be correct (which im positive it is) i just cant work out for the life of me why it isnt loading. I have also tried loading the sound onto a movieclip and not from the frame
i.e.
[Code]....
and this didnt work in IE either. Works again in firefox though.
View 1 Replies
Jan 7, 2006
I applied folowing script to load my mp3 file. Problem is my mp3 won't loop:s. Anyone see the prob in my script? i'd also like the mp3 to fade in and when I push the stop button it fades out.
loopSound = function () {
myMp3.loadSound("streamsound.mp3", true);
myMp3.setVolume(50);[code]...
View 1 Replies
Nov 3, 2004
i have a script on a frame at the root of the movie.
// background sound (war environment)
_global.bgsound = new Sound();
bgsound.loadSound("sounds/mp40.mp3")
[Code].....
the problem is, that the sound isnt loading in Internet Explorer. I thought it may have been SP2 causing problems but i went and tested it on school's computer SP1 and it still didnt work. In firefox it works fine, so the AS must be correct (which im positive it is) i just cant work out for the life of me why it isnt loading. I have also tried loading the sound onto a movieclip and not from the frame i.e.
// background sound (war environment)
_root.createEmptyMovieClip("myEmptyMC","2");
[Code].....
and this didnt work in IE either. Works again in firefox though.
View 1 Replies
Mar 8, 2009
I'm having some trouble with loadSound. I've created a portfolio section for a company that has short (1:30) mp3 clips. The clips are being loaded in dynamically through an XML doc. For whatever reason, when the sound loads, it plays for almost exactly 2 seconds, then restarts and plays all the way through. My flash is set up in three frames, the first two are the main gallery, then frame three is where the sound is loaded and played. "p" is defined by which icon in the gallery is clicked.
[Code]...
View 2 Replies
Jan 21, 2009
I'm writing a small mp3 player. It reads the playlist from an xml file, then at the end of a song (or when the "Next" button is pressed) automatically plays the next song in the list.My problem is that if the song is a large file (around 16MB), the player doesn't play the song -- I have to click pause then play a couple of times to play it.
The code is roughly:
Code:
function playSong():Void
{
tune = new Sound();
[code]....
where 'tunes' is an array of paths to the file. I've missed out a couple of things, but that's basically it. Is there an issue with loadSound needing to load some of the song first?
View 0 Replies
Jan 22, 2009
I originally posted this wrongly in AS3, I'm writing a small mp3 player. It reads the playlist from an xml file, then at the end of a song (or when the "Next" button is pressed) automatically plays the next song in the list.
My problem is that if the song is a large file (around 16MB), the player doesn't play the song -- I have to click pause then play a couple of times to play it.
[Code]...
View 0 Replies
Apr 28, 2006
was wondering how sound files are compressed when they are retreived using the loadsound command? do they use the original file compression or does flash muck about with it? The reason i ask is that an audio file is coming out sounding very different to the original
View 1 Replies
Sep 26, 2008
I've got a quirk here I'm having a difficult time hammering out.I've got a control object with a sound object as a child. This global sound object has another sound object as a child:
Code:
Master = {};
Master.soundManager = new Sound();
Master.soundManager.BGM = new Sound();
\
In the main loop of my program, I have a function (VNELineReader()) with a switch looking for particular cues, one of which is loading a sound into BGM:
Code:
case "bgm_load" :
Debug.trace('Loading music: Sound/'+args+'...');
Master.soundManager.BGM.onLoad = function() {[code].....
Now, when I run this in the Flash 8 IDE, no problems. The script waits for the sound to load, resumes, and later on plays BGM with a case "bgm_play". However, if I compile the program and play it with the external flash player, the loadSound call causes the player to freeze, eat up about 600MB of memory in task manager, and then crash. It also does this if I open the .swf in Internet Explorer. However, it works fine in Firefox.
View 1 Replies
Jan 22, 2009
I'm writing a small mp3 player. It reads the playlist from an xml file, then at the end of a song (or when the "Next" button is pressed) automatically plays the next song in the list. My problem is that if the song is a large file (around 16MB), the player doesn't play the song -- I have to click pause then play a couple of times to play it.
The code is roughly:
function playSong():Void {
tune = new Sound();
tune.onSoundComplete = playSong;
tune.loadSound(tunes[++current],true);
}
Where 'tunes' is an array of paths to the file. I've missed out a couple of things, but that's basically it. Is there an issue with loadSound needing to load some of the song first?
View 2 Replies
Mar 8, 2009
I'm having some trouble with loadSound. I've created a portfolio section for a company that has short (1:30) mp3 clips. The clips are being loaded in dynamically through an XML doc.
For whatever reason, when the sound loads, it plays for almost exactly 2 seconds, then restarts and plays all the way through.
My flash is set up in three frames, the first two are the main gallery, then frame three is where the sound is loaded and played. "p" is defined by which icon in the gallery is clicked.
Here is my code for reference:
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
if (p == 0) {
[Code]....
View 1 Replies
Jan 1, 2004
why this doesn't work? I'm about to go crazy! It's just supposed to be background music and it plays once then stops. WHY?
[AS]
backsound = new Sound();
backsound.loadSound("sounds/loopy.mp3", true);
[code]....
View 1 Replies
Jul 24, 2009
I'm trying to load an MP3 file from a different domain using loadSound while publishing from flash?
View 1 Replies
Jan 1, 2004
It's just supposed to be background music and it plays once then stops. WHY?
[AS]
backsound = new Sound();
backsound.loadSound("sounds/loopy.mp3", true);
backsound.onSoundComplete = backsound.start;
[/AS]
I have also tried backsound.start(0,999); but it doesn't work either.
View 1 Replies
May 3, 2004
I have a button that imports an mp3 and is supposed to load completely before playing. Problem is, when I set the loadSound to false it doesn�t play at all, but when I set it to true it does play. Here is the code:
Code:
carregarSons = function (som, numeroVolume) {
_root.som1.stop();
_root.som1 = new Sound()[code]....
View 8 Replies
Dec 4, 2007
What I'm trying to do is for a play button to just play the first thing that is on my XML file. I have the XML file played out like this and it is being loaded earlier in the actionscript file.
<song>
<loc>testaudio/fire.mp3</loc>
<songtitle>Fire</songtitle>
<artist>Jim</artist>
<album>Album #1</album>
[Code] .....
The mySound.loadSound(loc[0]); is coming up with an unknown, and this is because the file path is not in quotes because it wants a URL, not a variable (loc[0] should be passing on the file path for the first song in the XML file). Is there some way to change the variable so that the loudSound() function reads the path correctly? It works fine when I just pop the file path in there instead of loc[0].
View 3 Replies
Apr 27, 2009
I am unable to play the mp3 from the middle
[Code]...
View 1 Replies
Feb 3, 2010
i am having this very big problem(for my particular application). i am writing this music application in flash and i use as2 to load randomly specific sounds which are in the same folder as the movie. the problem is that i need the sound to be replayed with fidelity and it seems flash is lowering the pitch of the "music" by a halfstep(it does the same when "previewing" it from the library). musically speaking, if i have an mp3 containing A at 440 hz played with piano timbre, Flash will lower it and when it is played through the flash player is its played as a G sharp(35 hz lower). I thought that if i will replace the attachSound with loadSound and the sound will be loaded externally and not from the library the problem will be solved. it seems that this won't solve the probem. the sound just doesn't want to be played at the frequency it has in the file from which is loaded. i had read somewhere that this is a flash player's bug.
View 8 Replies
Nov 9, 2010
I have an AS2 file where I want to load an external sound, but not have it start until the play button is pushed. It is a large file so I want it to load streaming, but can't figure out how to keep the streaming true without having it start immediately. Here is the code:
this.createEmptyMovieClip("craigTalks_mc", 10);
craigTalks = new Sound(craigTalks_mc);
craigTalks.loadSound("mp3/Craig_BP.mp3", true);[code]....
I have three audio files using the same code that I want the user to be able ot toggle on and off. When I set the loadSound isStreaming variable to false, it works perfectly, but at true, all three files start at once, and the pause doesn't work! However if I keep it at false, once I load it to the website it doesn't work, I believe because it is taking too long for the audio files to load.
View 4 Replies
Jul 19, 2004
I have used the loadsound command with the streaming option set to true, so it streams sound etc. But the problem is that it cache's the mp3 file it is streaming onto the user's internet cache folder Is there a way to prevent mp3 files from being cached (have I murdered the English language today using the word cache? ) Something like what the Real Player does, it streams the files but never cache's them. <gasp>
View 7 Replies
Apr 19, 2009
I have built an Mp3 player for my site and users are allowed to put their own music into the playlist. The only problem I have run into now is that if the URL becomes invalid later, the player will stop at that song and the user would have to press next to skip to the next song. Is there any way to get the player to do this on it's own?
Code:
AudioPath = aPath[current_song-1];
song_text.text = songTitle[current_song-1]+" / "+bandTitle[current_song-1];
MySound = new Sound();
[code]....
View 2 Replies
Jul 19, 2004
I created a streaming mp3 player, the Click here for player
I have used the loadsound command with the streaming option set to true, so it streams sound etc. But the problem is that it cache's the mp3 file it is streaming onto the user's internet cache folder.
Is there a way to prevent mp3 files from being cached (have I murdered the English language today using the word cache? ) Something like what the Real Player does, it streams the files but never cache's them. <gasp>
View 12 Replies
Jun 21, 2009
i am making a quiz. My problem is that once the user completes the quiz and wants to start again the quiz is already on the last question. How do i make it so that once the user clicks start again the questions and answers arrays start from the beginning, sort of reset themselves.
View 1 Replies