Button in a movie clip that will command the scene?

Salvation;

Type of document html5 Canvas.

What could be the code for a button (bt1_btn as instance name) which is in a clip (anim_mc as instance name), when the event on the button's "click" and that the statement is: take the play (a scene that already stopped)?

Cause when I got the script code in the level of the scene that it works fine:

This.Stop ();

This.anim_mc.bt1_btn.addEventListener ("click", letsGo.bind (this));

function letsGo() {}

This.Play ();

}

But what I want is to write the code in the anim_mc clip:

This.bt1_btn.addEventListener ("click", letsGo.bind (this));

function letsGo() {}

//what is the correct script here? > > > Stage.Play ();

}

THX

You don't play the scene. The scene is just a container for the whole object. What you want is to play the root (or hand) timeline.

To play the root timeline (or any scenario really) anywhere, without having to worry about the use of references, parent.parent.parent etc, store a global reference to the timeilne. On the first image of the timeline root, put something like:

thisIsTheRootTimeline = this;

Then in the event handler, follow these steps:

thisIsTheRootTimeline.play ();

Tags: Adobe Animate

Similar Questions

  • Coding of a button in a movie clip problems to navigate the scenes

    Hello! I have an another probably noobish question to ask on the CS6.

    My goal is very similar to the mentioned in this forum question described above: http://forums.Adobe.com/message/837995#837995 and also in this issue http://forums.Adobe.com/message/4172919#4172919

    I'm trying to make a button inside a clip in my first scene when you click in the first frame of my second scene. I appointed menu_button_1 instance of the button, and I think that the stage 1 and stage 2 are the names of the scenes. (If they should have special names or instance names, I do not see where type them.) Because of the similarities, I tried to follow the suggestions on these pages. However, I did probably some small thing wrong, (or heck, maybe one thing huge.) that I what I would like to help find.

    Stop();
    myButton.addEventListener (MouseEvent.CLICK, clickHandler);
    function clickHandler(evt:MouseEvent):void {}
    Stop (1, "scene 1");
    }

    This seems to be what has been proposed to enter. I tried to change it works as well for me. That's what I typed to the button action.

    menu_button_1.addEventListener (MouseEvent.CLICK, clickHandler);

    function clickHandler(evt:MouseEvent):void {}

    gotoAndPlay (1, "scene 2");

    }

    (I removed the stop function because I have music on a loop in the clip I want to play until the mouse is clicked). (Also, I took gotoandplay because I wanted to stage 2 to start playing immediately when clicked, rather than to stop.)

    I tried variations, including the "2" instead of "scene 2" and whatnot. I also tried connecting to differnet places just to see if that would work. It seems that she would be able to join if I only asked a frame in the clip of the film itself, but he couldn't go to all other executives in stage 1 or stage 2. When I try this message appears in the output:

    ArgumentError: Error #2108: stage 2 was not found.

    at flash.display::MovieClip/gotoAndPlay()

    at interactivestgermant_fla::menu_1/clickHandler()

    It seems that not finding my scene 2. (She also can't find scene 1 when I invite you to do so.) I'm afraid that I'm not sure of what I entered incorrectly, although I imagine that this is how I typed the navigation of the scene. Should have an instance name or something? I was very muchappreciate a little nudge in the right direction. If you need more info, I'll be happy to provide. Thanks for the help! I appreciate that very much.

    The first image you provided shows that you have assigned an image tag, not an instance name.  You must select the menu object on the stage and then you should see a section of the properties panel at the top which has a field with "", said inside (assuming it's a movieclip symbol).  This is where you enter the word 'menu'... which is by assigning a name to the instance of the menu you have on the stage.

    The way you seem to have a number of keyframes that precedes in the timeline may mean you need to do this in each keyframe where there is this menu item.  IF you do not, then it can inherit the lack of a name of a previous frame.

  • Trying to create a button inside a clip that will return to scene 1

    I am trying to create a button inside a clip that will go back to scene 1.

    Here is my code

    Stop();

    sback1_btn.addEventListener (MouseEvent.Click, Film1);

    function film1(event:MouseEvent):void {}

    gotoAndStop ("shorts");

    }

    I get access of undefined property error.

    Can anyone help?

    Thank you.

    Try

    sback1_btn.addEventListener (MouseEvent.Click, Film1);

    function film1(event:MouseEvent):void {}

    MovieClip (root) .gotoAndStop ("shorts");

    }

    or

    MovieClip (root). VideoMask.sback1_btn.addEventListener (MouseEvent.CLICK, film1);

    function film1(event:MouseEvent):void {}

    MovieClip (root) .gotoAndStop ("shorts");

    }

    The problem is the path

  • How to use a button in a movie clip to go to the root?

    Hi, I am new to flash and AS3 and need help to get my buttons.

    I made a script to the file I'm working with who has 2 movieclips to buttons. I want this button and load the image in a UILoader (problemLoader_mc) that I placed on the stage on the main timeline (chronology which contains WeekBar_mc). The problem is that I don't know how to get to the root of the file to start a new directory to tell my function to load the image I want. I tried several approaches, including:

    MovieClip (root).problemLoader_mc.source = problemArray [0]
    MovieClip (parent).problemLoader_mc.source = problemArray [0]
    root.problemLoader_mc.source = problemArray [0]
    parent.problemLoader_mc.source = problemArray [0]
    (root as MovieClip).problemLoader_mc.source = problemArray [0]


    If anyone can help me with this, I would be very happy, I'm banging my head against a wall for the moment. (Also, please excuse my vague descriptions, I'm still learning the official terminology).

    Here is the code that I wrote which relates to this problem:

    I have a mental block for the reasoning of the things regarding the allocation of the listener to an object two mc far the main timeline while having the function on the main timeline, so I can play with it my own for awhile. One thing you don't have but had to pay the same attention to the assignment of problemArray [0] in that function, I assume also lives in the root.

    But here's what I would do at the moment.

    Take all the code except the table and plant it in the scenario where the lives of WEEK1btn, modify as follows...

    WEEK1_btn.addEventListener (MouseEvent.CLICK, pload1);

    function pload1(event:Event)
    {
    . ProblemLoader_mc.source (this.parent.parent) of MovieClip = MovieClip (this.parent.parent) .problemArray [0];
    }

    I've not used root myself yet, so I'm not comfortable giving you a solution it is trying.

  • Error #1009 when sound inside game, a movie clip that is called to the scene with child add method

    What is supposed to happen

    I have a clip that is called when the user clicks a button. When moving clip appears music is expected to play. When the user clicks the close button the music stops and the clip is removed from the scene.

    But then I get an error

    When I test the movie I get the following error:

    TypeError: Error #1009: cannot access a property or method of a null object reference.

    to mc_playSong / frame2 () [mc_playSong::frame2:6]

    This is the code that calls the clip on the stage (no problem here):

    Call the video clip with the song played on stage

    stage.addEventListener (MouseEvent.MOUSE_DOWN, goButtons);

    function goButtons(event:MouseEvent):void

    {

    If (event.target is song_bnt)

    {

    SoundMixer.stopAll ();

    addChild (myPlaySong);

    myPlaySong.x = 558;

    myPlaySong.y = 384;

    Event.stopImmediatePropagation;

    }

    The following code inside the clip is called to the scene. The music is meant to play:

    Stop();

    Variables for listening to music

    var RJPlaySong:RJSong = new RJSong();

    var RJPlaySongChannel:SoundChannel;

    Music for plays

    stage.addEventListener (Event.ENTER_FRAME, startRJSong); (I think that the error in the code is in this function. When I comment on him I don't get error.)

    function startRJSong(event:Event):void

    {

    RJPlaySongChannel = RJPlaySong.play ();

    }

    Stop all sounds, sets variables to null and calls a send event that removes the clip of the scene.

    bnt_closeSong.addEventListener (MouseEvent.MOUSE_DOWN, closeCreditSongScreen);

    function closeCreditSongScreen(event:MouseEvent):void

    {

    SoundMixer.stopAll ();

    RJPlaySong = null;

    RJPlaySongChannel = null;

    dispatchEvent (new Event ("RemoveMCsong"));

    }

    Someone at - it ideas? This seems to be a pretty simple question, but I can't understand it.

    I meant that you have quoted just to be taken literally.  If it's still not clear what I say or what did your code, try the following in order to demonstrate the IT change... This code to be...

    stage.addEventListener (Event.ENTER_FRAME, startRJSong);

    function startRJSong(event:Event):void {}

    trace ("I can do this all day");

    }

    After doing this, you can see why you want to only call the function once, and you could eliminate most of it and just put...

    RJPlaySongChannel = RJPlaySong.play ();

    Instead, or as I said originally, you can change it to be...

    function startRJSong (): void

    {

    RJPlaySongChannel = RJPlaySong.play ();

    }

    startRJSong();

  • I can't move clip source window to the timeline by grabing it with the mouse.

    I can't move clip source window to the timeline by grabing it with the mouse. I can cut it short it. Once that there I can't move at all

    If first is weird, restart your computer, open the first while pressing SHIFT + alt up to the Welcome screen.

    See if this will help.

  • How to place the link on the page that will reveal the TOC apps?

    I am trying to create a button link on every page of my application that will reveal the TOC apps. I was hoping I'd be able to use: goto://ApplicationViewState/TOC or similar, because I know that I can use 'goto' commands to link to the library etc.

    I am aware that type the page lowers the navigation bar and the table of contents is here, but my client wants something more direct.

    We don't have a way to trigger the table of contents of a hyperlink.

    Neil

  • Using CS4 Flach and action script 2.0 how to move a specific frame in the main timeline when a movie clip instance come at the end of his chronology?

    Using CS4 Flach and action script 2.0 how to move a specific frame in the main timeline when a movie clip instance come at the end of his chronology?

    code on the last frame of your movieclip instance:

    _root.gotoAndStop ('whatever_frame');  will work unless this swf is loaded into another swf.  in this case, you must use a relative path to the main timeline (for example, _parent or _parent._parent etc.).

  • Looking for Advanced Action script that will close the project

    Hi all

    It seems so simple but I can't seem to understand. Does anyone know of scripts that will cause the project to close when the user clicks a button? I have a project built in 6 Captivate that is set to close its 'End of the project' preferences and has multiple options of branches. I want to have a button to END that will close the entire project. The best that I got is simply apply an action of 'CONTINUE' on the last slide, but since this slide also includes a button that jumps to another branch, the blade simply crashes when you click the END button.

    Any thoughts?

    Krista

    You can use a 'Execute JavaScript' action with the script below:

    window.close();
    

    OR

    window.top.close();
    

    What script you use depends on how your LMS launches your course.  If it is in the main window, use Window.Close ().  If it is in a window child, then window.top.close ().  If you are not sure, then a little experience by downloading a course of a slide with two buttons.  The first button must execute Window.Close (); and the 2nd button must execute window.top.close ();.  When your LMS is launching the course, try the buttons and see one that works.

    F12 (Web Preview) will not give you a solid test since your LMS can launch your course differently... it's the kind of thing that should be tested in your LMS to be sure it works.

    Jim Leichliter

  • Does anyone know of a VI or how to write one that will stop the computers time be disabled if an application is run.

    Does anyone know of a VI or how to write one that will stop the computers clock be turned off if an application is run. The time and date can be reset normally while an application is running by clicking on the time in the lower right of the screen of the computer. I have an application that runs over several days and it is essential that the time and date of the computer not be changed. Is there an easy way of this lockout the user? Note that I am what I consider a beginner advanced in LV

    Thank you

    Chuck

    This isn't something that you can from LabVIEW, because this is an operating system operation, and it will depend on the operating system you are using. Under Windows, you can use Group Policy to control this. Please Google on "prevent changing the date and time of windows."

    Also, please try to refrain from stuffing your message in its entirety in the block of material. Keep short, but descriptive enough topic so we can understand what you're asking basically. Thank you.

  • Y at - it an upgrade of Windows Compression that will allow the opening of a file Winzip 15?

    Original title: compatibility of winzip 15.

    Y at - it an upgrade of Windows Compression that will allow the opening of a file Winzip 15?

    Hello

    WinZip 15's a compressor of owner, so it would be exclusive to them.

    I recommend you contact WinZip support for assistance.

    http://www.WinZip.com/xsupport.htm

    Hope the helps of information.

  • Anyone wishing to share SQL that will pull the text of the business unit that is attached to a language specification?

    Anyone wishing to share SQL that will pull the text of the business unit that is attached to a language specification?

    Select s.SpecNum, s.IssueNum, SpecSummary n.name s

    inner join gsmApprovedUsage on s.SpecID = au.fkSpecID and au.fkSpecID as 5816% AU '

    gsmApprovedUsageBUJoin j j.fkApprovedUsage = au.pkid inner join

    inner join commonBusinessUnitName on n.fkSpecBusinessUnit = j.fkBusinessUnit and n.langID = 0 n;

  • A script that will count the total number of pages into multiple PDF files in a batch file?

    Is there a script I can use ExtendScript Toolkit that will count the total number of pages into multiple PDF files in a batch file?

    In another discussion I showed a JavaScript that you can use to write the number of pages to the console in a batch sequence. You would do exactly the same thing in Action, so the action would consist of a simple JavaScript (more tools > run JavaScript) which includes the code.

  • I want to buy photoshop that will change the background on a portrait?

    I want to buy photoshop that will change the background on a portrait?

    Photoshop or Photoshop Elements will work. Lightroom can work, depending on what kind of change you want, if you just want to resolve what is there rather replace that with something else.

  • Are there specific codecs or import libraries that will make the first 6 use several types of files?

    Are there specific codecs or import libraries that will allow the first 6 import file types more?  I use 6 first on Windows 7.

    It seems that the only type of file which can be imported in this first release are certain types of AVI files... even certain types of notice will import but then will not appear when it is not placed in the timeline... no MPGs, MP4s, and WMVs, or something else will import at all.

    Virtually all the files I need to bring for first 6 must be converted into AVI with H.264 codec first.

    Any help would be useful.

    Digi

    I'm afraid not.

    Even if you were abel to import the first is not designed to handle these files.

Maybe you are looking for

  • For Qosmio f10 car adapter

    Hello just wanted to know if there is a cigarette lighter adapter or Jack etc that I can use to recharge my laptop Qosmio F10 in the car as the holiday im soon and it will run out of battery after 2 hours or so, so ask if theres something like that t

  • HP Laserjet 1020:1020 print job stuck in the queue prevents other print jobs.

    It says printer problem A print job in the print queue prevents the other print jobs I bought this printer in a second hand store.  I plugged it on so I thought because I didn't have the cd can I download HP.  I was able to pick up the pilots just by

  • Playlist Creator 3

    Does anyone use this program? I am creating a playlist for my 8 gb Fuze with no luck. Here is my method: I plug my rocket to the computer, add the files of my rocket in the software, create a playlist, save the playlist in the music from my "FLARE".

  • Impossible to AirPrint on my iPad2.

    After all of the fixes offered by HP and Apple. Still does not work. Have learned via the Talk Talk Forum community following other complaints from users that it is probably a router problem. A fix is apparently coming in February 2014.Anyone to know

  • HP ENVY 7640 all-in-one: print envelopes and its telling me to load paper into the photo tray

    I am trying to print envelopes on the HP ENVY 7640 printer and it tells me to load paper into the photo tray. Have you encountered this problem and how to solve? Thank you.