Play / stop methods

Hi,
I have a basic animation with two bindTimelineAction, one listening on "play" and the other on "stop".
I was not able to figure why, when my animation starts, I can see that both listeners are called, even if my animation isn't in autoplay mode.
I have dig into the edge javascript file (edge.1.5.0.js) and find that there is a «this.stop();» in the play method.
d.extend(a.prototype, n.prototype, {constructor: a,play: function(a) {
            this.notifyObservers("play");
            this.stop();
            this.sort();
            this.playing = !0;
            if (this.context)
                this.context.playDirection = void 0, this.context.executeTriggers = void 0;
            var b = this.getContext(a);
            b.timeline = this;
There is a good reason for that I guess, anyone ?
Thanks.

Using a package, I set up a public class to hold global variables. Once the variable could be accessed from any MC in the movie, I used AS to write/overwrite an array with the names of the clips currently playing.
Unlike Javascript, the instance name is not enough to access an MC. You must also have the path from where the AS event occurred (in my case, the main timeline).
I decided that it would be a waste of time to go through and manually figure out the correct information to put into the array. Just navigating the file to implement the test on the first clip change took more time than I would like to admit.
Plus, I am still not 100% sure it would have worked correctly. Wouldn't it be horrible to test the button between every clip change?
Instead of continuing with a programmatic solution, I decided to restructure the file. I believe that it was worth my time. Changes are easier, AS works as Adobe intended, and general organization has been restored.

Similar Messages

  • Flash CS3 Play/Stop audio button problem

    I made a play/stop audio button with this youtube tutorial (youtube.com/watch?v=XU6oMEFUFF8) but after the sound is finished I want the play button to show up agian.
    Here is the actionscript:
    import flash.events.MouseEvent;
    play_btn.addEventListener(MouseEvent.CLICK,clickha ndler);
    stop_btn.addEventListener(MouseEvent.CLICK,clickha ndler);
    function clickhandler(event:MouseEvent):void{
    swapChildren(play_btn,stop_btn);
    what code should I add to my current code?
    I also can send you the Fla.

    You should consider using the Sound class. Here's a quick overview of it:
    http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d21.html
    You'll be able to add event listeners to the sound to know when it completes so you can execute more code, such as swapping the play and stop button. There is an example in that overview of listening for the SOUND_COMPLETE event (e.g. channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);). It should contain everything you need.
    A basic example of what you'll end up with (there's many ways to do it) might look something like this:
    // just set up and wait for click
    var isPlaying:Boolean = false;
    var mySound:Sound = new MySoundInLibrary();
    var myChannel:SoundChannel = new SoundChannel();
    myChannel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
    // buttons
    play_btn.addEventListener(MouseEvent.CLICK,clickhandler);
    stop_btn.addEventListener(MouseEvent.CLICK,clickhandler);
    function clickhandler(event:MouseEvent):void
              swapChildren(play_btn, stop_btn);
              if (isPlaying)
                        isPlaying = false;
                        myChannel.stop();
              else
                        isPlaying = true;
                        myChannel = mySound.play();
    function onPlaybackComplete(e:Event):void
              isPlaying = false;
              swapChildren(play_btn, stop_btn);
    The basic idea is keeping a flag if the audio is currently playing. If it isn't then assign the sound to a channel and play it while setting the flag (isPlaying) to true. If it's already playing, set the flag to false and stop playing the audio.
    The swapChildren is run in the onPlaybackComplete() method so when the audio completes the play button is swapped back in front.
    Rather than swapping the children I'd urge you to toggle the .visible property instead. It's easy to run commands in the wrong order and get desynched on depth.

  • HT201401 my earphones are not working on my iphone4 to play, stop or forward to other tracks or answering a call and i know its not the earphones as ive just paid out for a new pair at £27.99 and still wont work anybody got any advice as fed up honestly

    anyone can you help my earphones are not working on my iphone4 and i know its not the earphones has just bought new pair and no joy  I can not play, stop, forward to different tracks or anything cant answer call nothing end of ideas can anyone help pretty please

    Yes there genuine apple earphones I have now blown down jack slot and silly enough I turned my phone off and now it's back on earphones working properly now feeling a wee but silly as such a simple thing got them working.
    Thank you guys and I know where to come again if I need any further assistance.
    Again thank you everyone  

  • How do I get the Play, Stop, Volume controls to appear in my embedded Flash object?

    Hello,
    I want to show .swf or .flv videos on my website--like
    youtube.com. I want to use the standard Flash Player object
    embedded in a web page, however, I cannot seem to find the exact
    params that make the standard controls appear (ie, Play, Stop,
    Pause, Volume, etc). I just want to show a video and have the Play,
    Stop, Pause, Volume controls visible at the bottom. What do I need
    to do to get these controls to appear?
    Here's my current code:
    <object
    classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
    width="800" height="600">
    <param name="movie" value="
    http://www.sitename.com/flash/dt_flash.swf">
    <param name="quality" value="high">
    <embed src="
    http://www.sitename.com/flash/dt_flash.swf"
    quality="high" pluginspage="
    http://www.macromedia.com/go/getflashplayer"
    type="application/x-shockwave-flash" width="800"
    height="600"></embed>
    </object>
    Any help would be greatly appreciated! :)
    Jason

    Sorry!  It's AS3. A typo on my part but, thanks for answering the post.   This is the correct answer that worked for me. Also,  the answer came from Kglad in the AS3 forum
    Assign your component an instance name (if it doesn't already have one), eg flv and in the frame that contains that component add:
    flv.addEventListener(Event.REMOVED_FROM_STAGE,removedF);
    function removedF(e:Event):void{
    flv.stop();

  • Too much time in stop method - IE locks up

    I have a problem where IE & Java Console are occasionally locking up when going from one page with an applet to another. I managed to narrow it down to a specific test case:
    The basics are:
    On a button press: Applet 1 calls getAppletContext().showDocument(url, newpage)
    then getAppletContext().showDocument(closeurl, "_self")
    closeurl is a html page that calls top.close in it's ONLOAD.
    url goes to a page with the Applet 2.
    next:
    On a button press: Applet 2 calls getAppletContext().showDocument(url2, newpage)
    then getAppletContext().showDocument(closeurl, "_self")
    closeurl is a html page that calls top.close in it's ONLOAD.
    url2 goes to a page with the Applet 1.
    So basically I have 2 applets that on a button press launch another window with a different applet and close their own window.
    Normally this is fine, and I can happily click away launching one applet right after the other.
    However, if I add a loop in the stop() method, for example:
    int j=0;
    for *int i=0; i<100000; i++)
    j+=i;
    Just to slow down the stop(), then after a few clicks/applet loads, the new applet will come up partially, then lock up. The java console is also locked up, and I have to kill the IE process to recover.
    Now in my code where I started having this problem, what I'm doing is notifying a server process that I'm dying from the stop method. It works fine most of the time, but every once in a while I get the lockup. I wrote the other test case as I was trying to narrow down the cause. I'm currently looking at minimizing the code in the stop() method (not that there was that much in the first place), but does anyone have any suggestions or possible reasons that this might occur?
    Any help would be greatly appreciated.
    Thanks,
    Keith Ambrose

    Update:
    It appears that the lockup can still occur, even if I don't have anything in the stop method.
    I seems more likely if I have the for loop in place, but since it's random it's hard to tell.
    Ideas anyone?

  • NetStream.Play.Stop : Problem:

    Hi,
    I have develop video streaming application with  Flash Media server 3.5 + and Use Dynamic stream feature , this player work correct in all way but issue with NetStream.Play.Stop() command set while playing video without EOF
    i.e video file .f4v format has 30 sec lenght ,
    -player face NetStream.play.stop() command @ 2.30 without indicate any stop command ,its automatically halt but last 0.30 is remaning.
    Any idea regarding this dobet please help me ..
    Thanks ,
    a

    Question 1: When I put the .FLV files to play in the
    "\streams\_definst_" of
    the application directory of the Flash Media Server
    installation, does that
    automatically turn it into streaming FLV and no longer
    progressive FLV?
    The distinction between progressive and streaming is the
    NetConnection.connect
    Question 2: What's the best way to detect or to signal my app
    that the
    streaming FLV has completed playing?
    Not sure what the best way is. But I subclass the NetStream
    class similarily
    to how it is presented in the Flash Communications Server
    book example 5-5.
    http://www.flash-communications.net/sourceCode/index.html
    It uses a combination of NetStream.Play.Stop and bufferLength
    == 0 as one
    signal to toggle a stopped state flag and
    NetStream.Buffer.Empty and that
    stopped flag as another signal. The stopped flag is turned
    off on the next
    NetStream.Play.Start.
    Lon Hosford
    www.lonhosford.com
    May many happy bits flow your way!
    "naz404" <[email protected]> wrote in
    message
    news:e3ffu4$a6c$[email protected]..
    Hi. I built a dynamic FLV player using XML playlists but
    using progressive
    downloads.
    I've been trying to migrate it to a Flash Media Server 2.01
    solution, but
    after I did,
    "NetStream.Play.Stop" no longer seems to be happening
    properly.
    Question 1: When I put the .FLV files to play in the
    "\streams\_definst_"
    of
    the application directory of the Flash Media Server
    installation, does that
    automatically turn it into streaming FLV and no longer
    progressive FLV?
    Question 2: What's the best way to detect or to signal my
    app that the
    streaming FLV has completed playing?
    Also, "NetStream.Play.Complete" never seems to occur, even
    if the stream
    has
    completed playing.
    Thanks!

  • NetStream.Play.Stop and Complete fired early on RTMPE streams

    Hi there
    I am experiencing an issue with playback on RTMPE streams. after investigation it seems that the FMS server is firing the NetStream.Play.Complete message at random points, indicating that a stream has ended. This is happening and random points during the stream,  not even close to the end.
    The order of Status messages is as follows:
    Thu Oct 20 2011 04:15:17 PM :: NetStream.Play.Start : status
    Thu Oct 20 2011 04:32:40 PM :: NetStream.Play.Stop : status
    Thu Oct 20 2011 04:32:40 PM :: NetStream.Buffer.Flush : status
    Thu Oct 20 2011 04:32:58 PM :: NetStream.Buffer.Empty : status
    Thu Oct 20 2011 04:32:58 PM :: onPlayStatus : NetStream.Play.Complete
    As you can see roughly 17mins into playback...although the stream is 1 hour 24mins long
    I have tested this numerous times, and each time it is at a different point in the stream.
    Intermittently the NetStream.Play.InsufficientBW warning is being fired prior to NetStream.Play.Stop.
    I am using a player built on OSMF 1.5.
    Just need to know why these messages would be fired and how to handle them
    Thanks
    Steve

    Hi Steve,
    Thanks for the information. Did you check with flvcheck tool to see if the file is a valid FMS file ? If not, can you do that please ?

  • APPLET'S STOP METHOD - PROBLEM!!

    I'm learning java on my own, and I have a problem. Could you help me.
    The stop()** method in my applet does not show on the appletviewer until I close the appletviewer.
    I open another program like notepad, but when I come back to the appletviewer it doesen't show!
    It only shows right before I close it.
    Why is that?
    Thanks
    stop() {
    showStatus("STOPPED");

    Dear JustAnotherProgramer,
    pillaged from the docs
    stop
    public void stop()
    Called by the browser or applet viewer to inform this applet that it should stop its execution. It is called when the Web page that contains this applet has been replaced by another page, and also just before the applet is to be destroyed.
    It seems that if you run it in a browser and you go to the other page(same browser) it will be called.
    I guess by changing focus between different application(notepad) it will not work.
    Thank
    Joey

  • Is there any way for play/stop to NOT apply to the metronome? [mainstage 2]

    I have EXS24 samplers triggered by drum pads, but like to be able to set one pad to [Play/Stop] so I can stop the samples on the fly. (in case I make a mistake or something) Problem is, I want to send the metronome to my drummer (via a different output on my interface) but I DON'T want [Play/Stop] to stop the click. Is there any way to get better control of the metronome? Does anyone with mainstage 3 know if this is an option? Can I re-wire it with logic 9 and run a click out of logic? Can't seem to get mainstage and logic to work together... Just need my click to run independently.

    What you may try is to replicate your base map but take the point theme out of its definition. Then create a second tile layer for the new base map. You can add both tile layers to the client (but set only one of them to be visible). Then simply switch the tile layers' visibility on/off based on user turning on/off the point theme. The built-in Oracle Maps tutorial #22 (Multiple Base maps) has some sample code you might be able to re-use.
    thanks
    LJ

  • Simply loop a video with a play/stop button in the middle?

    Hello, I am new to flash but I have CS4, so I have all the tools.
    I have a .mov file and I want to simply encode the video (i assume with flash media encoder) to be a flash file which loops continuiously with a Play/stop button. I'll then have this movie playing on my html page...
    How would i best achieve this? I cannot figure it out using the encoder!

    Easiest way is to import the mov directly into Flash, follow the importing prompt, embed inside of a movie clip to loop. add your buttons on top and code to stop(), and play().

  • My audio stops outputting after a few songs in a playlist - itunes says its still playing, stopping and starting track recommences audio output.  Mac book Pro Lion 16gb ram

    My audio stops outputting after a few songs in a playlist - itunes says its still playing, stopping and starting track recommences audio output.  Mac book Pro Lion 16gb ram.  Can be any song, any time, same song will play if I select it again.  Bit of a bummer itunes is the main thing I use (macbook pro jukebox).

    Most likely culprit is your Lacie drives which are notorious for flaky power supplies which cause just the sort of erratic behaviour that you describe. Have had similar issues myself. Lacie has been good about replacing my power converter-- twice. If you have seven of them, good luck finding the bad one or more. Like I said, the behaviour is erratic. Sometimes it'll work sometimes not. I can't comment on Samsung drives because I've never used them and have never heard anything about them. Same with Softraid. Why not just use Disk Utility. Sounds like you're ready for an external hardware raid. This will be much faster, much more reliable, and may even be cheaper than seven firewire drives. Check out G Tech, and Maxx Digital for starters.
    Best of luck
    Terry

  • NetStream with OSMF is firing NetStream.Play.Stopped too early.

    Hi,
    I've been digging into a bug report where the ends of adverts are clipped by up to three seconds in Android and, after a _lot_ of painful debugging, I have come to the conclusion that the issue is with the underlying NetStream object.
    After a bit of jiggery pokery to locate the NetStream on NetStreamLoadTrait, I was able to listen to the changes to NetStream.time and to compare against the TimeTrait values, also to see what events were happening where and when. After placing this code on an Event.ENTER_FRAME handler, I was able to see clearly that there is _ALMOST_ALWAYS_ a huge jump in the last two frames... This equates to clipping off the last few seconds of the video as the jump tends to occur a couple of seconds prior to the end. Having placed break-points in OSMF code, it appears that the end is "correct" in that it is always in response to a NetStream.Play.Stopped... just that the NetStream.Play.Stopped is firing at the wrong time.
    Does anyone have _any_ idea what could be causing this? Is it likely to be with the media being supplied (third-party advertsing video...) or the plugin itself?
    Thanks,
    G

    I have created a bug report here: https://bugbase.adobe.com/index.cfm?event=bug&id=3504086
    Please take a look, use my supplied test script, and vote for the issue if you can reproduce it.
    G

  • Applets stop() method is not executed

    Hi,
    I

    ups, once again...
    i'm writing on an applet for database administration and i want to save all the changes when the user closes the browser. i know already that the stop() method is called in this cases. that's why i made this changes in that method. but i was very astonished that sometimes the changes were saved and sometimes not. so i found out that the stop() method is canceled in the middle of execution. i'm using the newest java plugin and ie 5.5. maybe i also have to mention that everything works fine if i run the applet with the appletviewer from jbuilder. does someone know how to control the stop() method or are there any limitations regarding in execution time or whatever?
    thanks in advance!

  • How to stop a thread without the deprecated Thread.stop() method?

    Hi,
    I am writting a server application that launches threads, but the run() implementation of these threads are not written by me (i.e. i have no control over them): they are third-party programs. That's why i could not use the well known Java tutorial way to stop a thread (i.e. with a global variable that indicates the thread state).
    I would like my server to be able to stop these threads at any time, but without using the deprecated Thread.stop() method.
    Any ideas ?
    Thanks in advance,
    Fabien

    Thanks Pandava!
    I was arrived at the same conclusion... As to me, it is a very bad issue, because it means for example that a servlet server can not stop any servlet it launches (especially for preventing infinite loops).
    If i want to be strictly JDK 1.4 compliant, i should not use Thread.stop(). But if i don't use it, i don't have any ideas of how stop a thread that i don't control...

  • Youtube spacebar play/stop function

    Ive noticed that you can use the spacebar and the left/right arrows to control the playback on youtube.com
    But this only works when i have taken my mouse to click the actual youtube video box or play button... Otherwise the spacebar will scroll down the screen.. Is there any way to toggle selection so that you can select the youtube video to be your main focus!? I am hoping something like tab key or option+tab.                    

    Hmmm...
    When the movie window has focus (two clicks on the window, or, by clicking on the movie's play/pause button), the spacebar then works in the same way as a QT Player window --- play, pause. But it's not like the spacebar gives you exclusive control over the transport of the movie as it does in a QT Player window, because if cycle is on, Logic will jump back to the left locator when Logic hits the right locator point. This mixing of behaviors (1/2 QT, 1/2 Logic) is terrible. I'm not sure that there's any benefit to it.
    So, OK, (sigh) when the movie float window has focus, the operation of the spacebar changes. However, other key commands retain their pre-programmed behavior and relate to objects previously selected in non-focused windows! For example, if I have an audio file highlighted in the arrange window while the movie window has focus, I can use key commands to split at playhead, mute, open the sample editor, etc. Somehow that region object retains focus even though its containing window doesn't. Meanwhile, the most basic transport function --- play/stop --- retains focus with the movie window, and changes its behavior with respect to the rest of the program.
    Makes no sense.
    Message was edited by: iSchwartz

Maybe you are looking for