Problem with Play Pause AS3 button on the main timeline

I was wondering if someone can help with this? Have tried to create a play/pause for the main timeline button in my flash movie.

Created a clip with 1 frame - a chart of the break, and then on the 2nd frame - game graphics, labeled 'pause' and executives 'play' consecutively and put a stop action on the first frame of the movieclip.

Then put the following code in the layer actions on the main timeline (and gave the name of "ppBtn" instance of movieclip):

var pp:Boolean = true;


function ppState(event:MouseEvent) {}

{if (pp)}

Stop();

event.target.gotoAndStop ('pause');

pp = false;

} else {}

Play();

event.target.gotoAndStop ('play');

pp = true;

}

}

ppBtn.addEventListener (MouseEvent.CLICK, ppState);

He works at the stopping and starting of the film but the real movieclip is not switch between the break and the game graphics (a few stays on the framework - 1st of 'pause' State). Any help in this very appreciated!

Thank you

What answer was helpful (correct)?  Could mark you?

Tags: Adobe Animate

Similar Questions

  • Targeting of evil to a button on the main timeline for a VideoEventComplete at work

    I have a .fla file that has buttons on the main timeline that target frames in a mc named 'pages' in a table.  The 'pages' are implemented in the form of frames each five images or as a slide show where the buttons advance or return to the previous page.  I want to make invisible buttons until frame 30 video is complete (page 4).  When I insert the code below in the main timeline, the button becomes invisible, but there is no event that will finish to come back only to show the button so it sits right there with no way to advance as the buton is invisible,

    Then... How to target the button to only be invisible when it has an event video complete but not not start before 30 (page 4) image of the mc and then do it again in the 35 framework etc.

    I tried to put it in the main timeline and on the frame of the first video.  If I'm on it within the pages don't need to point the code on the main timeline to get code know where are the buttons? Something like main_timeline.nextbtn etc... ?

    The code in the settings:

    Stop()

    Import fl.video.VideoEvent;

    THIS BUTTON IS LOCATED IN THE MAINTIMELINE\\
    nextBtn.visible = false;
    addEventListener (VideoEvent.COMPLETE, doNextFrame);

    function doNextFrame(e:VideoEvent):void {}
    nextBtn.visible = true;

    pages.nextFrame)
    }

    All the code is:

    THE CODE of the MAIN SCENARIO is:

    Listeners of button

    import of flash.media.SoundMixer;// it comes to the


    nextBtn.addEventListener (MouseEvent.CLICK, nextSection);
    prevBtn.addEventListener (MouseEvent.CLICK, prevSection);

    ///////////////////////////////////////////////////////////////////////////

    function nextSection(event:MouseEvent):void {}

    var thisLabel:String = pages.currentLabel; Gets the current image under chain tag
    var thisLabelNum:String = thisLabel.replace ("sct", ""); cut the main letters off the number
    var curNumber:Number = Number (thisLabelNum); Converts this string to a real number number
    If (curNumber < 18)

    {

    var nextNum:Number = curNumber + 1;
    pages.gotoAndStop ("sct" + nextNum);

    }

    SoundMixer.stopAll (); Place it inside your functions

    }
    ///////////////////////////////////////////////////////////////////////////
    function prevSection(event:MouseEvent):void {}

    var thisLabel:String = pages.currentLabel; Gets the current image under chain tag
    var thisLabelNum:String = thisLabel.replace ("sct", ""); cut the main letters off the number
    var curNumber:Number = Number (thisLabelNum); Converts this string to a real number number
    var prevNum:Number = curNumber - 1; subtract 1 from the number, so we can go to the next image tag
    pages.gotoAndStop ("sct" + prevNum); This allows us to go to the previous image tag

    SoundMixer.stopAll (); Place it inside your functions


    }

    Please Note: it started in a previous discussion, but I think that I was confused that the question so go fresh here, thank you so much for the time on this

    I can't say I'm immune to be confused by the story you tell, but I'll take a stab to offer what could be a solution.  If the buttons are in the main scenario and the code that you want to make visible with in a movieclip which lives on the main timeline, then you can target the buttons from inside and using movie...

    MovieClip (parent).nextBtn.visible = true;

    MovieClip (parent).prevBtn.visible = true;

  • AS3 go to the main timeline

    I have a movieclip in a movieclip with a button, when you click on it it should go to the main timeline I did with AS2, the script is below. How can I do this in AS3.

    on (release) {}
    _root.gotoAndStop (785);
    }

    Thanks in advance

    removeChild() to remove objects from the display list.  If your object won't be necessary again, he should ready for the gc.

    There is no way out (until the Flash Player 10.1).  You "got to do your own.

    p.s. Please mark this thread as answered and new questions, start new discussions.

  • Button on the main timeline control movieclip

    Hello

    I have a stop in my main script. At the stop, I have a play of movieclip. In the movieclip, I'll have a video playback. After playing the video, I have a button for the user to continue playing until the end of the movieclip. Once the movieclip is done, I want back the return to a specific image in my main script.

    I can't figure out how to make this work. Anyone have any ideas?

    Thanks in advance,

    Paul

    How much of what you just described in currently working properly?

    If it's just the last step to have the game finished main scenario the movieclip, then you might have an event listener assigned to this movieclip in the main timeline.  When the movieclip ends it can send an event of this listener that can trigger an event handler function in the main timeline to tell the main scenario for continued as planned.

    Another less glamorous but more compact approach might be to have a drive inside / at the end of the movieclip to order the main scenario of an act using something like...

    MovieClip (parent) .gotoAndPlay (whatever);

  • ERROR: Adding an event listener to a button in the main scenario

    I'm trying to get a simple script to work temporarily to show features. This file is a menu.swf file that loads below content.swf.

    There are 4 buttons on the main timeline and a stop at frame 40. On the same layer that my button is and frame 40, I have this code under actions. dineContent is the instance name of the button that I am referencing.

    However, I get access error 1120 property undefined.

    I know that I can add an event listener to an instance name. I have to create a film about all these buttons and then reference the instances of button inside the movie?

    I started playing with a bit more and found the solution.

    SOLUTION:
    in the property inspector to my instance of dineBtn named "dineContent", there is a contextual list under the "instance of: _" txt where you can choose between the track as button or Menu item.

    You must use the track as Menu item. the default value is button.

  • stop the main timeline in AS3

    I searched the forum and maybe to find relevant solutions, but I still don't understand. How to make simple "stop()", "play()" and check "currentFrame" on the main timeline of an AS3 class file?

    I have an animation of script for Flash AS2 older I'm conversion in AS3 and also import an AS3 swf into.

    Everything works fine, except that I had to remove the "stop()" on the main timeline (if the animation does not loop) and trying to do it from the main .as file in the document.

    I get an error when you try to access the "currentFrame" of the scene.

    HOW CAN I PUT A 'STOP' ON THE MAIN SCENARIO?

    - - - -

    If the banner is your document class, this means that your main timeline must have only 1 frame (because the banner extends Sprite) and this means that it is foolish to check currentFrame and it has no sense to goto any image.

    do you know what you do picking the Sprite class or do you really want banner to extend the MovieClip class?

  • return to the main timeline of the movie clip

    well on my main script, I have an intro, and then a main menu. in this menu, it goes to a clip, I want to create a "back to main menu" button inside the movieclip that will return a certain group in the main timeline.

    can someone help me in this encoding to use?

    see you soon

    What about the fact that you have a problem with?  Do you know how to code a button? If Yes, you can program the button in the main timeline so that all you have to do a gotoAndStop() command is used...  In the main scenario where there is the mc...

    yourMC.theMCButton.addEventListener (MouseEvent.CLICK, gotoMenu);

    function gotoMenu(evt:MouseEvent):void {}

    gotoAndStop (menuframe);

    }

  • Control loaded swf on the main timeline

    Hello

    I'm working on loading external swf files for ios. I am able to load swf files and assembled visible or invisible in different settings. I have trouble controlling the swf files loaded on the main timeline. Specifically, I would like to have a button on the main timeline, that when you click on will move a swf loaded to frame 1.

    Here is a code that loads a swf file:

    var myLoader1:Loader;

    var loaderContext1:LoaderContext = new LoaderContext (false null, ApplicationDomain.currentDomain),

    if(myLoader1 == null)

    {

    myLoader1 = new Loader();

    addChild (myLoader1);

    }

    myLoader1.load (new URLRequest("folder/file1.swf"), loaderContext1);

    myLoader1.visible = true;

    backbutton.addEventListener (MouseEvent.MOUSE_DOWN, backbutton1);

    function backbutton1(myEvent:MouseEvent):void {? myLoader1.gotoAndStop (1) ;}}  (this line does not work)

    (Once I load file1.swf, in the file1.swf I click a next button to move on to different periods.) My question is: hHow do I code the "backbutton" on the main timeline so that it causes the file1.swf to go to frame 1?)

    Thank you for your help.

    After loading is complete (and assuming that you load an as3 swf), you can use:

    MovieClip (myLoader1.content) .gotoAndStop (1);

  • Control edge file animate OAM with the buttons play/pause of Captivate on the skin.

    Hello world

    I worked on a project where I mix a variety of objects and animations.  I do animations animate on board.  The problem I have is that when the user clicks the button pause on the Captivate playback controls, the oam file do not pause.  I found descriptions of how I can make an animation to play/pause the Captivate timeline button on board, but I can't find anything on the use of the Captivate pause button to control the Edge file animate.  Discussions only that I managed to find on that seem to be the answer.  Someone had a bit of luck with this question?

    Any advice would be appreciated.

    Thank you

    Randy

    OK, it's a bit hacky, but it works quite to control the main timeline object in a file of edge of Cape Town, where the Edge file has been imported to Cap 9 as a Web (oam) object. I went seeking answers same like you and came from vacuum, then start to tinker myself and came across the following method.

    Let's use window.postMessage to send a string between Cape document window and document edge iframe window then react accordingly. You can learn more about postMessage accepted battery answer here: http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy

    In your dashboard file click the support of Actions for the stage object in the timeline and select the compositionReady event. Paste this code into the text window:

    addEventListener for Chrome, attachEvent for IE

    window.addEventListener ('message', receivedFromCaptivate, false);

    window.attachEvent ('onmessage', receivedFromCaptivate);

    function receivedFromCaptivate (event) {}

    switch (event.data) {}

    case "play":

    SYM. Play();

    break;

    case "pause":

    SYM. Stop();

    break;

    }

    }

    Save the file and publish it as an oam, then import the OLS in a slide of Cap, as you normally would. Now, to put in place things of the CAP. Here is a visual aid for the rest of the explanation...

    In the PAC file select the control that you use to start playing the chronology of the edge (in the example above the "slide4Play"), select the checkbox 'Use as button' in the properties on the right, select the "Actions" tab, then to the drop-down list for 'Success' choose "Execute advanced Actions." Click the folder next to the selection of Script control and advanced Actions dialog box should appear. Name your action something (for example, "playEdgeSlide4"), then click the 'Add' in the grey bar to add a new action in the queue. In the drop down "Select Action"... ", choose"execute Javascript. "In the drop down menu"select the window... ". ", choose"current ". Then click on the 'Script_Window' button to bring up a window of text Javascript crap. In this window, you can paste this:

    try {}

    $("iframe") [0].contentWindow.postMessage ("play", "*");

    } catch (e) {}

    Console.log (e.message);

    }

    Select 'OK' to close the window of text Javascript crap, then click the 'Update Action' button to save your new action. Now let's do the same for break action - select the control that you use to pause, go through the steps above, the name of the action, implement advanced action in the same way and in the Javascript crap text window, paste the following text:

    try {}

    $("iframe") [0].contentWindow.postMessage ("break", "*");

    } catch (e) {}

    Console.log (e.message);

    }

    Cap incorporates the Edge file in an iframe on the page that has its own document window. In order to communicate between base ceiling windows and the iframe, we use the postMessage call. So when you hit your button Pause/Play in Cape Town, he publishes an event to the function that gets recorded in the iframe on board. And in the event.data is the string we send above the Cap base window in the function postMessage ('play' or 'pause'). We use a simple switch to react to the data string, stop or have fun with the main symbol of the scene at the edge (sym.play(1000) (), sym.stop ()).

    I hope this helps!

  • Problem with playing a loaded "SWF" file in the chronology of the pain

    Hey there. I created a presentation that loads the SWF interactive movies in a clip of 'target' on the main timeline.
    As you progress through the different presentation SWF movies are loaded into the presentation. And this in turn allows me to change the content of the presentations quickly and easily for different customers.
    These sovereign funds use part of the preloaded flash content like the other and drop-down list box objects.
    However, when these sovereign funds are called in the main charge they stop working properly.
    They work fine when tested independently of the main charge.

    Does anyone know how I can be able to get these sovereign funds work properly?

    At soon fofana

    The first thing to do is to check the range of your loaded SWF file. All references to _root, for example, means something different when the SWF is loaded in your film of wrapper.

    In addition, some of the V2 components do not work correctly when the SWF is loaded into another SWF. There is a technical Note and simple workaround here:

    http://www.Adobe.com/go/tn_19278

    Good luck!

  • I can't see the pictures in my yahoo email, I did not have this problem with other browsers. I used the safe mode and still no success. Help, please.

    Question
    I can't see the pictures in my yahoo email, I did not have this problem with other browsers. I used the mode 5 firefox safe and always without success. Help, please

    To help other users find solutions, please come back to this Thread and connect you to the
    Forum with your user name and password:

    Click on 'resolved' beside the answer above that BETTER resolved your issue

    DO NOT CLICK on 'Solved It' next to this answer

  • I don't know why I had problems with FF 3.6.16 and the last update for thunderbird

    I'm at the Canada and for some reason, downloads for the two FF 3.6.12 and Thunderbird was last updated was the BritishVersions is why I UK search engines, not the US versions is maybe why I'm struggling with my email and addons. The other 2 computers in my house is the American version.

    But there is always something a bit screwey with 3.6.12 that some addons do not work correctly on other computers. Can you please change the software for the US version please? Thank you

    I deleted the software twice already. before realizing I was downloading the British version... same problem with my Thunderbird cannot connect to the Internet service provider even if everything is done correctly! Help!

    You can find the version en here:

  • I have printer color laserjet 5550N having problem with error 59.C0. What is the cause of the error?

    I have printer color laserjet 5550N having problem with error 59.C0. What is the cause of the error?

    Thanks Ray,

    Hello... How can I get the manual download for all the error on any printer laser color spray top of HP range.

    Kind regards

    Monday Nwankwo

  • After 3 years of use of this helmet and having no problems with it, now I can hear the sound in the right ear

    Hello, after 3 years of use of this helmet and having no problems with it, now I can hear the sound in the right ear... what should I do? Help, I don't want to say 'goodbye' to it already... Thank you

    It could be the plug on the computer that is the cause of the problem. Try another helmet or a pair of speakers in it.

    If you hear only on one side, who will tell you that is the question.

    If you hear from both sides, you must obtain a new helmet

    Software will fix either of the foregoing...

  • Problem with anchor points, shifts vertically in the browser view. What is the problem?

    Problem with anchor points, shifts vertically in the browser view. What is the problem?

    have you allowed for the height of your head? I had to put my anchor above my content by the height of the header, otherwise, the upper part of my content was hidden behind the header

Maybe you are looking for