Play a sound during a state transition

Greetings,
I would like to associate a sound with a transition so that it is played during the duration of the transition.
What is the best way to do that in flex Hero?
Thank you.

You might find the SoundEffect class useful, for example:
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx"
          title="Sound Effect">
     <s:states>
          <s:State name="state1"/>
          <s:State name="state2"/>
     </s:states>
     <s:actionContent>
          <s:Button label="toggle state" click="currentState=currentState=='state1'?'state2':'state1'" />
     </s:actionContent>
     <s:transitions>
          <s:Transition fromState="*" toState="*">
               <s:Parallel>
                    <s:Parallel target="{target}">
                         <s:Fade />
                         <mx:SoundEffect duration="1000" source="mySound.mp3"/>
                    </s:Parallel>
               </s:Parallel>
          </s:Transition>
     </s:transitions>
     <s:Button id="target" label="target" width="100" height="100" verticalCenter="0" horizontalCenter="0"
                 alpha.state1="1" alpha.state2="0.5"/>
</s:View>

Similar Messages

  • State transitions across components?

    Hi,
    I've been using Catalyst for a few days now to put together a "clickable mockup" of an app. Instead of working based on a comp, I'm creating the UI in Catalyst directly, using it's built-in components and creating a "wireframe" look. Works fine. I anticipate to work with more hi-fi comps.
    One thing I'm having trouble with, is making deep transitions between states from subcomponents.
    Imagine this setup:
    The app has two states/pages, "1" and "2". Inside each page, I have one component to represent all the states of that page. So for the first page, the internal component states would be 1-1, 1-2 and 1-3. Ditto for 2.
    So, now, let's say that in state 1-3, I have a button inside the component, where I want to transition to 2-2. Currently, it appears that there is no way for me to do that. When I click on the options in "Play transition to state" of the button, it shows me states 1 and 2, as well as 1-1 through 1-3, but it does not show the "child" states of "2".
    Is there any way to accomplish the transition from 1-3 to 2-2?
    Another version on the same problem: let's say I can somehow get from 1-3 to 2-2. Now, inside 2-2, I have a button that jumps back to "1". Currently, when I jump to "1", it jumps to whatever state 1 was in, which is 1-3 in my case, which is undesirable. It would be nice if I could somehow reset the component state on some event (showing, hiding, ...) to its default state, so that when people later jump back to it, it would start in its default state.
    I am familiar with ActionScript and XML and did poke around a bit. I see that in components, there is this kind of code:
      protected function Button_click_1_1():void
        mx.core.FlexGlobals.topLevelApplication.currentState='AppHome';
    I speculate that this lets me do what I need by editing code, and instead of topLevelApplication.currentState using topLevelApplication.someComponent.currentState... but I wanted to see if there is/will be another friendlier way of accomplishing this?

    Hi,
    Just my, hopefully helpful thoughts about how to render complex state transition much easier to understand, design and debug ...............
    Perhaps, initially for coders with a solid background in conditional logic, the inclusion of one or two design windows/panels providing the ability to design and display at least state transition diagrams and preferably also state transition tables, could be very helpful when trying to either design or understand complex, inter-related state transitions - actually, even relatively simple state-transitions with only five to seven objects, each with only three or four states to track concurrently, can be difficult to design, debug and test using just a mental model and memory to retain knowledge of the desired vs. actual state transition paths.
    Although I say "initially for coders", many years ago I taught both of these techniques successfully during software "design principles" courses that addressed software developers who's function was to prepare "design specifications" rather than actually write the code which, in those days, was the job of programmers rather than designers.  In fact many of my students were not programmers at all - for example analysts who used state transition diagramming techniques to design functions regardless of whether those functions would become implemented as code, or as a set of human actions, or mechanical machine operations (think pinball!).
    It should be possible using today's technoloy to be able to
        (a) generate code from a state transition table or a state transition diagram and
        (b) generate both forms of diagram from existing code (including the code autogenerated during visual design and
        (c) consistency check existing code automatically.
    It should be possible, using state transition table and diagram functions, to highlight structural logic errors.  How such highlighting should be done, for example:
        (a) using a classic state transition table or diagram or
        (b) generating some form of structured text report or
        (c) inserting colour-highlighted error messages in-line in the code or
        (c) some other more visual-designer-oriented signalling technique or
        (d) a combination of several of the above
    would be a design issue for Adobe.  This would not be a trivial exercise for Adobe, but the functionality would be reusable, i.e. transferable into other products.
    After all, the only reason for such tables or diagrams is to render complex state transitions understandable by humans, and these two techniques have proved extremely useful for many decades in many areas of design - programming, electronic circuit design, machine design, business process design......
    Re. Catalys, it's just a classic program design application, with some whizzy UI graphics that need to display, disappear, change colour, glow, shimmer, move, .... in predictable and desirable ways.
    The original pinball machines used mechanical relays to implement their underlying state transition diagrams; pinball designers needed to understand at least two things (a) complex state transitions and (b) a well designed UI. From this point of view, Catalyst looks like a pinball design panel!

  • I've upgraded to OS 10.8.2 and my Bowers and Wilkins MM-1 Speakers were working fine until today, and now they won't play any sound at all, even though iTunes shows the audio is playing. I've tried both the headphone jack and the USB port. Please help!

    I've upgraded to OS 10.8.2 and my Bowers and Wilkins MM-1 Speakers were working fine until today, and now they won't play any sound at all, even though iTunes shows the audio is playing. I've tried both the headphone jack and the USB port. Please help! I don't want to have to be stuck using my internal speakers!
    Thank you,
    Chris

    Michael,
    Thanks. I haven't mixed down the audio or checked the number of tracks in Prefs. Good points.
    As far as a mixdown goes, I'll definitely give it a try, though I wonder whether or not the tracks will be recognized during mix down recording - given that you can't hear either of those segments in playback. Just have to try.
    Re the preferred number of allowed tracks - I'll go check as soon as I send this off, but I'm not sure that applies in this case, since the two Channels containing the segments that are pinked out are not in additional tracks. I should have mentioned that other audio clips and segments on the same Channels in the SAME tracks ARE heard in playback. As are two additional track in the 2nd Sequence. It's only when the two sequences are joined that the pink tinted segments can't be heard. Within the sequence the same audio cuts playback as they should. Thanks again &
    Best regards,
    David

  • Docked iPod only outputs sound during video to TV

    I have a 5G iPod in an Apple dock, connected to my TV using a Monster audio cable and an S-Video cable. For some reason, it only outputs sound during videos or a photo slide show - not at all for music only playback. I'm baffled! Any idea why? It's a Panasonic plasma, and I've tried three different inputs. None work for music, but video is fine.

    The iPhone 4, unlike iPod, doesn't ask you to set for PAL or NTSC.  In fact, in the SETTINGS/Video menu it only asks if you want to "Start Playing From Beginning", "Closed Captioning" and "Home Sharing".  I was surprised it had no settings like the iPod at all.

  • No sound during import from camcorder

    When I am importing video from a DV tape in a camcorder I don't hear any sound. After the clip is captured, you can hear the sound during playback. Is there a setting that allows you to hear the sound during import? I have tried importing HDV format from a camcorder and regular DV from a tape deck with the same results.

    iMovie does not play sound on import. This makes sense if you consider that most current camcorders do not import in real time. They are faster or slower than real time depending on the speed of the Mac.
    See if your camera has a speaker. You can listen from the camcorder.

  • TS5150 i'm having trouble with the sound during playback on my apple tv

    theres no sound during playback on my apple tv

    Welcome to the Apple Community mdez3799
    Have you tried adjusting the "Audio Out" and the "Dolby Digital" settings in settings > audio and video? It may be worth trying several combinations of these settings, although typically it is the "Dolby Digital" setting that causes most problems for users.
    If you are using a sound system/receiver, make sure that you have correctly mapped the input port on your sound system to the output, if you are unsure about how to do this, refer to the manual that came with your sound system.
    Have you tried playing various content sources (i.e. podcasts, music, iTunes Store video, other video etc), do you have the same problem with all types of content? If you use optical you might also check that you can see a red light at the end of your optical audio cable. Is your optical audio cable plugged straight into your sound system, or does it go through a switch or other device?

  • Having problem making my program play the sound i want it to play...

    Ok, im new at this so bare with me (and my spelling)...
    i've been trying to make my program play a musicfile during the actual program... and trust me, i've tried so many times...
    after the last try i get the errormessage "cannot find symbol" for 2 things...
    import javax.swing.*;
    import javax.sound.sampled.*;
    import java.io.*;
         public class iwish {
              public static void main (String args[]) {
                   AudioClip sound = JApplet.newAudioClip(new URL("file://C:\\Program\\Java\\jdk1.6.0_02\\bin\\iwish1.wav"));
                   sound.play( );
                   String a = JOptionPane.showInputDialog("Vem kan du vara?");
                   String b = JOptionPane.showInputDialog("Jaha " + a + ", sommar eller vinter d??");
                   String c = JOptionPane.showInputDialog("Vem vill du helst av allt ha bredvid dig nu?");
                   String d = JOptionPane.showInputDialog("D? f?rst?r jag, glass eller choklad (du f?r bara v?lja ett f?rslag)?");
                   String e = JOptionPane.showInputDialog("Vart f?redrar du att sova d? (gl?m inte prepositionen)?");
                   String f = JOptionPane.showInputDialog("Ok, om du korsar fingrarna, l?gger du pekfingret under eller ovanp? l?ngfingret?");
                   JOptionPane.showMessageDialog(null, "Ok, jag kommer fram till tv? alternativ:");
                   JOptionPane.showMessageDialog(null, "Alt 1; " + a + ", p? din " + b + "semester har du helst sex \n med " + c + " " + e + " samtidigt som du ligger " + f + " " + c + " som \n f?rsiktigt slickar " + d + " fr?n din kropp, tills hela din kropp skakar av njutning!");
                   JOptionPane.showMessageDialog(null, "Alt 2; Du f?redrar ingen speciell ?rstid eller speciellt st?lle \n att ha sex p?, s? l?nge du f?r ha det med " + c + ". Sedan f?r du \n somna i " + c + "s famn. Glass och choklad kan du alltid f? n?r du vill!");
                   System.exit(0);
    the problem is: iwish.java:10: cannot find symbol
    symbol : class URL
    location: class iwish (at the U) ^
    AudioClip sound = JApplet.newAudioClip(new URL("file://C:\\Program\\Java\\jdk1.6.0_02\\bin\\iwish1.wav"));
    ^
    am I making any sense?! =) what have i done wrong?

    ok, thank you,
    i tried it with the catchphrase and the program worked just as it did when I threw the exception...
    import javax.swing.*;
    import javax.sound.sampled.*;
    import java.io.*;
    import java.net.*;
    import java.net.URL.*;
    import java.applet.*;
    import java.applet.AudioClip.*;
         public class iwish {
              public static void main (String args[]) {
                   try
                   AudioClip sound = Applet.newAudioClip(new URL("file://C:\\Program\\Java\\jdk1.6.0_02\\bin\\iwish3.wav"));
                   sound.play();
                   catch (MalformedURLException j)
                   j.printStackTrace();
    I changed the "e" to a "j" in the "catch (MalformedURLException j)" since I was using the e in one of my strings...
    Was it supposed to work or did I do wrong? =/

  • No Sound During DVD Playback

    I have a new HP elitebook 8460p and there is no sound during DVD playback. Is there a setting I may be able to change? Here is a list of things I've tried and pertinent information:
    - Confirmed all system mute settings are off (e.g., not muted)
    - Confirmed DVD works on other devices
    - DVD will not play sound in InterActual Player, Windows Media Player, or VLC Media Player
    - Picture is fine...just no audio
    - Running XP
    - All other system sounds work
    Help!

    Try installing AC3 Filter:
    http://www.free-codecs.com/download/ac3_filter.htm
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • Randomly skips/fails to play some samples during playback?

    Randomly skips/fails to play some samples during playback?

    You're right that was foolish let me clarify.
    Raising the I/O buffer thing is a good idea, i've tried that already though and no joy
    BASICALLY i've had this problem with a couple of tracks, ones which i have worked on the longest and probably the ones with the most effect plugins and tracks used. Seemingly at random during playback some of the samples dont play (and some even stop playing halfway through the sample). If the regions are bounced, the resulting wav file visibly splits the original sound where the computer 'decided' to stop/restart playing the sample. Again, i haven't found a pattern: - at one point a four bar loop with three tracks solo'd would play all the tracks perfectly during playback for a few seconds, then suddenly switch to only playing one track, then switch back after another few seconds.
    Weird.
    I think it may be related to previous experience which i have had with the Space Designer and Echo effects, where the echo or reverb sound itself cuts out halfway through the sound/after a seemingly random amount of time (and then cuts back in).
    I've seen this reverb and effect problem on more than one computer, but the original problem with the track playback is, in my experience, unique to my system.
    The computer i'm using is not old or at all running out of memory (although i realise this does not exempt it from being the cause of the problem)
    Anyway this has been trolling me for weeks and its driving me mad
    Thanks
    OP

  • No sound during title playback

    hi i'm wondering if sum of you guys could help me out. ive just got my first mac and im very pleased
    i am trying to burn 3/4 episodes of a tv show that i have in .avi container, mp4 format, each aprox 350mb in size, to dvd format with the abillity to select which of the 3 episode i would like to watch. i am not fussed about glitz and glamour with regards to menus, just quality audio and video.
    i use ffmpgx for single movies
    i have previously used vso convertx to dvd with great results on a pc, but is not supported on mac.
    i have downloaded a divx component for quicktime, and also have vlc installed
    i have tried to burn the episodes using idvd, and all seemed to be going well, having set the preferences to allow for the img size needed. i left the dvd to encode over night and had it set to make an img file.
    when i tried playing back the img i had great video quality, but no sound what so ever, and cannot for the life of me figure out why.
    does anybody no the cause?
    to recap,
    avi container-(according to ffmpegx summary, video= mpeg4, yuv420p, 624x352)
    audio= mp3, 48000 Hz, stereo, 32 kb/s
    burned using idvd
    menu music is present
    no sound during playback of titles
    burn setting to x1/2
    taiyo yuden dvd-r disc
    1gb ram
    200+gb hard drive
    2gig intel core 2 duo
    minimal programmes running
    on another note, while on a pc i was using a program called gspot for determining the required video and audio codes required and whether or not it would render/play on the system. is there anything similar for mac?
    cheers for any and all help
    martyn, a new mac enthusiast

    Hi!
    Welcome to the discussions and to Macs!
    Don't know about your specifics, but a simple thing to test is to look at the iDVD menu for the titles....I am assuming this is on a submenu....to see if the audio icon is active. If you look in the audio well, there should be a tiny icon with wavy lines. If it is not present, click on the audio well and it should return. It is very small...I almost could not see it.
    You cannot see this if you have any audio files in the well, so remove the file first.
    I am sure more knowledgeable users will offer their advice as well.

  • Still play without sound!

    I borrowed a friend's Sony videocamera to film a projekt for my thesis.
    The videocamera produces MPEG 2 files, which cannot be played correctly on Quicktime (Snow leopard 10.6.8)
    To solve this problem I bought apple's mpeg 2 component which promises to solve the problem but it doesn't work.
    Mpegv2 videos still play without sound! Have I wasted my money?
    Anyone with the same problem? any suggestions?
    PS. I've tried all the 'classic' solutions: deleting and re-installing QT, using QT 7, repair permissions, but nothing seems to work!

    I solved my problem with MPEG Streamclip. Although it dates from 2008, it does the job perfectly and for free :-). I could see the videos before (with sound) with VLC and Toast Video Player, but editing..well that's very tricky to do in Toast (with limited possibilities) and impossible in VLC and my project involves video editing. I have iMovie 09 and tried to import the original mpeg2 files, but it wouldn't recognize them.
    To be automatically converted by iMovie, you must import the files directly from the camcoder. Once the files are moved to your hard drive, iMovie uses Finder-level routines to move the files into iMovie rather than the "Importer" module which handles many different QT non-editable camcorder formats. If you manually copied/moved the files to your hard drive, then you must manually convert the non-editable compression formats to editable formats.
    The solutions you offer on QT MPEG2 Playback component can prove useful to me in the future, it seems though a bit too complicated and time consuming to go through all these conversions...
    The demuxing/re-muxing work flows are very quick since the video is not converted—only re-wrapped. Unfortunately, these work flows are more for viewing the content than for preparing the video for editing. If you plan to do your editing in iMovie, then I would recommend converting the MPEG-2 video to AIC and the audio to Uncompressed. If editing in FCP, then you can convert the content to your preferred "project" compression format. If all you want to do in way of editing is to trim and/or merge files without titles, transitions, and such, then you can do that from within MPEG Streamclip. It also allows you to crop and/or center frame content and includes filters to modify contrast, brightness, saturation, change volume, and/or adding a text watermark if desired. Unfortunately, these routines can only be accessed as part of an export work flow.
    I think it could be simpler and I still doubt that buying QT MPEG-2 Playback component was worth it :-(
    Lion though seems to have solved this problem...but I am not quite ready to change OS yet..
    As previously stated, the simpliest editing approach is to import/manage content directly from the camcorder to iMovie. With regard to the QT MPEG-2 Playback component, if you worked on any MPEG-2 content while testing MPEG Streamclip, then you are already using it. Otherwise you would have received an error message stating you needed to purchase/install the component. With regard to Lion, while QT X can play "muxed" MPEG-2/AC3 content in MPEG or MPG containers, it does not support the VOB file container. Further it does not support resource paired M2V/AIFF or M2V/AC3 non-paired elementary streams like QT 7 with the MPEG-2 component does. In short, while QT X.1 solves some MPEG-2 playback problems, it still can't do some things that the QT 7 Player can do and neither can edit GOP content natively as MPEG Streamclip can.

  • Playing audio sound when slide is clicked

    I have a button on my first slide which links to the third slide, and I want to play a sound as soon as the third slide is opened. How do I do this?

    Drag the sound file to the third slide. Select the speaker icon for it, and in the Build Inspector, set its Build In to "Start Audio". Click the More Options button to show the Build Order drawer, and use the dropdown menu to set the build to start "Automatically after transition".

  • What's the wave's number of iPhone 4S speakers? I need to know what's the number because my phone doesn't play any sounds, and I kind of knew what's the problem and sulotion!

    What's the wave's number of iPhone 4S speakers? I need to know what's the number because my phone doesn't play any sounds, and I kind of knew what's the problem and solution!
    What I mean by wave is like radio channels' waves! Ex. 104.1

    Your statement makes no sense.
    Have you tried basic troubleshooting from the User's Guide to rule out some setting in the device preventing the speaker from working?
    Is the mute switch on?
    Do other sounds work?
    Does it produce sound with headphones plugged in?

  • Loading and Playing Multiple Sounds

    I have written a loadSound function which handles loading and playing multiple sounds. This function works fine when I call this function in another keyframe i.e. the frame in which the function is not written. But when I call the function on the same frame in which the function is written the sounds gets mixed up. For example the function is written in 1st keyframe. If I call this function in 2nd, 3rd and 4th keyframe (with different sounds) it works fine. But when i call the same function in 1st, 2nd and 3rd keyframe it all gets messed up.
    In 1st keyframe the sound plays properly. When I move to 2nd Keyframe the 2nd sound plays. But when I move back to the 1st keyframe the 2nd and 1st keyframe sounds all get mixed up. This doesn't happen when I call the function in 2nd, 3rd and 4th keyframes.
    Below is my function:
    import flash.events.Event;
    import flash.media.Sound;
    import flash.net.URLRequest;
    import flash.events.ProgressEvent;
    import flash.events.IOErrorEvent;
    import flash.errors.IOError;
    import flash.media.SoundChannel;
    import flash.media.SoundMixer;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import flash.display.MovieClip;
    import flash.media.SoundTransform;
    stop();
    var s:Sound;
    var localSound:SoundChannel = new SoundChannel();
    var req:URLRequest;
    var loadedPct:uint;
    var currentFrameArr:Array = ["One","Two","Three"];
    var urlArr:Array = ["sound/m01_t01_s01.mp3","sound/m01_t01_s02.mp3","sound/page10_11.mp3"];
    function loadSnd(currentFrm:String)
    s = new Sound();
    s.addEventListener(ProgressEvent.PROGRESS, onSoundProgress);
    s.addEventListener(Event.COMPLETE, onSoundLoaded);
    s.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
    localSound.stop();
    for (var i:uint=0; i<currentFrameArr.length; i++)
      if (currentFrm == currentFrameArr[i])
       req = new URLRequest(urlArr[i]);
    s.load(req);
    function onSoundProgress(evt:ProgressEvent):void
      loadedPct = Math.round(100 * (evt.bytesLoaded / evt.bytesTotal));
      trace("The sound is " + loadedPct + " % loaded");
    function onSoundLoaded(evt:Event):void
      localSound = s.play();
    function onIOError(evt:IOErrorEvent):void
      trace("The sound could not be loaded: " + evt.text);
    Call to this function in different frames:
    loadSnd("One");
    loadSnd("Two");
    etc
    If I pass the parameter 'One' in loadSnd it plays the 1st element in urlArray, 'Two' 2nd element and so on.
    I have been scratching my head since long over this.
    Can anybody please pinpoint the error.

    Got the solution. The SoundMixer.stopAll(); statement did the trick. The complete workable function is pasted below:
    import flash.events.Event;
    import flash.media.Sound;
    import flash.net.URLRequest;
    import flash.events.ProgressEvent;
    import flash.events.IOErrorEvent;
    import flash.errors.IOError;
    import flash.media.SoundChannel;
    import flash.media.SoundMixer;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import flash.display.MovieClip;
    import flash.media.SoundTransform;
    stop();
    var s:Sound;
    var localSound:SoundChannel = new SoundChannel();
    var req:URLRequest;
    var loadedPct:uint;
    var currentFrameArr:Array = ["One","Two","Three"];
    var urlArr:Array = ["sound/m01_t01_s01.mp3","sound/m01_t01_s02.mp3","sound/page10_11.mp3"];
    function loadSnd(currentFrm:String)
      s = new Sound();
      s.addEventListener(ProgressEvent.PROGRESS, onSoundProgress);
      s.addEventListener(Event.COMPLETE, onSoundLoaded);
      s.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
      SoundMixer.stopAll();
      localSound.stop();
      for (var i:uint=0; i<currentFrameArr.length; i++)
      if (currentFrm == currentFrameArr[i])
      req = new URLRequest(urlArr[i]);
      break;
      s.load(req);
    function onSoundProgress(evt:ProgressEvent):void
      loadedPct = Math.round(100 * (evt.bytesLoaded / evt.bytesTotal));
      trace("The sound is " + loadedPct + " % loaded");
    function onSoundLoaded(evt:Event):void
      localSound = s.play();
    function onIOError(evt:IOErrorEvent):void
      trace("The sound could not be loaded: " + evt.text);
    Calling the function
    loadSnd("One");
    loadSnd("Two"); etc

  • Running a State Transition on Startup

    Hi there
    Trying to get my ap to change state on startup to run a
    transition animation. The idea is that this is a nice way to bring
    the ap to life, with some movement to bring the interface in.
    Is there a simple trick to do this?
    I have tried state="
    startupState" in the WindowedApplication line which works
    for me in a Flex ap, but in Air produces a long list of complaints
    about transition effects under the category:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference
    I have tried creationComplete="state='
    startupState'" but get the same result
    Any suggestions? I am quite new to this so may have missed
    something obvious, or perhaps there is a better way than using a
    state transition to run a bit of animation on the interface at
    startup?
    Any help much appreciated
    Andy

    Hello
    The self-help bureau here...(!)
    Just in case anybody else is looking into this I have the
    solution...
    One of my Zoom transitions was set to a duration of zero.
    This plays happily in the Flex world
    In Air land on the other hand zero's are no-no's, so simply
    setting the duration to 0.001 resolved the issue

Maybe you are looking for