Flash MP3 Player Doesn't Load Songs On Test And Live Site
Hi,
I've downloaded the files for the 'Flash MP3 Player 3' from the tutorial on this site and I can get the songs to play fine when I open up the .swf using the Flash standalone player (all the necessary files and songs are in the same folder), but I can't get it to work on my MAMP set up nor on my live site. Any ideas why that might be?
Do I need to set the target for the source files or something before publishing?
Thanks
Actionscript 3.0
Posted on: Mon Oct 20, 2008 9:46 am
View Complete Forum Thread with Replies
Sponsored Links:
GetURL Doesn't Work On Live Site
I have a flash 8 movie that works fine , with a button that invokes GetURL to open a popup window. It works from our standard URL for veiwing a customer site (like www.ourrealsite.com/default.asp?domain=customerurl), but doesn't work when the url being used is the customer's domain name (like www.customerurl.com). It is all the same website ... the only difference is the URL being used.
I'm a web programmer ... I don't really work with flash except to load what our graphics department builds. But they are stumped on this and I need to get it to work. Any ideas?
View Replies !
View Related
Test Works, Site Doesn't
hello again,
go a bit of a problem.
i have some dynamic text in a flash file.
the text comes from a notepad wich is in a websitefolder.
when i run a flash test it works, when i publish and try the html or flash file...it works.
when i stick the flash file on my website(same folder as notepad) it starts but as soon as the text should come in it jambs up and won't play any further.
is this a flash question or a html one?
i've send the flash(not the fla) to a friend he runs the file from his computer and it all works with text and everything........but for some reason it will not work from the net.
so flash can read the url over the net, but not when itself is over the net?(it's driving me nuts)
View Replies !
View Related
[F8] Flash Site Doesn't Load In FireFox?
I built a site using flash, embedded the swf into an HTML file and posted it. It works perfectly in IE but when I try to view it using FireFox I simply get a blank screen!!
I've searched the adobe knowledge base and couldn't find anything. Has anyone else had this problem? How do I fix it?
View Replies !
View Related
Flash Player Doesn't Load
Hi,
My flash player doesnt load when I use a site like Myspace. Where the myspace music player should be there is only a white box and when I right-click it just states "Movie not loaded" and that's after waiting several minutes. I've tried uninstalling flash and I've tried older versions with both IE6 and Mozilla.
Hope some of you guys can help...
View Replies !
View Related
I Create A Song Player, But Its Not Working On Live Site.
Hi!
I have created a song player, It is working fine on local machine but its not working on live site. Here is the code.
// Playlist Arrays...
var songFile:Array = new Array();
var songArtist:Array = new Array();
var songName:Array = new Array();
var currentSong:Number = 0;
var songCount:Number = 0;
var songMuted:Boolean = true;
var songVolume:Number = 100;
// Song Object...
var songObject:Sound = new Sound();
// Playlist XML Import...
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlFile = "_ambiance.xml";
xmlData.load(xmlFile);
xmlData.onLoad = function(xmlSuccess:Boolean) {
if (xmlSuccess) {
topNode = this.firstChild;
songCount = topNode.childNodes.length;
for (i=0; i<songCount; i++) {
songFile[i] = topNode.childNodes[i].childNodes[0].firstChild.nodeValue;
songArtist[i] = topNode.childNodes[i].childNodes[1].firstChild.nodeValue;
songName[i] = topNode.childNodes[i].childNodes[2].firstChild.nodeValue;
if (i == 0) {
loadSong(i);
}
}
}
};
function loadSong(inTrack) {
songObject.stop();
songObject = new Sound();
songObject.loadSound(songFile[inTrack], true);
txtArtist.text = songArtist[inTrack];
txtName.text = songName[inTrack];
songVolume = 0;
}
back_btn.onPress = function() {
currentSong>0 ? currentSong-- : currentSong=songCount-1;
loadSong(currentSong);
};
next_btn.onPress = function() {
currentSong<songCount-1 ? currentSong++ : currentSong=0;
loadSong(currentSong);
};
toggle_btn.onPress = function() {
songMuted ? songMuted=false : songMuted=true;
};
onEnterFrame = function () {
// Fade Effect...
if (songMuted) {
headphones_mc.nextFrame();
songVolume>0 ? songVolume -= 10 : songVolume=0;
} else {
headphones_mc.prevFrame();
songVolume<100 ? songVolume += 10 : songVolume=100;
}
// Set Volume...
songObject.setVolume(songVolume);
// Loader Bar...
progress_mc._xscale = (100/songObject.getBytesTotal())*songObject.getBytesLoa ded();
// Playlist Looping...
if (songObject.position == songObject.duration && songObject.getBytesTotal() == songObject.getBytesLoaded() && songObject.getBytesTotal()>10) {
currentSong<songCount-1 ? currentSong++ : currentSong=0;
loadSong(currentSong);
}
};
Any body please help me.
View Replies !
View Related
How To Test Flash Detection Live
Hi, i have a flash detection on a flash project, but since I have the flash 8 player installed, I cannot test it.
Is there a way to see how it will look and work? Can the player be uninstalled from the browser and install an older version?
Much thanks,
Jeff
View Replies !
View Related
Html Driven Music Player To Load In Flash Site.
Hi, I have a html code which contains my mp3 player settings but I would like it to launch in flash when someone visits my site. How do i tell flash to play the code so when people visit my flash site: my player will launch from the html code sources.
To go over that again if you didn't get it:
I have a snocap html code and I want the player to launch with my music off my flash site can this be done?
View Replies !
View Related
The Site Doesn't Load
hi!
I finished a few pages of a site I'm working on.
I've loaded the site on the server to have a preview, but it doesn't show anything; not even the preloader.
What am I doing wrong?
The first page has 11 kb.
please help meeeeeeeeeee!!!!!!!!!
View Replies !
View Related
Getting Flash Mp3 Player To Play My Songs Within Flash 8?
I'm adapting a free flash mp3 player to play my songs on my website.
The problem I'm having is getting the player to play my songs when previewing the player in flash 8 .
This line of Actionscript seems to be the problem area for starters:
DEFAULT_PLAYLIST_URL ="http://mysite.com.br/shows/allshows.xspf";
The PC I'm using for this is not internet connected so obviously on preview this URL is not found...But can I alter this line so it finds my songs on my hardrive to play, and then, I can test it out before I upload all the necessaries for the real test?
View Replies !
View Related
Player Doesn't Load Movie...
I've been having this problem for quite a while now and I just decided there's got to be a solution...
When I double-click on a .swf file, the player opens in a large window, but it doesn't load the selected movie. It doesn't load anything. I can drag and drop a swf file on the window and it will load fine, but it doesn't load the clicked movie by default. I can't find a setting anywhere to solve this and it's getting a bit annoying. I work with a few other flash developers and this works fine for them, so I'm stumped.
Any idea how to solve this?
Thanks!
Eddie
View Replies !
View Related
Preloading Songs/site ?
Hi, Ive just made a new design on my site......
ive got 3 buttons that, when pushed, each loads a flashfile into an empty movieclip. The flashfiles each contains a song....
It all works very well, but the loadingtimes is horribly. How do i make a preloader that preloads the whole site ?
www.thebasement.dk go have a look.
if any1 knows how to make one... plz reply.... and talk to me like I was a 5 [ I'm a noob at coding and all that stuff ]
regards, Soma
View Replies !
View Related
Preloading Songs/site ?
Hi, Ive just made a new design on my site......
ive got 3 buttons that, when pushed, each loads a flashfile into an empty movieclip. The flashfiles each contains a song....
It all works very well, but the loadingtimes is horribly. How do i make a preloader that preloads the whole site ?
www.thebasement.dk go have a look.
if any1 knows how to make one... plz reply.... and talk to me like I was a 5 [ I'm a noob at coding and all that stuff ]
regards, Soma
View Replies !
View Related
Adding Songs To A Player
im trying to add songs to my player without uploading each song to a website and i cant get the music to play when i click the button its either too soon or doesnt play at all
Code:
on (rollOver) {
with (_root.nav_mc.sub_songs) {
gotoAndPlay("over");
}
// End of with
with (_root.nav_mc.nav.but01) {
gotoAndPlay("overdown");
}
// End of with
with (this) {
gotoAndPlay("over");
}
// End of with
}
on (release, rollOut, dragOut) {
with (_root.nav_mc.sub_songs) {
gotoAndPlay("off");
}
// End of with
with (_root.nav_mc.nav.but01) {
gotoAndPlay("off");
}
// End of with
with (this) {
gotoAndPlay("norm");
}
// End of with
}
theres the code
View Replies !
View Related
New Site Gone Live For Flash Resources
I have launched a new site selling flash resources. Video loops, vector loops, masks and so forth.
www.flashkraft.com
I would like some feedback on what you would like to see on the site.
Trying to gauge the market for what people want.
Thanks in advance
Edited: 05/06/2007 at 09:12:21 AM by celshader
View Replies !
View Related
Live Feed From A Site Into Flash?
Hi chaps,
i'm just wondering if this is do-able (i can't try it 'till i get home)
i'd like to have a 'latest-virus info' feed display in flash
i imagine i could maybe set up a plain html page with the feed and perhaps pipe the contents of the textbox into a php variable, which i could then pick up from flash?
View Replies !
View Related
Mp3 Player 'phantom' Songs Issue
I am having an issue with the mp3 player tutorial.
I added 30-40 songs to the .xml file and if i happen to scroll through the list quickly (this is outside Flash), a song from towards the beginning of the list will just up and start playing, none of the controls work on the song (pause, mute etc.), as expected, as 's' already has a new song loaded into it.
How do these songs manage to start playing? Could it be an error with the song file itself? The code seems solid, ive tried deleting s altogether... it still does it.
I have made 2 modifications: added a Back button and a volume slider.
Thanks in advance
Code:
//Setup sound object
var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume( 100 );
dragBar._x = 438;
//to 'remember' the volume for muting
var theVolume:Number;
theVolume = 100;
//Array of songs
var sa:Array = new Array();
//Currently playing song
var cps:Number = -1;
//Position of music
var pos:Number = 0;
//Load XML songs data
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
var nodes:Array = this.firstChild.childNodes;
for(var i = 0; i < nodes.length; i++) {
sa.push( new Song( nodes[ i ].attributes.url, nodes[ i ].attributes.artist, nodes[ i ].attributes.track) );
}
playSong();
}
xml.load("songs.xml");
//Play mp3 file
function playSong( num:Number ):Void {
/*num determines if the Back or Next button
* was pressed, if it is undefined, it is NOT
* the Back button */
if( num != 0) {
num = 1;
}
s = new Sound();
s.onSoundComplete = playSong;
//reset volume and slider position
s.setVolume( 100 );
dragBar._x = 438;
mute.gotoAndStop( "on" );
if( num ) {
if(cps == sa.length - 1) {
cps = 0;
s.loadSound(sa[cps].earl, true);
} else {
s.loadSound( sa[++cps].earl, true);
}//end inner if
} else {
if(cps == 0) {
cps = sa.length - 1;
s.loadSound(sa[cps].earl, true);
} else {
s.loadSound( sa[--cps].earl, true);
}
}//end if-else
trackInfo.text = sa[ cps ].artist + ' - ' + sa[ cps ].track;
playPause.gotoAndStop("pause");
}
//Pause the music
function pauseIt():Void {
pos = s.position;
s.stop();
}
//Unpause the music
function unPauseIt():Void {
s.start( pos/1000 )
}
//Music Controls
//Play/Pause toggle
playPause.onRollOver = function() {
if(this._currentframe == 1) {
this.gotoAndStop("pauseOver");
} else {
this.gotoAndStop("playOver");
}
}
playPause.onRollOut = playPause.onReleaseOutside = function() {
if(this._currentframe == 10) {
this.gotoAndStop("pause");
} else {
this.gotoAndStop("play");
}
}
playPause.onRelease = function() {
if(this._currentframe == 10) {
this.gotoAndStop("playOver");
this._parent.pauseIt();
} else {
this.gotoAndStop("pauseOver");
this._parent.unPauseIt();
}
}
//Previous button
//(is just an instance of nextButton)
previous.onRollOver = function() {
this.gotoAndStop("nextOver");
}
previous.onRollOut = next.onReleaseOutside = function() {
this.gotoAndStop("next");
}
previous.onRelease = function() {
this._parent.playSong( 0 );
}
//Next button
next.onRollOver = function() {
this.gotoAndStop("nextOver");
}
next.onRollOut = next.onReleaseOutside = function() {
this.gotoAndStop("next");
}
next.onRelease = function() {
this._parent.playSong();
}
//Volume Controls
//Mute button
mute.onRollOver = function() {
if(this._currentframe == 1) {
this.gotoAndStop("onOver");
} else {
this.gotoAndStop("offOver");
}
}
mute.onRollOut = playPause.onReleaseOutside = function() {
if(this._currentframe == 10) {
this.gotoAndStop("on");
} else {
this.gotoAndStop("off");
}
}
mute.onRelease = function() {
if(this._currentframe == 10) {
this.gotoAndStop("offOver");
theVolume = s.getVolume();
s.setVolume( 0 );
} else {
this.gotoAndStop("onOver");
s.setVolume( theVolume );
}
}
//Volume slider
dragBar.onPress = function() {
startDrag( this, false, 388, this._y, 438, this._y);
this.onEnterFrame = function() {
s.setVolume( 100 - ( 438 - this._x ) * 2 );
}
updateAfterEvent();
}
dragBar.onRelease = dragBar.onReleaseOutside = function() {
stopDrag();
delete this.onEnterFrame;
}
View Replies !
View Related
Mp3 Player Not Automatically Switching Songs
ive looked all over for the answer, but nothing seems to work.
basically when a song ends i want it to go to the next song, and if it is currently playing the last song, i want it to go to the first song. i have all of the action scripts set up, and i was messing around with it. i have this
Code:
// Setup sound object
var s:Sound = new Sound();
s.onSoundComplete = function()
{
function playSong():Void
{
if(cps == sa.length - 1)
{
cps = 0;
s.loadSound(sa[cps], true);
}
else
{
s.loadSound(sa[++cps], true);
}
}
}
and here is my playsound function
Code:
// Play the MP3 File
function playSong():Void
{
s = new Sound();
if(cps == sa.length - 1)
{
cps = 0;
s.loadSound(sa[cps], true);
}
else
{
s.loadSound(sa[++cps], true);
}
playPause.gotoAndStop ("pause");
}
when it was like this
Code:
s.onSoundComplete = playSong;
with this
Code:
// Play the MP3 File
function playSong():Void
{
if(cps == sa.length - 1)
{
cps = 0;
s.loadSound(sa[cps], true);
}
else
{
s.loadSound(sa[++cps], true);
}
}
it would go to the next song just like i want, but didnt play back from a pause properly. sometimes it would unpause and skip straight to the next song... othertimes it would seem to just skip time.
i looked at this link http://bencline.net/blog/2006/11/15/mp3 ... some-bugs/
and its sourcecode but still cannot find out how this guy achieved what i am looking for... any help would be greatly appreciated...
View Replies !
View Related
My Mp3 Player Wont Play The Songs
ok, the mp3 player that lee has set up works but i cant get it to play the longer songs. it will play the short little test files that i have but not a full lenght mp3 so i was wondering if there was a way to stream in the mp3 and have it start playing once it has reached a certin percentage of loading, like have the mp3 start playing once its loaded 50% and then load the rest of it. Code:
var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume(95);
i think i would be modifiying the code at this point, but i'm a little lost on how to write the code for that and i need someone to hold my hand and walk me thtough it. :(
thanx :roll:
View Replies !
View Related
Linux Standalone Player Doesn't Load Dynamic Content
Hi Peoplez,
I already really tried hard to solve the following problem:
Does somebody has experiences with flash standalone players on linux machines concerning loading dynamic content?
Situation:
I installed a pos-system (locally without any network connection) with debian and the available Flash Standalone-Player 6. The system and application already runs in full screen mode properly BUT >>
>> doesn't show dynamic content (no matter if I use attachMovieClip, loadMovieClip or loadVariables). It runs perfect on windows and mac os (also tested with a Standalone Player v6).
Somebody already heard of this problems? Any suggestion for solution?
Thanks in advance,
funatic
View Replies !
View Related
MP3 Player - Loading Songs Through HTML Links
Hi all,
I'm a beginner when it comes to Flash, but have been burdened with the task of creating a simple flash mp3 player for the web. Thanks to some very helpful tutorials scattered around the net, I have a simple player working, loading the mp3's from an XML file.
The problem is when the player loads, it just starts playing the songs automatically from the XML file. I need, however, for each song to be an HTML link on a webpage, and when the user clicks that link, that song begins playing in the player.
I've done a quick Google search, but nothing seems to be springing out at me. Has anyone got a link to a tutorial, or able to point me in the right direction on how to go about getting this done?
Appreciate any feedback. Cheers.
View Replies !
View Related
Mini Radio Player 5 Songs.. Help Meeeee.. Please
hey people. I have a question. I want to stream the 5 songs I have uploaded 2 my server and I have a script with 5 scenes. but after the songs streams I want it to skip to the next secen (the next song). I have my full script here http://www.largenards.com/poor222.zip check it out.. it's 5 scenes. 5 songs streaming. I just need the last part of the code that will move to the next song when the prior song finishes. It seems like it should be simple and I just don't know that script. I hope it is anyway.
kenny
View Replies !
View Related
Mini Radio Player 5 Songs.. Help Meeeee.. Please
hey people. I have a question. I want to stream the 5 songs I have uploaded 2 my server and I have a script with 5 scenes. but after the songs streams I want it to skip to the next secen (the next song). I have my full script here http://www.largenards.com/poor222.zip check it out.. it's 5 scenes. 5 songs streaming. I just need the last part of the code that will move to the next song when the prior song finishes. It seems like it should be simple and I just don't know that script. I hope it is anyway.
kenny
View Replies !
View Related
Flash Live Mp3 Player With Lyrics
New version of Gchats live flash mp3 player is ready for download.
listing all mp3 files within a folder , volume , pan , auto pan , and
also you can put lyrics text for each sound so when music plays it scroll the lyrics.
gchats live mp3 player 2.0
please comment about your ideas
View Replies !
View Related
Files Needed To Make Flash Site Live
My Flash site is now complete. At this point what are my next steps in making my Flash site live (i.e., uploading to a server). What are the necessary files that I need and do I need to use Dreamweaver, and if so what is the process to make my site live in that manner? Please help!
Edited: 07/12/2007 at 02:44:17 PM by Twee
View Replies !
View Related
How To Set Up Live Radio Feeds Through The Flash Player?
Hi
I would like to add a feature on my website so that visitors to my site can simply click a button to listen to the BBC/CNN radio feeds live, streamed through the Flash Player (rather than via RealPlayer, Windows Media Player, etc)
Has anybody ever set this sort of thing up on their website? Is there anything special I need to know, other than applying standard commands (onClick gotoAndPlay, etc) to my buttons?
I'm assuming the live radio feed urls would need to point to an mp3 file.
Any help you could provide would be most appreciated.
With best regards
Rob
View Replies !
View Related
Flash Player Live Person Shadow
Good day mates..
Would anyone happen to know where i can find more information on adding a shadow to a person in a flash movie? The background is transparent and the person has a shadow behind them.
here is a link to a site with a sample of what I'm talking about, only without the shadow.
http://www.livepersonintroductions.com/index.htm
Any help would be much appreciated.
Rooster
View Replies !
View Related
Custon Flash Player Streaming Live
Hello,
I'm building an custom flash video player with live streams. I hope someone can help me out with this.
How can i check if the live stream is online. Because if not, the video player has to play an flv file. Please help me with this.
it has to be as 2.
its really urgent. Thank you very much.
View Replies !
View Related
How To Set Up Live Test? Where's The Config?
ok i set up the FMS, and i have it running on win2003
at winxp i have the encoder and is connected to the server, since i see an instance of it
now how do i set up the webclient??? wheres the config for the client? does it need to be in a webserver or does it run from where the flash server is installed??
View Replies !
View Related
Externally Load Songs?
In a game I am working on I need to be able to load several different mp3's if I have the game load all of the songs right away from within the swf that will be a heavy burden of loading. I considered making a new swf for each song and then using load movie to get them but before I go and do that is it possible to load songs externally?? Thanks
View Replies !
View Related
Good Way To Load Songs?
I have a main file, index.swf which loads audioPanel.swf. In audioPanel, i have about 12 songs each about 250KB average in size (mp3s). I exported each symbol in the library.
So I guess I have two questions/problems:
1) Right now, index.swf finishes loading quickly, but I don't hear any music when I play my animation because it is taking forever to load audioPanel.swf. I want music to start playing immediately. I know with streaming sounds they do, but how do I do it in my case?
Since I exported each song (so I could do: attachSound and whatnot), how do I make them streaming now? Or is there something better to do?
View Replies !
View Related
Good Way To Load Songs?
I have a main file, index.swf which loads audioPanel.swf. In audioPanel, i have about 12 songs each about 250KB average in size (mp3s). I exported each symbol in the library.
So I guess I have two questions/problems:
1) Right now, index.swf finishes loading quickly, but I don't hear any music when I play my animation because it is taking forever to load audioPanel.swf. I want music to start playing immediately. I know with streaming sounds they do, but how do I do it in my case?
Since I exported each song (so I could do: attachSound and whatnot), how do I make them streaming now? Or is there something better to do?
View Replies !
View Related
Can't Load Outside Songs In Flash9, Why?
Last edited by Nutrox : 2007-03-31 at 07:27.
//.................load outside song's list ( them can't work ?)..............
//can't load outside songs in flash9, why?
ActionScript Code:
System.useCodePage = true;
var Request:URLRequest = new URLRequest("myTxt.txt");
function catchData(event:Event){
var myList:String =new String();
myList = loader.data.songList;
_playList = myList.split("/");
trace(_playList[0]);
for (var i:int = 0; i<_playList.length; i++) {
_songNameList.push(_playList[i].substr(0, _playList[i].length-4));
trace("_playList["+i+"]: "+_playList[i]);
trace("_songNameList["+i+"]: "+_songNameList[i]);
}
}
}
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, catchData);
loader.load(Request);
/*myTxt.txt:
songList=song1.mp3/song2.mp3/song3.mp3
*/
View Replies !
View Related
Live Streaming Video Feeds With Flash Player?
Hi,
I have a website that shows live TV feeds (such as MTV uber, Weather Plus, BBC News, etc). This is all handled by windows media player implanted onto a web page. However, I am looking to have a flash player developed that will handle the same thing. I googled for it and couldn't find anything that would do the job. Does anyone know if this is possible? To have a flash player handle live mms:// or .asx (etc) feeds not provided by the same server the flash player is on?
EG link: http://livetv.ws/free-live-tv/channels/1707
Thank You,
Donny
View Replies !
View Related
Flash Video Player Works Locally But Not Live
I have a simple flash player which works locally but not when I make it live... I have an external flv file and its in the same directory as the swf file. Here's the page and code.
http://cf3.heritage.org/nationalsecurity/VideoTool/HIF_PlayerNEW.html
<!--- code ---------------------------------------------------------------------------------------------------------------- --->
<cfoutput><!-- saved from url=(0013)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>HIF_PlayerNEW</title>
<script language="javascript"> AC_FL_RunContent = 0; </script>
<script src="
View Replies !
View Related
Live Streaming Video Feeds With Flash Player?
Hi,
I have a website that shows live TV feeds (such as MTV uber, Weather Plus, BBC News, etc). This is all handled by windows media player implanted onto a web page. However, I am looking to have a flash player developed that will handle the same thing. I googled for it and couldn't find anything that would do the job. Does anyone know if this is possible? To have a flash player handle live mms:// or .asx (etc) feeds not provided by the same server the flash player is on?
EG link: http://livetv.ws/free-live-tv/channels/1707
Thank You,
Donny
View Replies !
View Related
Custom Flash Video Player With Live Stream
Hello,
I'm building an custom flash video player with live streams. I hope someone can help me out with this.
How can i check if the live stream is online. Because if not, the video player has to play an flv file. Please help me with this.
it has to be as 2.
its really urgent. Thank you very much.
The live stream is with FMS.
View Replies !
View Related
First Flash Site Test
Hi everyone,
I just made my first flash website and I was wondering if everyone could check it out and let me know if you are having any difficulties or if something looks weird on your particular computer.
Here is the address:
http://www.mynextvideo.com
Choose the High Speed option which takes you to the flash version of the site.
All criticisms are welcome as they will help me make the site better.
Thanks in advance!!!!!
View Replies !
View Related
Is It Possible To Load Different Songs With The Same Sound Object?
HI
I'm creating one simple MP3Player class, which plays different songs...
The problem is "dispatched" every time I'm calling the loadSound method...
The classes are not perfect right now, because I'm only working on them for one, maybe two days.
Thanks for now.
mloncaric
Attach Code
package com.mloncaric.utils
{
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.net.URLLoader;
import flash.net.URLRequest;
import com.mloncaric.events.LoaderXMLEvent;
public class LoaderXML extends EventDispatcher
{
public var data:XML;
//KONSTRUKTOR
public function LoaderXML(targetXML:String = null)
{
if(targetXML != null) this.loadXML(targetXML);
}
//NALOZIM XML DATOTEKO
public function loadXML(targetXML:String):void
{
var loader:URLLoader = new URLLoader(new URLRequest(targetXML));
loader.addEventListener(Event.OPEN , onLoadStart);
loader.addEventListener(Event.COMPLETE, onLoadComplete);
}
//DOGODKI
private function onLoadStart(e:Event):void
{
e.currentTarget.removeEventListener(e.type, arguments.callee);
dispatchEvent(new LoaderXMLEvent(LoaderXMLEvent.OPEN));
}
private function onLoadComplete(e:Event):void
{
e.currentTarget.removeEventListener(e.type, arguments.callee);
this.data = new XML(e.currentTarget.data);
dispatchEvent(new LoaderXMLEvent(LoaderXMLEvent.COMPLETE));
}
}
}
--------------------------------------------------------------------------------
package com.mloncaric.events
{
import flash.events.Event;
public class LoaderXMLEvent extends Event
{
public static const OPEN :String = "onLoadStart";
public static const COMPLETE:String = "onLoadComplete";
//KONSTRUKTOR
public function LoaderXMLEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false)
{
super(type, bubbles, cancelable);
}
//PREPISEM OBSTOJECO METODO
override public function clone():Event
{
return new LoaderXMLEvent(type, bubbles, cancelable);
}
}
}
--------------------------------------------------------------------------------
package com.mloncaric.media
{
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.ProgressEvent;
import flash.events.IOErrorEvent;
import flash.media.Sound;
import flash.net.URLRequest;
import com.mloncaric.events.SoundPlayerEvent;
public class SoundPlayer extends EventDispatcher
{
private var s:Sound = new Sound();
//KONSTRUKTOR
public function SoundPlayer(targetURL:String = null)
{
if(targetURL != null) this.load(targetURL);
}
//NALOZIM MP3 DATOTEKO
public function load(targetURL:String):void
{
s.addEventListener(Event.OPEN, onLoadStart);
s.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
s.addEventListener(Event.COMPLETE, onLoadComplete);
s.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
s.load(new URLRequest(targetURL));
}
//GET METODE
public function get sound():Sound
{
return this.s;
}
//DOGODKI
private function onLoadStart(e:Event):void
{
dispatchEvent(new SoundPlayerEvent(SoundPlayerEvent.LOAD_START, false, false));
}
private function onLoadProgress(e:ProgressEvent):void
{
var spe:SoundPlayerEvent = new SoundPlayerEvent(SoundPlayerEvent.LOAD_PROGRESS,
false, false, e);
dispatchEvent(spe);
}
private function onLoadComplete(e:Event):void
{
var spe:SoundPlayerEvent = new SoundPlayerEvent(SoundPlayerEvent.LOAD_COMPLETE,
false, false);
dispatchEvent(spe);
}
private function onIOError(e:IOErrorEvent):void
{
var spe:SoundPlayerEvent = new SoundPlayerEvent(SoundPlayerEvent.LOAD_IO_ERROR,
false, false, null, e);
dispatchEvent(spe);
}
}
}
--------------------------------------------------------------------------------
package com.mloncaric.events
{
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.IOErrorEvent;
public class SoundPlayerEvent extends Event
{
public static const LOAD_START :String = "onLoadStart";
public static const LOAD_COMPLETE:String = "onLoadComplete";
public static const LOAD_IO_ERROR:String = "onIOError";
public static const LOAD_PROGRESS:String = "onLoadProgress";
public var progress:ProgressEvent;
public var IOError :IOErrorEvent;
//KONSTRUKTOR
public function SoundPlayerEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false,
progress:ProgressEvent = null, IOError:IOErrorEvent = null)
{
super(type, bubbles, cancelable);
this.progress = progress;
this.IOError = IOError;
}
//PREPISEM OBSTOJECO METODO
override public function clone():Event
{
return new SoundPlayerEvent(type, bubbles, cancelable, progress, IOError);
}
}
}
--------------------------------------------------------------------------------
package com.mloncaric.media
{
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.Event;
import flash.events.EventDispatcher;
import com.mloncaric.utils.LoaderXML;
import com.mloncaric.media.SoundPlayer;
import com.mloncaric.events.LoaderXMLEvent;
import com.mloncaric.events.MP3PlayerEvent;
import com.mloncaric.events.SoundPlayerEvent;
public class MP3Player extends EventDispatcher
{
private var lx :LoaderXML;
private var xml:XML;
private var _autoPlay:Boolean = false;
private var sp :SoundPlayer;
private var s :Sound;
private var sc :SoundChannel;
private var cps :Number = 0;
private var noi :Number;
private var pausePos :Number;
private var isPlaying:Boolean = false;
private var isPaused :Boolean = false;
//KONSTRUKTOR
public function MP3Player(targetXML:String = null)
{
if(targetXML != null) this.loadXML(targetXML);
this.addEventListener(MP3PlayerEvent.PLAY, onPlay);
this.addEventListener(MP3PlayerEvent.PAUSE, onPause);
this.addEventListener(MP3PlayerEvent.STOP, onStop);
this.addEventListener(MP3PlayerEvent.NEXT, onNext);
this.addEventListener(MP3PlayerEvent.PREVIOUS, onPrevious);
}
//NALOZIM XML DATOTEKO
public function loadXML(targetXML:String):void
{
this.lx = new LoaderXML(targetXML);
this.lx.addEventListener(LoaderXMLEvent.OPEN, onLoadXMLStart);
this.lx.addEventListener(LoaderXMLEvent.COMPLETE, onLoadXMLComplete);
}
//GET METODE
public function get soundID():Number
{
return this.cps;
}
public function get numOfItems():Number
{
return this.noi;
}
//SET METODE
public function set autoPlay(state:Boolean):void
{
this._autoPlay = state;
}
//DOGODKI
private function onLoadXMLStart(e:LoaderXMLEvent):void
{
}
private function onLoadXMLComplete(e:LoaderXMLEvent):void
{
this.xml = new XML(e.target.data);
this.noi = this.xml.item.length();
this.addEventListener(MP3PlayerEvent.AUTOPLAY, onAutoPlay);
if(this._autoPlay)
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.AUTOPLAY));
}
private function onAutoPlay(e:MP3PlayerEvent):void
{
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.PLAY));
}
private function onLoadOpen(e:SoundPlayerEvent):void
{
}
private function onLoadProgress(e:SoundPlayerEvent):void
{
}
private function onLoadComplete(e:SoundPlayerEvent):void
{
}
private function onLoadError(e:SoundPlayerEvent):void
{
}
private function onSoundComplete(e:Event):void
{
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.SOUND_COMPLETE));
}
private function onPlay(e:MP3PlayerEvent):void
{
if(this.isPlaying)
this.sc.stop();
this.loadSound(this.xml.item[this.cps].@src);
this.isPlaying = true;
}
private function onPause(e:MP3PlayerEvent):void
{
if(!this.isPaused)
{
this.pausePos = this.sc.position;
this.sc.stop();
}
else
this.s.play(this.pausePos);
this.isPaused = !this.isPaused;
}
private function onStop(e:MP3PlayerEvent):void
{
this.sc.stop();
this.isPlaying = false;
}
private function onNext(e:MP3PlayerEvent):void
{
if(this.cps == this.noi-1)
this.cps = 0;
else
this.cps++;
if(this.isPlaying)
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.PLAY));
}
private function onPrevious(e:MP3PlayerEvent):void
{
if(this.cps == 0)
this.cps = this.noi-1;
else
this.cps--;
if(this.isPlaying)
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.PLAY));
}
//AKCIJE
private function loadSound(url:String):void
{
this.sp = new SoundPlayer(url);
this.sp.addEventListener(SoundPlayerEvent.LOAD_START, onLoadOpen);
this.sp.addEventListener(SoundPlayerEvent.LOAD_PROGRESS, onLoadProgress);
this.sp.addEventListener(SoundPlayerEvent.LOAD_COMPLETE, onLoadComplete);
this.sp.addEventListener(SoundPlayerEvent.LOAD_IO_ERROR, onLoadError);
this.s = this.sp.sound;
this.sc = this.s.play();
this.sc.addEventListener(Event.SOUND_COMPLETE, onSoundComplete);
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.SOUND_START));
}
public function play(Void):void
{
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.PLAY));
}
public function pause(Void):void
{
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.PAUSE));
}
public function stop(Void):void
{
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.STOP));
}
public function next(Void):void
{
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.NEXT));
}
public function previous(Void):void
{
dispatchEvent(new MP3PlayerEvent(MP3PlayerEvent.PREVIOUS));
}
}
}
--------------------------------------------------------------------------------
package com.mloncaric.events
{
import flash.events.Event;
public class MP3PlayerEvent extends Event
{
public static const AUTOPLAY:String = "onAutoPlay";
public static const PLAY :String = "onPlay";
public static const PAUSE :String = "onPause";
public static const RESUME :String = "onResume";
public static const STOP :String = "onStop";
public static const NEXT :String = "onNext";
public static const PREVIOUS:String = "onPrevious";
public static const SOUND_START :String = "onSoundStart";
public static const SOUND_COMPLETE:String = "onSoundComplete";
//KONSTRUKTOR
public function MP3PlayerEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false)
{
super(type, bubbles, cancelable);
}
//PREPISEM OBSTOJECO METODO
override public function clone():Event
{
return new MP3PlayerEvent(type, bubbles, cancelable);
}
}
}
--------------------------------------------------------------------------------
main movie:
--------------------------------------------------------------------------------
import com.mloncaric.media.MP3Player;
var p:MP3Player = new MP3Player("MP3Player.xml");
p.autoPlay = false;
playBTN.addEventListener(MouseEvent.CLICK, p.play);
pauseBTN.addEventListener(MouseEvent.CLICK, p.pause);
stopBTN.addEventListener(MouseEvent.CLICK, p.stop);
nextBTN.addEventListener(MouseEvent.CLICK, p.next);
previousBTN.addEventListener(MouseEvent.CLICK, p.previous);
View Replies !
View Related
Test For Flash Player
Hi ive finished me movie and everything, and its going on the front page of me site.
Now i want to have a test function, so that it detects wether the user has a flash player, if they do, then the page continues to load as normal, if no flash player is detected, then it redirects them to the old page.
Does this script need to be in the html, or in the flash movie.
Is it also 100% reliable,
Cheers
LEe
View Replies !
View Related
|