Sound Object and Media Display

I'm creating a music player that uses xml generated from a
database to load a song. One of the attributes of the xml is the
path to the mp3 file. The attribute is stored in a generic object
and is then passed as a function parameter. There's a lot of
information i'd like to use from the id3 tags but the only object
that supports them is the Sound object. I need the files to stream
so they aren't cached onto the local system and have a media
component to control playback.
If I create a sound object and use the file path parameter in
the loadSound method I can grab the id3 tags but the media
component doesn't have control of playback and the files are
cached.
mySound:Sound = new Sound();
mySound.loadSound(pathparam, true);
If I just load the file path into the media component it
starts playing right away and streams with the lovely built-in
progress bar but I can't seem to access the id3s.
mediaComponent.setMedia(pathparam, "MP3");
Is there a way to load an actual Sound object into the media
component so they will stream but also have access to the id3s?
Thanks in advance for any tips!

How can this NOT work????
//Create an instance of the Sound class
var soundClip:Sound = new Sound();
//Create a new SoundChannel Object
var sndChannel:SoundChannel = new SoundChannel();
//Load sound using URLRequest
soundClip.load(new URLRequest("chimes.wav"));
//Create an event listener that wll update once sound has finished loading
soundClip.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
function onComplete(evt:Event):void {
//Play loaded sound
sndChannel = soundClip.play();
Taken directly from:
http://flashspeaksactionscript.com/loading-external-sounds-using-as3/
I hear nothing.

Similar Messages

  • Simple sound object and TotalBytes

    Hello,
    I built this simple sound object below:
    var s:Chimes = new Chimes();   // Chimes class via chimes.wav in library
    s.play();
    //trace(s.bytesTotal);   this works fine but comented out for now = 2912 bytes
    s.addEventListener(Event.SOUND_COMPLETE, done);
    function done(e:Event)
    trace(s.bytesTotal);  // this does not trace at all
    To me I added a listener to the s instance. I am waiting for the
    s instance to finish loading the entire sound  s.
    I can't figure out why the trace displays nothing.
    Have I attached the wrong event to look for when
    the sound completes loading?
    Thanks,
    Jim

    How can this NOT work????
    //Create an instance of the Sound class
    var soundClip:Sound = new Sound();
    //Create a new SoundChannel Object
    var sndChannel:SoundChannel = new SoundChannel();
    //Load sound using URLRequest
    soundClip.load(new URLRequest("chimes.wav"));
    //Create an event listener that wll update once sound has finished loading
    soundClip.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
    function onComplete(evt:Event):void {
    //Play loaded sound
    sndChannel = soundClip.play();
    Taken directly from:
    http://flashspeaksactionscript.com/loading-external-sounds-using-as3/
    I hear nothing.

  • (MX04) Pausing a loaded swf with sound objects within it

    Hi,
    I'm working on a PowerPoint-esque presentation where a user
    watches and listens to a loaded swf in the main movie, clicks the
    next button (which unloads the swf, advances to the next frame and
    loads the next swf), and watches the next one. Lather, rinse,
    repeat. Some of the sections are rather long, and I'd like to give
    the user the ability to pause and play by button click.
    I know how to stop and start the container MC, but that
    doesn't stop the sound object (and the embedded MCs). I also know
    how to pause and start a sound object using the object's instance
    name. Is there a way to pause everything from the main timeline,
    and keep the AS general enough so that any sound object pauses when
    clicked?
    Any help is most appreciated! MX04 and AS2.0.
    Thanks!

    Kglad,
    I tried your code and ran into some problems with stopping
    the mc's, as the embedded mc's within the loaded swf need to stop
    as well. I found the attached code to stop the mc's, but now am
    having trouble with the sound objects.
    Here's the issue, I used this:
    this.soundPosition = currentMovie.loop1.position/1000;
    this.currentMovie.loop1.stop();
    ... for the sound object stop commands and listed a new one
    for each loop I was using. On the play button I started them back
    up again. This all works, but when I start them up again they all
    play, not just the one that is currently paused. Do you mind giving
    me some guidance with the for (obj in mc) loop? My loop experience
    is nil. What I want to do is have the code cycle through all of the
    loops to see which one is playing, then store that information in a
    variable, then pause and play the variable. Does that sound right?
    Thanks again for the help!
    -Sandy

  • How to close the Sound object

    I'm using Flash CS3, running code in ActionScript 3.
    I use the Loader class to load a child SWF file, which then
    takes over the entire area on my website that is reserved for
    Flash. If the user decides to stop watching the SWF file before it
    is completed, he hits the "close" button within the child SWF,
    ultimately causing the Loader.unload() method to be executed. So
    far, so good, only the sound from the remaining portion of the SWF
    file keeps playing. According to the Flash Docs for the
    Loader.unload() method:
    "As a best practice, before you unload a child SWF file, you
    should explicitly close any streams in the child SWF file's
    objects, such as LocalConnection, NetConnection, NetStream, and
    Sound objects. Otherwise, audio in the child SWF file might
    continue to play, even though the child SWF file was unloaded."
    It then gives an example that assumes you already have access
    to the Sound object, so closing the Sound object is done by:
    mySound.close();
    The only problem is that I have no idea how to access the
    Sound object when I use the Loader.load() method. Where is this
    beast? I can't seem to find anything in the documentation that
    tells me how to find the Sound object after calling Loader.load().
    As a temporary fix, I modified the target SWF file so that when the
    "close" button is hit, it calls the "stop()" function; however,
    this only stops the sound, it does not close the associated Sound
    object, and I presume it continues to lurk around in memory with
    nothing useful to do. (When the user hits the "close" button in the
    child SWF file, it creates a "bubbling" event so that the Loader
    class can call the Loader.unload() method on it.)
    I've attached code for your reference.
    Any help is deeply appreciated!
    -Dan

    Ack! Looks like I hijacked this thread, sorry.
    I'm doing almost exactly the same thing the OP is doing...
    Loader class to load an external SWF (which is a video file FLV).
    If the user hits the "close" button on the video, the video goes
    away as it should but the audio continues.
    I understand that I need to close any NetConnection and
    NetStream objects in addition to unloading the movie. What I don't
    understand is how to do that. I'm sure that it's a syntax thing I'm
    just not getting right. I would just really like a more detailed
    explanation of stopping NetConnections and NetStreams (but an
    explanation for the not-so-actionscript-experienced LOL).
    Thanks.

  • Sync two sound object

    Hi to all!
    I have a little question about play sound in Flex (with AIR).
    I create two Sound Object and load two mp3 file. Now i want that this two file start playing at the same time, when user click a button.
    The problem is that two file, when playing are a little lag (delay of about 1/2 second or less)...
    Where is the problem? Is an actionscript bug or is my interpretation of the sound class incorrect?
    This is my simplified code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
    <mx:Script>
         <![CDATA[
              public var sound1:Sound;
              public var sound2:Sound;
              public function  init():void
                   var path:String = "C:\\Documents and Settings\\myuser\\Documenti\\song\\";
                   var request1:URLRequest = new URLRequest(path + "file1.mp3");
                   var request2:URLRequest = new URLRequest(path + "file2.mp3");
                   sound1 = new Sound(request1);
                   sound2 = new Sound(request2);
              public function StartSong():void
                   sound1.play(0.0, 0.0, null);
                   sound2.play(0.0, 0.0, null);
         ]]>
    </mx:Script>     
         <mx:Button id="Start" x="113" y="101" label="Button" click="StartSong()"/>
    </mx:WindowedApplication>
    Thanks to all in advance.
    Regards.
    Luca

    I used thse mp3 files:
    http://muzakdeezign.com/air/funk_drums.mp3
    http://muzakdeezign.com/air/funk_bass.mp3
    For your test you use Mp3 file with particular encoding? I try with many mp3 and all havea sync problem.
    I used MediaCoder to encode from wav to mp3
    http://mediacoder.sourceforge.net/
    But from what I can tell (and have read), it doesn't matter which encoder you use.
    here's the code I used:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="appInit()">
    <mx:Script>
      <![CDATA[
       private var sound1:Sound;
       private var sound2:Sound;
       // appInit()
       private function  appInit():void {
        trace("Application ::: appInit");
        var request1:URLRequest = new URLRequest("loops/funk_drums.mp3");
        var request2:URLRequest = new URLRequest("loops/funk_bass.mp3");
        //var request3:URLRequest = new URLRequest(path + "G.mp3");
        sound1 = new Sound(request1);
        sound2 = new Sound(request2);
       // startSong()
       private function startSong():void {
        trace("Application ::: soundCompleteHandler");
        sound1.play(0, 0, null);
        sound2.play(0, 0, null);
       ]]>
    </mx:Script>
    <mx:Button id="Start" x="113" y="101" label="Button" click="startSong()"/>
    </mx:WindowedApplication>

  • Is it possible to add multiple sound objects to a slide

    I am wanting to make slides that contain several "cards". Each card would have a word on it (sight words for elementary students). I'd like to place 2 speech bubble graphics on each card. Students would click one of the bubbles to hear the word read to them (me recording the words). They would click the 2nd bubble if they wanted the word read in the context of a sentence.
    Is this possible within Keynote? I know that it's possible within Powerpoint to make any object a sound object--and I believe that I could do more than one on a slide.
    However, I've never tried anything like this in Keynote and I'm not sure if it's even possible.
    Any ideas?

    Keynote is designed primarily for linear presentations, and really doesn't have any capability to do actions (other than hyperlinks) when an object is clicked. If you wanted each card to play the two recordings in order on each click, then you could do this in Keynote, but if you want the second recording to play only if the students clicks on it, then this isn't really possible in Keynote.

  • Preloader and Sound Object

    My Flash site has a media player which uses the attachSound
    method to play and skip through 3 mp3s. As a result the preloader
    shows up after the movie has loaded 60%. To rectify this, i changed
    the Publish Settings under the Flash Tab so that the classes for AS
    2.0 load in the 2nd frame of the Preloader Scene(I have separated
    the preloader and the main movie to diffrerent scenes..)
    I read it somewhere that to correct a similar problem with
    MCs, you need to place them somewhere in the timeline (say,Off
    Stage), But how can same be done for Sound Objects.???

    if i do that then the preloader works fine,however the player
    doesnt work...since the audio files dont get loaded..

  • My ipad was is displaying an alert message " A wi-fi connection is required to download your apps and media". So it has been connected to the internet over night and this morning but is still displaying the alert message and it won't go away. what to do?

    Hi,
    My name is Norbert. I am having some difficulties restoring my icloud back up. My ipad was doing an icloud back up and the alert message displayed on the ipad after my internet was interrupted "A wi-fi connection is required to download your apps and media".
    I got the internet working, my ipad is receiving internet network but the alert message is still displayed on the ipad and won't go away, to make matters worse the ipad is frozen and i can't do anything.
    Please can anyone with a similar experience tell me what to do in this situation?
    Thank you

    Welcome to the Apple Community.
    Have you tried a hard restart. Press the on/off button and homescreen buttons together until the device shuts down.

  • I am using a mini display to hdmi with my macbook and the display works fine. However, the sound will only play iTunes such as music and movies but when i go online to watch movies on youtube it will not play any sound. Please help

    I am using a mini display to hdmi with my macbook and the display works fine. However, the sound will only play iTunes such as music and movies but when i go online to watch movies on youtube it will not play any sound. Please help

    HDCP maybe? Read this http://www.macnn.com/articles/08/11/26/displayport.drm.conflict/

  • "Quality and Media" not displaying in Print dialog.

    I am using Mac OS X 10.6 Snow Leopard on a Macbook Pro with a Canon MB5220 Multifunction printer over WiFi. I have installed the Canon Drivers and can print to the printer but the "Quality and Media" menu choice does not display in the print dialog so I can't set any of the quality settings or the color settings for the printer.
    I installed and re-installed the drivers. Tried with several applications such as TextEdit and preview. Only menu choices are Layout, Color Matching, Paper Handling, Cover Page, Scheduler.
    Is there anything that would keep Quality and Media from dispaying?

    It's not just the Quality & Media menu that appears to be missing. There are three other Canon menus you should see like below;
    These menu items are supported by the plugins bundle installed in /Library/Printers/Canon/BJPrinter/PDEs, which supports a number of Canon inkjet printers. Since reinstalling the driver for the MG5220 has not helped then I would try a reset of the printing system and then adding the printer again. To reset the printing system, open Print & Fax, move the mouse over the Printers list and Control-click. The reset popup will appear. Select it and authenticate if prompted and then restart the Mac. Please note that this action will remove all printer and scanner queues from Print & Fax, but not the associated drivers so just the queues will need to be added again.
    If this action does not resolve the problem then try running the Canon Driver Update v2.6.

  • Why is the sound quality and volume in itunes so different than when I use other media players

    This is an issue which has been vexing me for some time. I've researched it all over the web and have not found a worthwhile answer. Some other posts on these forums have asked similar questions without successful answers. But, none the less, I will try...
    I have spent a lot of time over the last two years trying to get my itunes library organized as well as getting good digitized versions from my vinyl records as well as CDs. I was pleased with my results and then I added the songs to itunes. I could not believe how inconsistent the sound quality was. Invariably the volume is always lower. [Please do not post a reply such as: Check the volume controls in itunes proper as well as in itunes preferences (i.e., Sound Check, Sound Enhancer) & the Volume Adjustment in the Information pane under Options for particular songs.] I tried all of those means of adjusting volume. They do NOT work.
    There is something more insidious at work in itunes which prevent good sound reproduction. I will give an example. I have played Frankie Valle and the Four Season's song "C'Mon Marianne" on the OS X system sound (i.e. clicking the play button to the song file when selected on the desktop or wherever it resides) as well as in Amadeus Pro. The song sounds great. When I play it when it's in the itunes' library the first part of the song is too lound and then when Frankie Valle starts singing his voice is at a significantly reduced volume.
    I have edited the foregoing song in Amadeus Pro to a very high volume (i.e., Effects>Amplify), reloaded it into itunes and it still does not inprove the volume of Frankie's voice in the song, even though the rest of the song is somewhat louder. I have played with the Equalizer in itunes to no effect. It just does not work.
    Now, I would glading move away from itunes and use another media player. However, I have other Apple devices through which I listen to music. And the only way I know of to listen,e.g., on the iphone is through itunes.
    The other related problem with itune, or should I say iCloud, is icloud match. The icloud Match has taken great sounding music and given me back music of an inferior quality, even though it is a Matched AAC format.
    I'm am sorry if I am a little peeved about this issue. If anyone has some suggestions or input to a solution, I will be eternally grateful. Thanks a bunch.

    fbuerg,
    You are welcome. Glad my good fortune was helpful to you.
    Time Keeper

  • Regading Object History and Structure Display

    Hi all,
    I need to add the standard functionality for the Object History and structure    Display in my screen where i have FUNCTIONAL LOCATION  as the input.
    So i need the standard functioanlity for these field in my screen.
    Please tell me how it can be achieved.
    Useful answers will be rewarded.
    Thanks & Regards,
    Arun

    THANKS

  • Access Denied in Data Protector 8 display when trying to view Devices and Media in the UI

    I installed Data Protector 8 User Interface from the program disk on some Windows Office 7 Lap Tops for my staff.  When they try to view Devices and Media, they get Access Denied.
    I see other consumers post this issue and it is a bug in Data Protector 8.
    Is there a fix for this issue?

    except that if it could publish to both swf/html5 today my project would run on desktop. Again the swf would help for running the desktop version of the project and mobile devices of course would pick html5.
    one - what seems to you does not need to seem to me hence ur own assumption
    two - I'm asking for advice and help, if you can please do if you can't no need to get personal
    Thank you

  • Embedded application/x-shockwave-flash objects will not display

    4.0b9 on Windows XP
    I just get a white section where a shockwave flash object should be, and in all the occurences I've found it's when the flash object is embedded. Youtube works just fine, though...
    In the "white section" I can right-click and get the options for Adobe Flash Player 10, but I cannot actually choose any of the menu options.
    In some cases, I can choose to display the flash object in another tab, and then it works just fine. Typically an embedded youtube movie clip acts like that that, but not always.
    In an example, I see only a white section where the shockwave flash object should be visible in Pichfork TV - http://pitchfork.com/tv/
    When I open the page information, in the media section, list of URL's, I find an URL that is both grey and italic, and describes this URL as type Embedded:
    URL - http://pitchfork-cdn.s3.amazonaws.com/player/DelveMoviePlayer.swf
    Type - application/x-shockwave-flash
    I assume this URL is grey and italic because it is not loaded or opened in the pitchfork TV site.
    This is the same problem with most embedded flash objects, and I really hope someone can help me! I've browsed aroud the support forums and tried a lot of different tips, but to no avail.
    I have of course uninstalled and reinstalled both flash player and shockwave from adobe's site, and made sure it's not the active-x version for IE that's installed.
    My add-in manager claims that Shockwave Flash 10.1 r102 is installed and enabled, and the release is the latest available according to adobe.com.
    I have also tried to open FF in secure/private mode, but same problem in both modes.
    Just to check, I tried to open this site with IE8, and there it displays correctly (and I also remembered why I don't ever use IE8, haha...), so apparently the active-x part of shockwave/flash works...
    BR, Torgeir

    OK, so now I've tried again to open FF in safe mode again, but the problem is still unsolved. Same problem in safe mode.
    The hardware acceleration in the flash player is set to disabled long before I posted this problem.
    I didn't know that Pitchfork had such a special flash player, but the problem is the same on any sites. Just chose Pitchfork because it's an English site. Bad example then...
    Here's a better example: NME.com:
    http://www.nme.com/musicvideos/my-chemical-romance-sing/832454
    Here I only see a white space where the flash object is embedded (if it really IS embedded, I dont't know how these things work). But I can right-click and get the dialog for Adobe Flash Player 10 properties (such as settings and global settings), and if I'm lucky to hit the start button (wich I don't see), the flash object starts playing, and I hear all sound but see no image.
    I open the page info menu, and here I find in the list of media URL's the link to the flash object, described as an embedded object in the NME site:
    URL: http://www.muzu.tv/player/getPlayer/a/RSFVcmvHJ4/autostart=n&includeAll=y&soundoff=n&vidId=832454&videotype=hq
    Type: application/x-shockwave-flash
    It's grey and italic in the list of media URL's, and I assume that's because it's not properly loaded.
    But if I copy the URL from the media URL list and paste it into the adress field of a new tab, I can both see and hear the flash object without a problem.
    This is exactly the same issue with local sites that have embedded web radio stations. Cant see the object, and have to be quite lucky to hit the start button. But by stepping via info for site and copy the URL to the flash object and paste it into a new, empty tab, I can both see and hear whatever was supposed to display in the original site.
    Any help would be more than welcome! So many of the sites I use most has embedded flash objects, so if I cannot solve this I have to find another browser. I REALLY don't want to, because otherwise I really love FF...

  • How to garbage collect an newed as3 Sound Object from memory?

    For example, using next text code:
    package
              import flash.display.*;
              import flash.events.*;
              import flash.media.*;
              import flash.system.*;
              import flash.system.*;
              public class Main extends Sprite
                        [Embed(source = "../data/SongScene8.mp3")] protected var SongScene8:Class;
                        public function Main():void
                                  if (stage) init();
                                  else addEventListener(Event.ADDED_TO_STAGE, init);
                        private function init(e:Event = null):void
                                  removeEventListener(Event.ADDED_TO_STAGE, init);
                                  System.gc();
                                  trace("Before");
                                  trace(System.totalMemory);
                                  trace("_________________")
                                  var sound:Sound = new SongScene8();
                                  System.gc();
                                  trace("After new");
                                  trace(System.totalMemory);
                                  trace("_________________")
                                  sound = null;
                                  System.gc();
                                  trace("After null");
                                  trace(System.totalMemory);
    The output is:
    Before
    3461120
    After new
    3604480
    After null
    3604480
    * Even if the gc runs a thousand times after, the last, increased value remains.
    * I've tested this too by importing an mp3 from an .swc, rather than from a file. The result is similar.
    * Tracing System.privateMemory rather than System.totalMemory gives similar (although offset) results.
    Wether or not a soundchannel is played on it, it looks like the Sound Object
    cannot be removed from memory.
    Please say I'm wrong and tell me why.
    Thanks in advance

    works for me in cs5.5:
    Loop 1
    Before
    28780
    sound created
    28796
    After null 0
    29380
    After null 1
    29196
    After null 2
    29192
    After null 3
    29192
    Loop 2
    Before
    29192
    sound created
    29208
    After null 0
    29196
    After null 1
    29196
    After null 2
    29196
    After null 3
    29196
    Loop 3
    Before
    29196
    sound created
    29208
    After null 0
    29196
    After null 1
    29196
    After null 2
    29196
    After null 3
    29192
    Loop 4
    Before
    29192
    sound created
    29204
    After null 0
    29192
    After null 1
    29192
    After null 2
    29192
    After null 3
    29192
    Loop 5
    Before
    29192
    sound created
    29204
    After null 0
    29192
    After null 1
    29192
    After null 2
    29192
    After null 3
    29192
    Loop 6
    Before
    29192
    sound created
    29204
    After null 0
    29192
    After null 1
    29192
    After null 2
    29192
    After null 3
    29192
    Loop 7
    Before
    29196
    sound created
    29208
    After null 0
    29196
    After null 1
    29196
    After null 2
    29196
    After null 3
    29196
    use a frame loop to repeatedly execute the following and verify no memory leak:
    var loops:int;
    loops++;
    if(loops>6){
        stop();
    } else if(loops==1) {
        var s:String = "";
    s+="Loop "+loops+"\n";
    s+="Before\n";
    s+=System.totalMemory/1024+"\n";
    var sound:Sound = new SongScene8();
    s+="sound created\n";
    s+=System.totalMemory/1024+"\n";
    var n:int;
    clearF();
    function clearF():void {
        n=0;
        sound=null;
        this.addEventListener(Event.ENTER_FRAME,f);
    function f(e:Event):void {
        System.gc();
        s+="After null "+n+"\n";
        s+=System.totalMemory/1024+"\n";
        n++;
        if (n>3) {
            this.removeEventListener(Event.ENTER_FRAME,f);
            s+="_________________\n";
            if(loops>6){
                trace(s);

Maybe you are looking for

  • My ipod shuffle is stuck in recovery mode help?

    ive been trying all day and getting sick of it i restore the ipod and it comes up with ipod in recovery mode restore to use does this over and over and over again please haelp someone?

  • Importing as PAL not NTSC

    When I import into iMovie HD 6 from file (these are .3gp files from my phone) as a new project, it gets created as DV-NTSC and I can't see a preference setting to choose PAL instead. I can export using Export > Expert Settings > Share > DV Stream and

  • App uses too much memory!

    My iPad shows that apps takes up about 8.7GB on it's memory but in reality it's only 7GB. iTunes displays it correctly when I deselect/select an app to sync, but when it actually syncs it, it revert back to the increased size. Here it is before selec

  • BO XI R2 - Showing decimal places

    Post Author: Vorax CA Forum: WebIntelligence Reporting Good afternoon all, I am using BO XI R2 (Webi), and have created multiple variables. The issue is that the variables are showing the cents of the figure even though I have formatted the cell. I a

  • Date in the billing document

    Hi, expert, I have a question about the date of billing doc., If we set up invoicing date for customer-A is at the last day of every month, and SAP billing job only run every workday. Apr.30 is Sunday, so SAP billing job will run on May 1st instead o