Need to randomize MP3 player
Hello guys.
I have a simple mp3 player in AS2, and I need a way to randomize the songs.
Here's my AS2 code.
__________________________________________________________________________________________ ____________________________________
var s:Sound = new Sound();
s.onSoundComplete = playTracks;
s.setVolume (75);
var a: Array = new Array();
var cps:Number = - 1;
var pos:Number;
load the XML for mp3 tracks
var xml = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var: array of nodes = this.firstChild.childNodes;
for (var i = 0; i < nodes.length; i ++)
{
SA.push (new list (nodes [i].attributes.url, nodes [i].attributes.artist, nodes [i].attributes.track));
}
playTracks();
}
your xml file is called here, if you change the name of your XML also change here
XML. Load ("Tracks.xml");
function to play your songs, note that the volume is currently set at 75, 100 = max, 0 = silent
function playTracks (): Void
{
s = new Sound();
s.onSoundComplete = playTracks;
s.setVolume (75);
mute.gotoAndStop("on");
If (cps == sa.length - 1).
{
CPS = 0;
s.loadSound (.earl his [PC], true);
}
on the other
{
s.loadSound (his [++ cps] .earl, true);
}
info.info2.TrackInfo.text = .track his [PC] + "";
info.info2.trackInfo2.text = .artist his [PC] + "";
onOff.gotoAndStop ("pause");
textPos = 0;
}
function to play the previous track
function playPrevious (): Void
{
s = new Sound();
s.onSoundComplete = playTracks;
s.setVolume (75);
mute.gotoAndStop("on");
if(CPS == 0)
{
CPS = his .length-1;
s.loadSound (.earl his [PC], true);
}
on the other
{
s.loadSound (his [-cps] .earl, true);
}
info.info2.TrackInfo.text = .track his [PC] + "";
info.info2.trackInfo2.text = .artist his [PC] + "";
onOff.gotoAndStop ("pause");
}
function pause music
function musicOff (): Void
{
POS = s.position;
s.Stop ();
}
to continue playback function
function musicOn (): Void
{
s.Start(pos/1000);
}
This determines the reversal says according to what position the switch is in,
currently I do not roll-over States for my buttons, but you can add them if you wish.
onOff.onRollOver = function()
{
If (this ._currentframe == 1) this.gotoAndStop ("pauseOver");
of another this.gotoAndStop ("playOver");
}
This determines the position of the play/pause button
onOff.onRollOut = onOff.onReleaseOutside = function()
{
If (this ._currentframe == 10) this.gotoAndStop ("pause");
of another this.gotoAndStop ("play");
}
on the release of the pause/play button, what determines weather to pause or resume playback
onOff.onRelease = function()
{
If (this ._currentframe is 10)
{
this.gotoAndStop ("playOver");
This._parent.musicOff ();
alphaTween = new mx.transitions.Tween (equ, "_alpha",
mx.transitions.easing.Regular.easeOut, 100, 0, 0.75.
(true);
}
on the other
{
this.gotoAndStop ("pauseOver");
This._parent.musicOn ();
alphaTween = new mx.transitions.Tween (equ, "_alpha",
mx.transitions.easing.Regular.easeOut, 0, 100, 0.75.
(true);
}
}
States of flipping to the next button, again I am not using any
next.onRollOver = function()
{
this.gotoAndStop ("nextOver");
}
next.onRollOut = next.onReleaseOutside = function()
{
this.gotoAndStop ("next");
}
This determines the weather the equalizer is an alpha of 0, if not the Equalizer will return to 100%
When you press the next button
next.onRelease = function()
{
This._parent.playTracks ();
If (equ._alpha == 0)
{
alphaTween = new mx.transitions.Tween (equ, "_alpha",
mx.transitions.easing.Regular.easeOut, 0, 100, 2.
(true);
}
on the other
{
}
}
This determines the weather the equalizer is an alpha of 0, if not the Equalizer will return to 100%
When you press the previous button
prev.onRelease = function() {}
playPrevious();
If (equ._alpha == 0)
{
alphaTween = new mx.transitions.Tween (equ, "_alpha",
mx.transitions.easing.Regular.easeOut, 0, 100, 2.
(true);
}
on the other
{
}
}
__________________________________________________________________________________________ __________________________________
Thanks for any help!
You should be able to mix just the table her after the loop when it fills to help
his (her) shuffle =;
Where you have the shuffle function added to the collection of functions...
function shuffle (a) {}
var len is. Length-1;
for (i = len; I > = 0; i--) {}
var percent = Math.floor (Math.random () *(i+1));
var t = [i];
a [i] = a [p];
a [p] = t;
}
return a;
}
Tags: Adobe Animate
Similar Questions
-
Help... I need a firmware for my Walkman MP3 Player NWZ-B172F... it does not turn because I accidentally formatted on PC...
NWZB172F Network Walkman is not a U.S. or Canadian unit. Please see the support provider in your respective countries for the best support:
If my post answered your question, please click "accept as a Solution.
-
I have real problems trying to load any music on my MP3 player. Almost immediately, I get the message 'Media Player ran into problems and needs to close. It's so frustrating, I can't enjoy the music I stored on Media Player please help
It worked for me
http://support.Microsoft.com/kb/555494
You can also try the system restore
See you soon!
-
Hi, I need help with my flash mp3 player
Hi, I need help with my mp3 player, I wan't to add the pause button... Can you help me?
I created the button I added btn_pause and it won't work.
function soundStatus() {}
var amountLoaded = _root.sound_mc.sound_obj.getBytesLoaded () / _root.sound_mc.sound_obj.getBytesTotal ();
_root. Loader.loadBar._width = amountLoaded * 260;
duration = _root.sound_mc.sound_obj.duration;
position = _root.sound_mc.sound_obj.position;
_root.playHead._x = position / duration * 272 + 5;
}
btn_play.onRelease = function() {}
clearInterval (timeInterval);
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
This._parent.sound_mc.songStarter (songfile [song_nr]);
};
btn_pause.onRelease = function() {}
clearInterval (timeInterval);
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
This._parent.sound_mc.sound_obj.pause ();
};
btn_stop.onRelease = function() {}
clearInterval (timeInterval);
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
This._parent.sound_mc.sound_obj. Stop();
};
btn_fw.onRelease = function() {}
clearInterval (timeInterval);
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
(song_nr == songfile.length - 1)? _Global.song_nr = 0: _global.song_nr ++;
_root.sound_mc.songStarter (songfile [song_nr]);
};
btn_rev.onRelease = function() {}
clearInterval (timeInterval);
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
(song_nr == 0)? _Global.song_nr = songfile. Length-1:-_global.song_nr;
_root.sound_mc.songStarter (songfile [song_nr]);
};
< proposed by the mod to as3 - kglad >
:
function soundStatus() {}
var amountLoaded = _root.sound_mc.sound_obj.getBytesLoaded () / _root.sound_mc.sound_obj.getBytesTotal ();
_root. Loader.loadBar._width = amountLoaded * 260;
duration = _root.sound_mc.sound_obj.duration;
position = _root.sound_mc.sound_obj.position;
_root.playHead._x = position / duration * 272 + 5;
}
btn_play.onRelease = function() {}
clearInterval (timeInterval);
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
This._parent.sound_mc.songStarter (songfile [song_nr]);
};
btn_pause.onRelease = function() {}
clearInterval (timeInterval); you must re - set interval when the unpause button is clicked
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
This._parent.sound_mc.sound_obj. Stop()
};
{btn_unpause.onRelease = Function ()}
This._parent.sound_mc.sound_obj. Start(position/1000);
}
btn_stop.onRelease = function() {}
clearInterval (timeInterval);
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
This._parent.sound_mc.sound_obj. Stop();
};
btn_fw.onRelease = function() {}
clearInterval (timeInterval);
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
(song_nr == songfile.length - 1)? _Global.song_nr = 0: _global.song_nr ++;
_root.sound_mc.songStarter (songfile [song_nr]);
};
btn_rev.onRelease = function() {}
clearInterval (timeInterval);
_root.timeDisplay_txt. Text = "00:00 / 00:00 ';
(song_nr == 0)? _Global.song_nr = songfile. Length-1:-_global.song_nr;
_root.sound_mc.songStarter (songfile [song_nr]);
};
-
Need help to integrate a swf to mp3 player with playlist xml
Im a noob to Flash (began Tuesday, haha) and so far all that comes along very well, but I need to put music in the swf file. I have a set button in place that slips a swf mp3 player in the side, but I don't know how to make the playlist to work with it.
The player is from this site:
http://www.bezzmedia.com/swfspot/samples/Flash8/Mp3_Player_with_XML_Playlist
Using the list of reading xml with html is fairly simple, but I'm not sure using it with Flash Catalyst. Is there an easy way to do this?
My original plan was to have a text list of songs with a play button next to each of them, and then when you click on the play button it would create the State of all the other songs on blocked for you can choose just what would stop the song playing and if another song he played. I'm not sure how to do it anymore (as I said, I started to learn this week), so I just tried to incorporate someone else (ugly) mp3 player.
Anyway, if someone knows a way relatively easy to have a playlist in my swf file please let me know. Thank you!
If I understand you correctly, you have imported a SWF file in catalyst use of illustrations to import on the file menu. When your application runs, you want to pass this swf that tells it what URL to read a file of the parameter data. The file SWF don't is not one you have created, on the contrary, you got a web site.
This isn't something you can do in catalyst. However, it should be possible to do it in Flash Builder. I found an article in several ways to do it, to http://www.actionscript.org/forums/showthread.php3?t=175951. One idea is the following snippet
import flash.events. *;private void setVars (event): void
{
Event.Target.Content.yyyyyy = "zzzzzz";
}
]]>
where "xxxxx" is the path of the SWF file (you can put it somewhere in your Flash Builder project, or reference it via a URL), yyyyy is the name of the parameter that awaits the SWF and zzzzzz is the path to the data file. The
tag, it's what catalyst created when you imported the SWF file. (btw.the Image and SWFLoader tags are almost identical). I hope that gives you enough information to move forward.
-
Need help... How can I open my sansa fuze mp3 player?
Hello everyone,
Unfortunately, I was a little awkward. I spilled orange juice on my sansa fuze mp3 player and now I could not move the small wheel more . Everything else (electronics) is OK, but now I have to clean it up.
I would be very happy if someone could explain to me how can I open it... I tried, but so far I have not.
Thanks in advance,
Itzy
This can help. But be warned if you open it and it goes bad later SanDisk who see and decide to not honor the warranty.
-
I have a question and I was wondering if there is so little alternative to iTunes. Here's my question, as a teenager, I constantly check new music to determine if this is something I might be able to use. When I click on an mp3, naturally, iTunes opens up, which takes time, and then he wants to add to iTunes library. I just want to hear a few seconds of a track and nothing more. Y at - it sort of a mini mp3 player that loads quickly and do it?
Thank you
Select the file, and then press the SPACEBAR. You need not even a player.
-
MP3 player won't play not through the Mic - NB 550 d
Hello
MP3 player will not play to Mic Jack. Is it because I don't have DD Realtek Audio Manager Setup correctly?
Also is it possible to play MP3 via a USB Port
THX
Hello
What cell phone do you have?
The mic jack records the audio signal. But I guess you want to use the mic line-in socket. Right?
Usually, you need to set the default device in the recording tab.
In Control Panel-> sound-> recording tab.If you don't see me not all other devices but only mic jack then you must right-click and should allow the options; Show hidden devices and show disabled devices.
Maybe then, you can enable line.Otherwise, this option is not available and is not possible
-
Digital mp3 player is not detected on the computer.
Original title: my phone dosnt recognize my drive digital mp3. When I plug it into the usb port do not get an icon. so I can't load music can help you
MY LAPTOP DOES NOT RECOGNIZE MY MP3 DIGITAL PLAYER. WHEN I PLUG IT INTO THE USB PORT I DON'T GET THE USUAL ICON. SO I CAN'T DOWNLOAD MUSIC ON IT. CAN YOU HELP ME PLEASE
Hello
Thanks for posting your question in the Microsoft Community Forums!
If I understand the question, digital mp3 player is not detected on the computer. Please let me know if this is not correct.
Before I continue with the troubleshooting steps I may need a few more details to better understand the issue.1. what operating system do you use?2. do you receive any error messages?3. are you having the same problem with other USB devices?4. have you tried plugging the machine into the other USB Ports?5. did you of recent changes on the computer before this problem?6. What is the serial number and model of the MP3 player?Method 1:
We will first try to plug in other USB Ports and on another computer to make sure that there is no problem with the digital mp3 player.Method 2:
If the first method does not resolve the problem, run the hardware and devices Troubleshooter and check if it helps.Hardware devices do not work or are not detected in WindowsFor more information, please see the link.Tips for solving problems of USB devices
http://Windows.Microsoft.com/en-us/Windows-Vista/tips-for-solving-problems-with-USB-devicesRespond with the required information so that we can help you solve the problem. -
Windows media player won't let me sync my music on my mp3 player and I've never had a problem before
whenever I try to sync the music on my mp3 player today it says that windows media player cannot find the file. If you are trying to play, burn, or synchronize an item in your library, the element can point to a file that has been moved, renamed, or deleted. and I nothing marked c and can not understand this please help
What version of Windows are you using?
What version of Media Player?Did you move all the music files recently?
Check that the music you are trying to synchronize are playable, if they are not, check their location of file to see if they are still there. You may need to re - add to the library.
The following may be useful: http://support.microsoft.com/mats/windows_media_player_diagnostic
-
Impossible to get Trio A1000 MP3 player to work with Windows XP Pro
I have an A1000 Trio MP3 player and have a problem trying to download MP3s to it. The computer recognizes the device and says it's working properly, but I see no activity when I try to download MP3s to the unit. I've updated Windows Media Player to Media Player 11, but still have playback in Media Player: "Device Connect" when I try to synchronize files with the mp3 player.
Any suggestions?Your Trio is plug-and-play. So, go into Device Manager and uninstall all your USB hubs.
Re-start.
XP will be re-installed the necessary software automatically. Once everything has "calmed down", plug your Trio. XP will install the software (again).
You should then be able to sync.
No: If you have any USM devices that need to install specific drivers, just plug their and XP will do what is necessary. If not, install them manually.
If this does not work, go back to WMP10, then re-install WMP11.
See you soon,.
Jerry
-
MP3 player, freezes my office
When I plug my MP3 into my desktop freezes, he had always worked in the past, but now I have this problem, it is a Philips GoGear, WMP, I am running windows xp, I have updated WMP now what do I do?
What were you doing just before what is happening?
Should the player have its own drivers? If so, uninstall them and then re-boot and the re-install.
What software do you usually use to transfer files - WMP? (When I got a Philips mp3 player we need drivers + special software to transfer).
Have you read the manual or tried the Phillips website for ideas?
When you connect to the desktop computer freezes. Error message?
One thing to try is the following, however: go into Device Manager and remove the USB hubs. Re-booting, XP will be re - discover and install the necessary software. Let him do his thing (s). When everythings installed, connect your GoGear, let XP recognize and install the necessary driver. If XP asks you to install a driver, then you will surely find one on the CD/DVD provided with the unit. However, if its plug-and-play, XP will do its thing.
Re-post if nothing works with the model number and the reference of your GoGear.
See you soon,.
Jerry
-
My WMP11 crashes when I plugin a mp3 player to sync
Last night I tried to download music on my mp3 player new son and every time I joined the mp3 player to sync, wmp11 would crash and have to close it. I posted before last night and was told to start a new post with info from error logs, so here are:
2nd log: 14/02/11 @ 12:43 am
0000: 41 70 70 6 c 69 63 61 74 Applicat
0008: 69 6th 6f 20 46 61 69 6 c ion Fail
0010: 75 72 65 20 20 77 6 d 70 ure wmp
0018: 2nd 6 c 61 79 65 72 65 78 layer.ex
0020: 65 20 31 31 2e 30 2e 35 e 11.0.5
0028:37 32 2nd 31 35 31 34 35 721.5145
0030:20 69 6e 20 6F 69 64 69 a indi
0038:76 30 33 2 6 b 65 79 20 v03.key
0040:31 31 2nd 30 2nd 36 30 30 11.0.600
0048: 30 37 30 30 30 20 61 0.7000 2nd a
0050:74 20 6f 66 66 73 65 74 t offset
0058: 20 30 30 30 61 37 31 38 000a 718
0060: 35 0D 0 a 5...
1 journal: 15/02/11 @ 12:28 am
0000: 41 70 70 6 c 69 63 61 74 Applicat
0008: 69 6th 6f 20 48 61 6e 67 ion Hang
0010: 20 20 77 6 d 70 6 c 61 79 wmplay
0018: 65 2nd 72 65 78 65 20 31 er.exe 1
0020: 31 2nd 30 2 35 37 32 31 1.0.5721
0028: 2nd 35 31 34 35 20 69 6th en.5145
0030:20 68 75 67 61 70 70 hungapp 6F
0038:20 30 2e 30 2e 30 2e 30 0.0.0.0
0040: 20 61 74 6f 20 66 66 73 off
0048: 65 74 20 30 30 30 30 30-00000
0050: 30 30 30 000
Thank you for your help.
OK, I read the support articles you mentioned and it said that I lose all the multimedia files that use DRM. How to find all of these files to check what I need before this procedure?
When you have purchased songs from an online music store, these songs could be protected by DRM. To find out if this is the case, you will need to check with the store. You can also view individual songs in WMP, by right-clicking on them, select Properties , then go on the usage rights .
Also, I received a response of Shekhar S. above. This could also be a way to solve the problem, or it is basically the same thing?
It's something different and interesting to try. It will no doubt make you lose all your music files, but you will lose all the game account in the library (and possibly star ratings too). Tim Baets
http://www.BM-productions.TK -
Windows does not recognize my mp3 player
My new phone has an mp3 player, but windows does not recognize to transfer music from the Rhapsody for her. How can I make it work?
You don't say what to do with phone/mp3 player. If its something other than an iPhone, you'll probably need to install the drivers/software supplied with your phone.
If its an iPhone, you'll need to use iTunes or software MGTEK.
See you soon,.
Jerry
-
using windows media 11 to put the CD on mp3 player then delete PC and keep MP3
- Hi I'm putting CDs on my mothers via the windows media player 11 mp3 player, IM having the problem, is that its hard drive is nearly full, so I need to remove the music after it's on mp3 player, but when I do delete and go for the next cd on the mp3 player it removes the previous cd and put a new is there a way to stop synchronization delete mp3
Please help as im getting desperate lolThanks alanBetter make free space on HARD drive then, rather than try to work around him. You can usually get a free space of Disk Cleanup , running in Start - all programs - Accessories . Tim Baets
http://www.BM-productions.TK
Maybe you are looking for
-
Why need to restart the computer 2 x front can launch Thunderbird?
When 1 computer startup, thunderbird says not responding do not. can not launch internet explore also. reboot again both can launch... using Windows vista. no problem when 1st installed. can use for a few months.
-
Portege Z930 - new Windows 7 and installing the driver
I have a Toshiba Portege Z930 Ultrabook. I don't use it for a while because he was very very slow when navigating or attempt to perform other tasks. I scanned the system with several antivirus (now I have Avast and Fixila, but I also used Kaspersky a
-
Hello again guys! This error started before even El Capitan. I am able to receive emails but not send. The message is "this message can not be sent because your account does not have a mail server outgoing favorite" and I don't know where to change t
-
on the problem of openSUSE 12.1 ni4882 3.1.10 - 1.19 - Office
After you install the package kernel-source and kernel-syms and following the steps described in the file README.txt for the preparation of openSUSE for NI4882 installation, the installation hangs at post installation steps. gpibtsw indicates the aut
-
I have HP Pavilion DV4 5008... my laptop is suffering from problems and thermal heating station... I tried many blocks of cooling as Deepcool X 6... but none of them worked... Please suggest me a cooling pad which reduces the problem of heating...