Control button inside movieclip with AS

If I got a mc with a button inside, how do write the script
to control that button from the main timeline?
My script (that doesn't work) looks like this:
mymovieclip.mybutton.onRelease = function() {
gotoAndStop(2);

Sorry, my mistake, it should go to frame 2 inside
mymovieclip.
Script should be like this:
mymovie.mybutton.onRelease = function() {
mymovie.gotoAndStop(2);

Similar Messages

  • Accessing Button inside Movieclip/ScrollPane

    Hello all,
    I'm trying to understand how to build a button inside a movieclip.  I have a template that has movieclips within movieclips, and when I create a button (all using AS2) the button will work if I test the scene, but in the whole flash movie it does not work.  I also have some buttons located inside a ScrollPane that also do not call correctly.
    For my button I am using this code:
    facebookbtn.on (release) {
    getURL("http://www.facebook.com/","_blank","GET");
    ^ This is placed on the button "facebookbtn". I also tried using: _root.bgPages.pg1.facebookbtn.on (release), to no avail.
    For the one inside a ScrollPane I am attempting to call a javascript function:
    on(release){
         import flash.external.ExternalInterface;
         ExternalInterface.call("GroupDelegate","dayone1");
    ^ This also does not work, with or without the button name before on(release).
    I'm putting the FLA file here so that if anyone has the time, could help me with this quick problem. Thanks!
    FLA: Download FLA

    Do not place code inside objects with code on(blah2x). It will lead to unpredictable behaviors and besides it is bad practice. Centralize all your code on one frame in the timeline. Use this format on the main timeline:
    import mx.utils.Delegate; //declare at top only ONCE
    YourButton.onRelease = Delegate.create(this, YourFunctionCall);
    or
    YourButton.onRelease = function()
       //do your stuff here
    Do the same thing with the ExternalInterface. You can put the import at the top along with Delegate.

  • Button inside movieclip on stage

    What do I have to do to get the button to work? I view the swf and there is no active button.
    I need the button inside the clip to be active. I can't find the answer. Thank you.

    no i put a button from the library inside the clip to see if i could access a button once movie played and i couldnt see the states of that library version if I viewed the scene I could.
    I was going to create my own button, which I will, but I don't think I will be able to get to it once publised and I'm frustrated.
    I think I have run into this before, it's been a while. Is it an enable thing?

  • Button inside MovieClip don't work...?!

    Hello,
    I\m traying to create AIR for Android app & I have 2 MovieClips in the main timeline the first in frame 35 and the second in frame 99 with the name of quary_mc. Inside the second movieclip there is a button with the name of sID_btn. When i addEventListener in frame 1 of the  main timeline it display:
    Error #1009: Cannot access a property or method of null object reference
    This is the code:
    quary_mc.sID_btn.addEventListener(MouseEvent.CLICK, displayData);
    function displayData(evt:MouseEvent):void
              trace("Hello");
    Regards,

    You will be unable to add the event listener to the button until frame 99 when it actually exists.
    Alternatively, you can just add the button on frame 1 at an alpha of 0 and then set it to 1 at frame 99. However, it will still get mouse input so you will need to set quary_mc.visible = false on frame 1 and quary_mc.visible = true on frame 99 to solve that issue.

  • Volume control buttons not working with new usb keyboard

    Hi all,
    I recently replaced the bluetooth keyboard that came with my iMac with the usb keyboard (the long aluminium one, with the number block). Typing is no problem, but the volume control keys dont seem to work with this keyboard as I was used to with the bluetooth keyboard: max vol, increase/decrease and vol. off dont operate with any of the keys (f, alt, str, cmd, shift). Only thing I can do is get a view of the running programs or make the current application vanish from the screen.
    Tried to change the keyboard setting in preferences for the F1-12 keys - made no change.
    help is very much appreciated.
    Thanks

    I was able to fix this bug by upgrading to OS X 10.6.8.
    Very strange that a) it was a problem in the first place and b) that the upgrade did not happen automatically
    Thanks very much to Haggibbor, who alerted me to that possibility. Since I read this in a thread I did not open myself, I unfortunately do not know how to let him have the 10 points I would like him to receive. (Hints for this newbie are very welcome.)
    Problem of volume control keys is now solved.

  • How to use the video control buttons on YouTube with voice over

    I have a Macbook Pro and since I am totally blind I use the voice over. I am watching YouTube videos but I can't access the buttons at the bottom of the screen. I can't play/pause the videos or use the slider. I ca't use any of those buttons. Is there sometihng I am missing here?

    I dont know if you will be able to connect other device like PS3 or Wii.
    As far as I know only the Xbox 360 could be connected to a Qosmio and could be used with the Windows MCE.
    I presume this is possible due to connection of Microsoft products; MCE and Xbox360
    To be honest; why you dont take a look into the user manual if this notebook is new to you?
    All details are mentioned in the user manual which is already preinstalled on the notebook.

  • ActionScript inside Movieclip is SOMETIMES ignored

    Hi,
    I am working on something similar to a slideshow where
    buttons are used to move forward and backward in the time line.
    On one of these "slides" there is another button, a MovieClip
    with a few frames inside (i.e. the rollover and mousedown states
    etc.) and ActionScript in Frame 1 that make the button work
    (rollovers and the like).
    If I play forward in this slideshow, everything works.
    If I play backwards to the frame that has this button, then
    all ActionScript inside this button is completely ignored
    (including trace), and the button will endlessly cycle through the
    frames inside (even though I tried various STOP commands from
    inside and outside the movieclip).
    The interesting thing is that I have a very similar slideshow
    with a similar button that does NOT have this issue. If I
    copy/paste the working button to replace the bad one, the same
    thing happens to this button, so it somehow is local to this one
    file.
    There are no error messages coming up, and I don't even know
    if there IS any code that would disable script inside a movieclip.
    I checked the code inside the MovieClip and found nothing
    wrong - it only has the stop command, a few addevenlisteners and
    their corresponding functions in frame 1.
    I just don't get why it works in one file but not in this one
    - the best part is that whenever I create a new slideshow, I simply
    create a copy of the last slideshow file, so the basics of all
    these files should be identical...
    Another thing that completely throws me for a loop is that
    when I add any random shape (e.g. a square) into the frame that has
    the BACK button that brings me to the broken button, then it works!
    So I have a workaround, but I would really like to know what
    causes this - I'd prefer a fix to a workaround that might break
    some day, too.
    Any idea what could possibly cause something like this and
    what I can do about this?
    Thanks!

    you probably have a corrupt swf.
    to test, copy all the assets to new swf and see if the problem persists.

  • MovieClip buttons inside a MovieClip button inside another MovieClip button

    I am trying to make a Portfolio of my study abroad experience and can get something right about the movie clip buttons inside each other. I have a button to click on titled "travel" and a window shows up with more movieclip buttons to organize different locations of pictures. I can click on the button to have to slide of pictures but nothing happens. I have the "turnOffAllButtons"  coding and  also have the coding for stay clicked, but I can't get the 3rd set to show up. what am i not doing?
    I don't have any errors or output comments showing up

    I have it working now. what I did, I make a slideshow setup (gotoAndStop(1);) in a specific frame and the code I put in for the next, didnt work.
    this is was I have now, without the "turnOffAllButtons" coding:
    Main Button (actions Layer):
    stop();
    travelButton_mc.buttonMode=true;
    travelButton_mc.addEventListener(MouseEvent.ROLL_OVER, colorizetravelButton);
    function colorizetravelButton(givenEvent:MouseEvent){
      if (givenEvent.currentTarget.currentFrame != 50)
      travelButton_mc.gotoAndPlay(2);
    travelButton_mc.addEventListener(MouseEvent.ROLL_OUT, decolorizetravelButton);
    function decolorizetravelButton(givenEvent:MouseEvent){
      if (givenEvent.currentTarget.currentFrame != 50)
      travelButton_mc.gotoAndPlay(21);
    travelButton_mc.addEventListener(MouseEvent.CLICK, loadtravelLocations);
    function loadtravelLocations(givenEvent:MouseEvent){
      travelButton_mc.gotoAndStop(50);
      travelLocations_mc.gotoAndPlay(1);
    Inside the travelLocations_mc I have currently one button to show a slide of pictures, this is the second layer of buttoncode:
    stop();
    scotlandButton_mc.buttonMode=true;
    scotlandButton_mc.addEventListener(MouseEvent.ROLL_OVER, colorizescotlandButton);
    function colorizescotlandButton(givenEvent:MouseEvent){
      if (givenEvent.currentTarget.currentFrame != 50)
      scotlandButton_mc.gotoAndPlay(2);
    scotlandButton_mc.addEventListener(MouseEvent.ROLL_OUT, decolorizescotlandButton);
    function decolorizescotlandButton(givenEvent:MouseEvent){
      if (givenEvent.currentTarget.currentFrame != 50)
      scotlandButton_mc.gotoAndPlay(21);
    scotlandButton_mc.addEventListener(MouseEvent.CLICK, loadscotlandInfoPage);
    function loadscotlandInfoPage(givenEvent:MouseEvent){
      scotlandButton_mc.gotoAndStop(50);
      scotlandInfoPage_mc.gotoAndPlay(1);
    I turned the alpha up so you can see the mc that loads
    I currently have a keyframe at 60 with a code of stop(); so the travelLocations_mc will still
    does this make sense?

  • Control MovieClip with FlashVars

    Let me start from the top, I hope I can explain this well
    enough so you guys can make sense of this.
    I have a cfm page with a list/menu pulldown that submits a
    category name to the same page it resides on using
    an onChange.
    Based upon which category is submitted I query the DB for
    subcategories.
    There is a flash movie in the page as well and it takes those
    subCats and populates the FlashVars
    e.g.;
    <cfif isDefined ('FORM.category')>
    <cfoutput><PARAM NAME=FlashVars
    VALUE="category=#getCat.category#
    <cfif #getsubCats.recordCount# GT 0>
    &whichFrame=on
    &subCat1=#getSubCats.subCat[1]#
    <cfelse>
    &whichFrame=off &subCat1=Available Booth
    I do this for 10 seperate variables subCat1 thru subCat10.
    The Flash movie picks up the subCats
    and works just fine. But I'm trying to control a movie clip
    with the whichFrame var.
    The name of the clip is H1 and the script is:
    _root.H1.gotoAndPlay(whichFrame);
    There is a frame labled "on" and a frame labled "off" inside
    of H1. If I manually set the variable on the stage
    to on, the clip goes to the "on" frame, and when I select a
    subCat that has no entry, the clip goes to "off"... BUT
    only the first time I do it. From that point on the clip
    won't play...
    I'm losin my marbles over this one, any help at all would be,
    as always, greatly appreciated!
    jH

    if I read this right, you have drawn a square on stage, put
    it inside a movieclip, and associated that clip with the class
    "Vierkant". I this is what you've done, then the asset is already
    on the stage, so you should see it for sure, unless it's positioned
    off-stage.
    If the above assumption is correct, in your class code,
    square = new MovieClip(); is a blank movieclip that you
    created. It's not the square that's in the FLA. The square that
    you're trying to have show up is the Vierkant class object itself,
    i.e. "this".

  • Access a button inside a movieclip

    Hey...
    Im pretty new to flash, I have a problem that have taken hours, only not to getting sorted out, so i'll try my luck here...
    I've basicly made a rollover menu which is nested inside a movieclip. the movieclip is put on 1 st. frame on the main timeline and I want the buttons inside the movie clip to take the user to a different frame on the main timeline, but no matter what I do it's just not working...
    here is some of he solutions i have tried to do:
    function work1(e:Event)
    //MovieClip(parent.parent).gotoAndStop("work1")
    //gotoAndStop("work1")
    //this.gotoAndStop("work1")
    //parent(gotoAndStop("work1"))
    //MovieClip(this.parent).gotoAndStop("work1")
    //MovieClip(parent.gotoAndStop("work1"))
    //this(gotoAndStop("work1"))
    //main.gotoAndStop("work1")
    //root.gotoAndStop("work1")
    //MovieClip(root).gotoAndPlay("work1")
    //MovieClip(stage).gotoAndPlay("work1")
    //MovieClip(root.parent.parent).gotoAndStop("work1");
    work1_btn.addEventListener(MouseEvent.CLICK, work1);
    hope someone can help...

    sure, there are a zillion ways, that timeout function was more to demonstrate the problem than offer a valid solution...
    Personally, with what you're doing, here's my first inclination for handling it:
    Just add this bit, dumping that other stuff:
    stage.addEventListener(MouseEvent.CLICK, clickHandler);
    function clickHandler(event:MouseEvent):void{
         if (event.target is SimpleButton&&event.target.name!=null){
              gotoAndPlay(event.target.name);
    That assumes you've given those buttons the same name as the frame you want them to go to. In your example, rename that first button as work1, and that code will send you to the frame with that name on click. That code will handle all the buttons, assuming you name the frame and button instances the same (like button work2 would take you to a frame named work2 etc).
    Since it's a stage click handler, it can handle any click. Here's the breakdown:
    //adding a global click listener.
    stage.addEventListener(MouseEvent.CLICK, clickHandler);
    //what to do with the click
    function clickHandler(event:MouseEvent):void{
         //here we're just checking to see what's clicked (from your example, they are SimpleButtons)
         //and then the && means 'and'  we're making sure that button has a name.
         if (event.target is SimpleButton&&event.target.name!=null){
              //goto the frame with the same name as the button
              gotoAndPlay(event.target.name);
    HTH,
    -Ted

  • Problems with button inside draggable movie clip

    I am building a click through presentation that has some small text in it. To maintain the design and allow for readability, I have added a zoom feature.
    Here is the structure of the movie,
    Stage - contains pages movie clip and forward/reverse click buttons for changing pages
         pages_mc - contains 24 frames, one page per frame and buttons
    There is a button at the _root level that uses a tweener to scale the pages_mc up to 170%. When this is clicked, it allows the pages to be dragged around the screen so you can look at different sections. When you click the button again, it returns the pages back to their original size stops drag.
    My problem is, on the pages, there are buttons with links to external sites. Once startDrag has been invoked, I cannot touch the buttons inside the movie clip. Is there a way to make these buttons work?
    I need the finished quickly so any assistance is welcome.
    Code below
    magUp_btn.onRelease = function() {
    this._visible = false;
    TweenLite.to(pages_mc, .25, {_x:-250, _y:-193, _xscale:170, _yscale:170});
    TweenLite.to(magUp_mc, .75, {_alpha:0});
    TweenLite.to(magDown_mc, .75, {_alpha:25});
    magDown_btn._visible = true;
    pages_mc.onPress = function(){
    this.startDrag();
    pages_mc.onRelease = function(){
    this.stopDrag();
    pages_mc.onReleaseOutside = function(){
    this.stopDrag();
    pages_mc.useHandCursor = false;
    TweenLite.to(instr_mc, 1, {_alpha:100});
    magDown_btn.onRelease = function() {
    TweenLite.to(pages_mc, .25, {_x:0, _y:0, _xscale:100, _yscale:100});
    TweenLite.to(magUp_mc, .75, {_alpha:25});
    TweenLite.to(magDown_mc, .75, {_alpha:0});
    this._visible = false;
    magUp_btn._visible = true;
    pages_mc.onPress = function(){
    this.stopDrag();
    TweenLite.to(instr_mc, 1, {_alpha:0});
    I don't know how to turn drag off when I zoom out without using the onPress command, but I know that this is probably what is getting in the way of the button working?
    Thanks!

    One option is to make the background of the pages be the draggable parts rather than the movieclips that contain the pages and buttons.  That way, the buttons could be atop the background and not have their access blocked.
    Instead of coding the pages_mc, you would essentially have the background coded for the drag...
    pages_mc.bkgnd.onPress = function(){
        startDrag(this._parent);

  • Buttons inside a movieclips won't work...

    I have a movieclip that has several buttons inside it. When I use this code:
    mc.onRollOver = function()
         // do stuff
    The buttons won't work anymore..

    Hello there Mr. Ned Murphy,
    Is there any other way to make buttons inside a movieclip work?
    The scenario of my project is having a panel for control buttons, progress bar, sound buttons(on/off). When the cursor is rollover the panel, it will animate going up to reveal buttons which hidden below, for the shortcut of every scenes.
    This is what I got.
    control_panel_mc->2 frames w/ stop(); on each->2 layers->1st layer(bottom)panel contains buttons->2nd layer(contains button w/ a "swapdepths very important")
    and on the 2nd frame 2nd layer theres no button w/ a swapdepths and on the actionscript I have that code: mc.onRollOut = function{ //do something };
    Any other suggestion please...
    Thanks and more power,

  • How do I break a for loop (inside) and a while loop (outside) at the same time by a control button

    I have a while loop (outside) and a for loop (inside) and a control button within the for loop.  I want to stop the program by click the botton without finishing the for loop.  How can I do that?
    Thank you in advance.

    HI Please find attached snapshot Regards, Santosh
    Message Edited by SanRac on 12-17-2009 05:12 AM
    Message Edited by SanRac on 12-17-2009 05:13 AM
    Attachments:
    Snap1.png ‏4 KB

  • Control Buttons in message popup with Digital I/O

    In my Test system the   operator  can use only the Start Stop Quit buttons on the Panel.
    He  aint have any mouse
    That means I have to provide him wit all  the control power  thr' these 3 digital I/Ps
    There are many message popups in the SequentialModel.seq  file 
    The OPERATOR will  respond to them with the 3 H/W buttons.
    OK= Green
    Terminate = Red
    how can I assign my  Buttons to all  Popup messages on teststand Irrespective of their .(i.e handling them Individually) 

    My plan is to control the whole testsystem, with  Hardware buttons (On off S/Ws for Operator) (operator wont be using mouse- it takes timeto scroll & prod is slow).
    The H/W buttons r read thr   Labview. The file is a member function of the class that I call In teststand seq.
    I am trying to  read and respond to Teststand  dialogues thr'  the Operator Interface using these 3   buttons 

  • Control 2 flv movies with one button

    Hello,
    I am not even sure this can be done, but I am trying to
    control 2 flv's with one set of controls. The reason; We have
    footage of a talking head as one flv and footage of a microscope.
    Basically, the guy talks and moves the microscope around. These 2
    flv's have to be synched b/c the guy is talking and showing how
    things look under a microscope (the original footage was shot at
    the same time using 2 different methods - I imported both in
    Flash). So, my quandry is that I need one set of controls for both
    these flv's b/c if you pause the talking head, you also have to
    pause the scope. I tried to make both flv's a movie clip and
    control them that way, but got no where with that. I also tried to
    build my own skin with a Play and Pause Button for now, but only
    got as far as the code below. Basically, I can control one flv
    component, but not both at the same time. Any ideas would help - I
    am not sure if this is an AS issue, or a complete design issue, or
    if it can even be done at all - thanks much in advance...
    Jason

    I have discovered that what I wanted to do above is not possible in Livecycle. The only thing that works in the Livecycle script editor is the xfa.host.print from what I found.
    I was able to add a print button to a form that I scanned in that enabled me to print at 2 different printers at the same time. What I did was to first set up a mouse up action to execute a menu item (file>print) and then I added a second mouse up action to run the JavaScript below
    var pp = this.getPrintParams();
    pp.interactive = pp.constants.interactionLevel.automatic;
    pp.printerName = "\\\\DPDSVR\\Xerox WorkCentre 7435 PCL6";
    this.print(pp);
    This resulted in me being able to print to my default printer (HP) and the Xerox with just one click of the button.

Maybe you are looking for

  • My iPad 1 32 gig 3g did not come with a "SIM card" already put in--with none given in the box. Help?

    I recently purchased an apple iPad 1, 32gig, 3G from amazon. When it was shipped, it came in a large box--but in the box was an unopened iPad 1 store box [like one you would pick up in a store]. It was never opened- just sold over amazon. When I open

  • Reports Query Doubt??

    hi all, Thanks to ALL the replies to my query. I have a doubt in Oracle reports. This is the query in the format trigger. ctr,cnt - are summary columns in the group above which counts the detail group I have to retrieve the records for status codes e

  • Outlook email without approve/reject links

    Hi, Can someone please let me know if its possible to send a outlook mail and a notification as per my requirement as below to a user already in oracle applications? My requirement is: I want to send a notification where in a user can approve the not

  • Repository service

    Dear All I have a scenario where in document are posted to the portal repository from a external system. I need to assign the permissions at runtime on this documents based on the TARGET group which is present in the external system database or in a

  • X-fi Elite pro has no working audio console / modi etc.e

    HELP...BIG PROBLEMS.When I bought on Ebay in USA a brand new Creative X-fi Elite pro with I/O console,( last May)? I never?aspected so many problems. Yes.. I had sound but that?s the only thing. In the hardware/system/detail I need to see a name call