End of AIR MP3 Player Flash

Hello

I thought I had it down, but doesn't seem to work...


I want to create a Flash AIR application using the code below.  I used this code in the past and it works very well.  I keep 4 audio files (in a folder called "audio") and an XML file on my server so I can pass the names of the music and the railroad once distributed.

It works FINE when I run it as a Flash file.  When I publish it as an AIR application, install it... the text works fine, BUT I don't hear any music.

Any suggestions?


Code:

var my_songs:XMLList;

var my_total:Number;

var my_sound:Sound;

var my_channel:SoundChannel;

var current_song:Number = 0;

var song_position:Number;

var song_paused:Boolean;

var myXMLLoader:URLLoader = new URLLoader();

myXMLLoader.load (new URLRequest ("http://myurl/playlist.xml"));

myXMLLoader.addEventListener (Event.COMPLETE, processXML);

function processXML(e:Event):void {}

var myXML:XML = new XML (e.target.data);

my_songs = myXML.SONG;

my_total = my_songs.length ();

/ / playSong (0);

myXMLLoader.removeEventListener (Event.COMPLETE, processXML);

myXMLLoader = null;

}

function playSong(mySong:Number):void {}

myTitle var = my_songs[mySong].@TITLE;

var myArtist = my_songs[mySong].@ARTIST;

var myURL = my_songs[mySong].@URL;

title_txt.text = myTitle.

artist_txt.text = myArtist;

if {(my_channel)

my_channel.stop ();

my_channel.removeEventListener (Event.SOUND_COMPLETE, onNext);

}

my_sound = new Sound();

my_sound.load (new URLRequest (myURL));

my_channel = my_sound.play ();

my_channel.addEventListener (Event.SOUND_COMPLETE, onNext);

}

next_btn.addEventListener (MouseEvent.CLICK, onNext);

function onNext(e:Event):void {}

current_song ++;

if (current_song > = my_total) {}

current_song = 0;

}

playSong (current_song);

}

prev_btn.addEventListener (MouseEvent.CLICK, onPrev);

function onPrev(e:MouseEvent):void {}

current_song -;

if (current_song < 0) {}

current_song = my_total-1;

}

playSong (current_song);

}

pause_btn.addEventListener (MouseEvent.CLICK, onPause);

function onPause(e:MouseEvent):void {}

if {(my_channel)

song_position = my_channel.position;

my_channel.stop ();

song_paused = true;

}

}

play_btn.addEventListener (MouseEvent.CLICK, onPlay);

function onPlay(e:MouseEvent):void {}

if {(song_paused)

my_channel = my_sound.play (song_position);

song_paused = false;

{ } else if (! my_channel) {}

playSong (current_song);

}

}

Well here is the first problem,

It works as a flash on your Web site application, because the SWF file is operating within the domain, so that she can access directories and files limited only world. Your audio directory is limited in this sense, go ahead and click this button:

http://www.stickybangbang.com/audio/

Then when AIR makes the request, we get deny the same way you use the browser.

Second thing you have drawn your attributes XML to make sure they are read correctly?

Third thing:

I don't see where you add the names that you get in the XML list to the URLRequest song. Also your URLRequest does not include /audio/ because it already exists in your XML.

must be:

var songRequest:URLRequest = new URLRequest();

songRequest.url = "http://www.stickybangbang.com/" + my_songs [song number] .attribute ('URL');

my_sound = new Sound();

my_sound.addEventListener (Event.COMPLETE, playLoadedSong);

my_sound. Load (songRequest);

If you want to restrict your stuff and seem to play, you'll need to do some PHP and hide your songs in a data base or maybe leave it in the folder and put the script php on the main URL like stickybangbang.com/getSong.php.

The php script would be to select the blob to the database and return or select the file at your request. So if you have used a URLLoader and fixed a number of song to it, you might have PHP get that number and logic by MAIL.

Like this:

<>

$theSongNumber = $_POST ['varFromFlash'];

if($theSongNumber == 0) {}

Return file_get_contents() (file (.. / title.MP3));

}

?>

or something like that you'd have to google or I need to examine the issue more. You should of course always include a search of the database of modules because then - could someone just ping this script and retrieve your files.

Anyway maybe to keep things simple for now try remove restrictions folder and tests. Let me know,

Jesse

Tags: Adobe Animate

Similar Questions

  • How can I make USB mp3 player/flash drive bootable?

    Hello
    I have a big problem. Less than a month ago, I backed up my computer using the latest version of Norton ghost 10.0. I then burned the data on a DVD and I kept it safe. today I encountered a problem, I just couldn't cess internet on my laptop, install/uninstall a program, or access help and support. so I got the DVD in the DVD drive backup, I open Norton ghost clicked recovery and then clicked on restore my computer. I told where to look for the backup and restoration began, but then I came across an error message that says the following:

    Cannot complete the restore point recovery d:\Toshiba ghost image001.v2i

    -EC8F178F error: unable to complete the restoration of recovery point: D:\Toshiba ghost image001.v2i.
    -EC8F03F1 error: could not open the recovery point "D:\Toshiba ghost image001.v2i.
    -EBAB03E9 error: internal error of Application: c0000005 Memory Access Violation: Application attempted to read memory at 034bac3c.

    I have another way to restore the data, that it is thanks to an mp3 player or flash bootable disk, the computer, but on the flash disk, the operating system there. is it possible to do the flash drive bootable.
    I would like to know this, because if it starts the flash or mp3 disc I can then delete the contents of the hard drive and restore data.

    and also when you try to restore, he said a file or program using the sound trying to restore.

    can someone help,
    concerning

    Hello kamal

    The best way to start the device in DOS mode is to use the external floppy drive. This disc is not expensive and if your data is so important, you can invest a few dollars to buy it. Using the startup disk that you'll be able to boot into DOS mode and do what you want to do.

    I also recommend you to contact Norton and see if they have a solution just how to install the created image.

    With mp3 player, you will not be able to start.

  • That would REALLY APPRECIATE HELP: Mp3 player Flash integrating Web site

    Hello all - would really appreciate some help with this problem as it did my headache for the last two weeks.

    I bought a mp3 active Den flash player which I'm hoping to incorporate into my site (tumblr). The mp3 player has been done 2 years ago and I am not offered a support beyond the help file, which in itself is pretty useless!

    Mp3 with all necessary files folder is here;

    http://www.mediafire.com/?jdwuuex8k9h4o71

    And the code for my site is here;

    http://www.mediafire.com/?dptrtg9pdisp6rr

    I'm hoping to add a transparent background too so it overlay the site itself when activated, to help with this would go this far.

    I would really appreciate anyone who can offer support here, because I feel short changed by the designer and lost to the implementation of my purchase.

    Thank you very much.

    James

    You want to watch the position: fixed in your CSS:

    http://www.w3schools.com/cssref/pr_class_position.asp

    If you found my useful answers or an answer to your question, I would be grateful if you selected my messages as well.

    Good luck in the final part of your project!

    Adninjastrator

  • Saying my mp3 player flash for a list of his songs to an xml file

    Hello

    What should I put in my code to tell my mp3 player to enter his songs to a folder on my server via an xml doc that I issued my sql server? (the mp3 player is also on the server).

    Thanks in advance!

    Here is my code so far:

    Here is my code:

    import flash.events.MouseEvent;
    import flash.media.Sound;
    import flash.net.URLRequest;
    import flash.media.SoundChannel;
    Import fl.events.SliderEvent;

    var myMusic:Sound = new Sound();
    var soundFile:URLRequest = new URLRequest ("lpwfte.mp3");
    channel: var SoundChannel = new SoundChannel();
    var sTransform:SoundTransform = new SoundTransform();
    var myTimer:Timer = new Timer (100);
    var songPosition:Number = 0;
    var myContext:SoundLoaderContext = new SoundLoaderContext (5000);

    myMusic.load (sound file, myContext);

    myTimer.addEventListener (TimerEvent.TIMER, updateTime);
    buttonPlay.addEventListener (MouseEvent.CLICK, playMusic);
    btnStop.addEventListener (MouseEvent.CLICK, StopMusic);
    sldVolume.addEventListener (SliderEvent.CHANGE, ChangeVolume);
    myMusic.addEventListener (Event.COMPLETE, getSongLength);
    btnPause.addEventListener (MouseEvent.CLICK, pauseMusic);

    function pauseMusic(evt:MouseEvent):void
    {
    songPosition = channel.position;
    Channel.Stop ();
    }

    function convertTime(millis:Number):String
    {
    var Minutes: Number = (millis % (1000 * 60 * 60)) / (1000 * 60);
    var seconds: Number = ((millis % (1000 * 60 * 60)) % (1000 * 60)) / 1000;
    If (< 10 minutes)
    {
    var displayMinutes:String = '0' + Math.floor (Minutes);
    } else
    {
    var displayMinutes:String = Math.floor (Minutes) m:System.NET.SocketAddress.ToString ();
    }
    If (second < 10)
    {
    var displaySeconds:String = '0' + Math.floor (Seconds);
    } else
    {
    var displaySeconds:String is Math.floor (Seconds) m:System.NET.SocketAddress.ToString ();.
    }
    Return displayMinutes + ":" + displaySeconds;
    return (Math.floor (Minutes) + ': ' + Math.floor (Seconds));
    }

    function updateTime(evt:TimerEvent):void
    {
    lblSongTime.text = convertTime (channel.position);
    }

    function getSongLength(evt:Event):void
    {
    lblSongTotalTime.text = convertTime (myMusic.length);
    lblSongName.text = myMusic.id3.songName;
    lblSongArtist.text = myMusic.id3.artist;
    lblSongYear.text = myMusic.id3.year;
    }

    function ChangeVolume(evt:SliderEvent):void
    {

    sTransform.volume = sldVolume.value;
    channel.soundTransform = sTransform;
    }

    function StopMusic(evt:MouseEvent):void
    {
    Channel.Stop ();
    songPosition = 0;
    }

    function playMusic(evt:MouseEvent):void
    {


    Channel = myMusic.play (songPosition);
    myTimer.start ();
    }

    Google search for view a tutorial using terms such as "AS3 XML tutorial.  One of them should show you the code you need to parse the xml data in variables, you can use in your code to your mp3 URLRequest value.

  • AIR Flash MP3 Player?

    Hello

    I posted this under AIR, but not had any luck finding an answer.

    I work with an artist who publishes a new CD.  Is it possible to create an MP3 player in Flash and distribute as an AIR application will be all the songs (say 7-10 tracks) contained in the application?

    I think I've read so many Layers Magazine but wasn't sure how best to do so.  My thought was that it might send the app as a promotional tool.  But, I'm new in the ATMOSPHERE.

    Thank you.

    the only time wherever your application will need access to the internet will be when you search for updates and when you update something (like new tracks or music).

    construction of an air application is no different than building a swf on the web application.  you have just a few additional classes that you can use.

  • Windows Media Player doesn't work when I plug my MP3 player or flash drive into any USB port.

    Victorinox original title: Media player closes on MP3 device.

    Recently WMP gives me the message "a problem has been...". "When I plug my MP3 player or flash drive into any USB port.  Then it crashes and I have to close it manually.  Any ideas?

    Hello

    1. have you done any hardware changes or software on your computer before this problem?

    2. what version of Windows Media Player do you use?

    3. What is the full error message that you receive?

    I suggest you to rebuild the database from the Windows Media Player library. Subsequently, check if the problem persists:

    If you use Windows Media Player 11, refer to this link: you cannot view, add, or delete items in the library of Windows Media Player 11

    Hope the helps of information.

  • Dynamic Flash mp3 player problems

    OK, so I have built this mp3 player with a game break and stop switch. Everything works, but when I navigate to different parts of the timeline and then go back to the home screen, the pause button will no longer work. All my code is frame 1, which is also the domestic setting. Here is the code if anyone has any suggestions it would be awesome!

    Stop();

    start the animation button

    home_button.addEventListener (MouseEvent.ROLL_OVER, overBtn);

    home_button.addEventListener (MouseEvent.ROLL_OUT, outBtn);

    home_button.addEventListener (MouseEvent.CLICK, clickBtn);

    video_button.addEventListener (MouseEvent.ROLL_OVER, overBtn);

    video_button.addEventListener (MouseEvent.ROLL_OUT, outBtn);

    video_button.addEventListener (MouseEvent.CLICK, clickBtn);

    animation_button.addEventListener (MouseEvent.ROLL_OVER, overBtn);

    animation_button.addEventListener (MouseEvent.ROLL_OUT, outBtn);

    animation_button.addEventListener (MouseEvent.CLICK, clickBtn);

    faq_button.addEventListener (MouseEvent.ROLL_OVER, overBtn);

    faq_button.addEventListener (MouseEvent.ROLL_OUT, outBtn);

    faq_button.addEventListener (MouseEvent.CLICK, clickBtn);

    quiz_button.addEventListener (MouseEvent.ROLL_OVER, overBtn);

    quiz_button.addEventListener (MouseEvent.ROLL_OUT, outBtn);

    quiz_button.addEventListener (MouseEvent.CLICK, clickBtn);

    function overBtn(evt:MouseEvent):void {}

    evt.currentTarget.gotoAndPlay (10);

    }

    function outBtn(evt:MouseEvent):void {}

    evt.currentTarget.gotoAndPlay (1);

    }

    function clickBtn(evt:MouseEvent):void {}

    evt.currentTarget.gotoAndPlay (20);

    }

    end of one animation button - start navigation

    video_button.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_13);

    function fl_ClickToGoToAndStopAtFrame_13(event:MouseEvent):void

    {

    gotoAndStop (15);

    }

    animation_button.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_14);

    function fl_ClickToGoToAndStopAtFrame_14(event:MouseEvent):void

    {

    gotoAndStop (30);

    }

    faq_button.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_15);

    function fl_ClickToGoToAndStopAtFrame_15(event:MouseEvent):void

    {

    gotoAndStop (45);

    }

    quiz_button.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_16);

    function fl_ClickToGoToAndStopAtFrame_16(event:MouseEvent):void

    {

    gotoAndStop (60);

    }

    home_button.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_17);

    function fl_ClickToGoToAndStopAtFrame_17(event:MouseEvent):void

    {

    gotoAndStop (1);

    }

    end of navigation-Begin code mp3 player

    var mySound:Sound;

    var myChannel:SoundChannel;

    var soundIsPlaying:Boolean = false; prevent the btn overlap game

    var p:uint = 0;

    mySound = new sound;

    mySound.load (new URLRequest("media/onimpulse.mp3"));

    btn_play.addEventListener (MouseEvent.CLICK, playSound);

    btn_stop.addEventListener (MouseEvent.CLICK, stopSound);

    btn_pause.addEventListener (MouseEvent.CLICK, pauseSound);

    function stopSound(myEvent:MouseEvent):void {}

    myChannel.stop ();

    p = 0;

    soundIsPlaying = false;

    }

    function playSound(myEvent:MouseEvent):void {}

    If (! soundIsPlaying) {}

    myChannel = mySound.play (p); play the location of the song (p)

    soundIsPlaying = true;

    }

    }

    function pauseSound(myEvent:MouseEvent):void {}

    If {(soundIsPlaying)

    p = Math.floor (myChannel.position);

    myChannel.stop ();

    soundIsPlaying = false;

    }

    }

    place your code in an if statement that made sure it runs only once:

    var alreadyExecuted:Boolean;

    {if(!alreadyExecuted)}

    alreadyExecuted = true;

    all your code

    }

  • MP3 player in AS3 Flash CS5 with autoresume feature?

    I created a website with an MP3 player on several pages. I created the player using AS3 in Flash Professional CS5. It has a volume slider on this subject that I set the initial value of 2. He charged music is identified in an XML file. If the user changes the volume, suspend or stop the music, I want to use autoresume (or something equivalent) to ensure that the player continues in the same status on several pages. The player is embeded in the pages using SWFObject.

    I searched for several days on the web, trying to find a solution and found no one. I don't know if there is something I need to do in AS3, Flash, on my pages, or if it can be handled in PHP or XML. Anyone know a good approach?

    You don't need "additional software" to use SharedObject. It is a standard feature of Flash has been around since Flash 6 CC1 Indeed, the code you are using is AS1

    AS3 doc

    http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/NET/SharedObject. HTML

  • Air applications require Flash Player?

    Well, this question may sound silly, but you please help me with my basic doubt. Applications created in Flex (AIR application) requires Flash Player on the client side or simply install AIR on the client side will do?

    No, just the AIR runtime is enough. Air application uses the airglobal.swc for compilation.

  • 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]);

    };

  • simple mp3 player not working not not:(erreur de script d'action)

    Hello world!

    I wonder if anyone can help with this problem:

    I am currently designing a website and creating a simple mp3 player with a function on / off but doesn't seem to work. I get this error:

    1095: syntax error: a string literal must end before the line break.
    1083: syntax error: end of program is unexpected.
    1084: syntax error: expected rightparen before the end of the program.
    1084: syntax error: expected rightparen before the end of the program.
    1084: syntax error: expected rightparen before the end of the program.
    1084: syntax error: expected rightparen before the end of the program.

    I downloaded a zip file containing the images and the FLA file. I wonder if someone wouldn't mind have a look for me and tell me how to solve this problem:

    http://www.c-Recordz.co.UK/download/mp3_player.zip

    Thank you

    Davies

    Hi Davies,

    On line 19 let's not break the line, Flash will do it for you... Another aspect that I recommend is to not put the "$" variables. In AS2 variable need not be reported as such (although it is a good policy), instead of the ' $' put the word "var", as you have already in these variables.

    Greetings

    Men

  • My MP3 player icon displays in Internet Explorer, but not in Firefox.

    http://Tae.joski.webfactional.com/songs/single/a_day_away

    I have the most recent Flash update and have a 64-bit system. I had to disable all my Firefox plug-ins to get the MP3 player icon to display on my web page.

  • MP3 player

    I have a disc flash usb mp3 player if I buy an itunes card can I load music on it?

    Securities purchased on the iTunes Store are sent to aac (.m4a) format. If the device plays those, you should be able to drag and drop files on it. If he only plays MP3, so you better to visit the Amazon music store.

    TT2

  • MP3 player just became crazy... !

    Well, I just went running tonight and the MP3 player is just gone crazy, music started very well, then continues to jump forward and backward, then goes silent, starts again everything above over and over. It became so annoying that I decided to just turn OFF music... you guessed it, he would not turn out, so I ended up cutting my short sleeve only 3 miles, you mind, it's exceptionally hot.

    Does anyone else have this problem?

    I ran into all this hot weather here in the United Kingdom, so I thought that little moisture might have gotten in the unit, so I put to bed with rice in a bag plastic until I had to again on Wednesday, I hope that this will cure the problem, if not... Hmmm, this could be a doubtful switch "music."

    I hope I get some answers.

    Best regards, Woody

    disable the controls on the headset, corrected a problem. Your headset is broken, welcome to the club, but you'll be fine once that u fix the setting.

  • does not recognize the memory stick or mp3 player

    Can anyone help? I am trying to use an mp3 player, but when I click on it in my computer, that a message appears saying that the disk in drive g is not formatted do format you it now. The same thing seems whem I plug in my memory stick. When I tried a different pc, they work ok and they gave me options to play in windows media, etc. and take no action. In"my computer"they come as a hard but in another of those articles name pc disk rises and I can open, explore, and play the two elements. The memory stick was working ok when I connected the first time a few months ago but not now. In Device Manager, the names of the two usb devices are named but not in 'my computer '. I tried to sync in windows media player, but it keeps asking me to connect the device even after that I have try to refresh. Any help in this matter would be greatly appreciated.

    Thank you very much

    A Webb

    Hey Webb,

    Follow the suggestions below for a possible solution:

    Method 1: I suggest to change the Bill of Exchange to the drive and then try to connect the device.

    How to change drive letter assignments in Windows XP

    http://support.Microsoft.com/kb/307844

    Method 2: I also suggest that you scan your computer with the Microsoft Security Scanner, which would help us to get rid of viruses, spyware and other malicious software.

    The Microsoft Security Scanner is a downloadable security tool for free which allows analysis at the application and helps remove viruses, spyware and other malware. It works with your current antivirus software.

     

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note: The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.

    Important: While running scan on the hard drive if bad sectors are found on the hard drive when scanning try to repair this area if all available on which data may be lost.

    I hope this helps.

Maybe you are looking for