Buttons within a clip

I'll build a Web site in flash for a design class (emphasis on the design, nothing taught with actionscript)

I need help, try to understand the actionscript code to allow buttons inside a movie clip symbol to navigate through the pages of level parent/root/main timeline.

With this site I mainMenu as a symbol of Clip from movie and menu items complete with animation within the clip.  I need these buttons when you press to access the different parts of the site that are controlled on the main level of the site (outside of the clip) that the buttons are).

I gave the button instance names, btnDining in the movie clip symbol.  The MovieClip instance is call mainMenu.  On the main level, I have labels for the different States/pages that I want the site having (meals, accommodation, etc.)

I tried to make the code work inside the movie clip mainMenu symbol when all buttons are loaded:

btnDining.addEventListener (MouseEvent.CLICK, dining);
function dining(evt:Event):void {}
gotoAndStop ("dining");
}

Nothing happens when I click on it, I guess because the gotoAndStop("dining") is not in the video, but on the main stage/level of the flash.

I also tried to call the buttons of the main stage/level after all that I need is responsible:

mainMenu.btnDining.addEventListener (MouseEvent.CLICK, dining);
function dining(evt:Event):void {}
gotoAndStop ("dining");
}

When I run the test, I get this in the output section:

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

Nothing happens when I click it either, I think it has to do with the mainMenu is not a reference not valid.

I don't know if it of best to run the code inside the MovieClip instance and call the different view on the main stage/level of the flash or if I try to run it from the main stage/level and the buttons inside the movie clip of reference symbol.

Please help me understand this, I am trying to go a little further, on this project.  I've been struggling to this day and I watched tutorials, books I have about actionscript, etc.  Please recommend the best course of action and what actionscript I need to make this work.

Thank you very much

If this is the output that you get, it seems that your btnDining is the missing culprit.  You must ensure that there was this instance name assigned to each keyframe, in that it is, and that he is present while the code is running.  If it's somewhere down inside the movieclip timeline, it is not present.

Tags: Adobe Animate

Similar Questions

  • buttons within a clip to control the same video clip?

    I'm trying to place inside a clip buttons to control the scenario of the clip even. This does not seam to work as buttons on the main timeline. When I play the movie the cursor does not turn in a helping hand and the rolloever affects only the kind of work. I read on command video with the buttons on the main timeline, but I need a button to change to half-way through the movieclip. I want to be able to jump to the inner planes, while in the outer section and vice versa. It would seem that this button would work in the same way within a clip as they do on the main timeline, but that doesn't seem to be the case. I use CS3. Scrip action 2.0 is selected, but I could change it to 3.0 if it would make a difference.

    Thanks in advance for the help.

    Save yourself some frustration and start with the basics in a simple example, rather than trying to involve the finished piece.  Create a movieclip and place a button on the inside.  Add a function to the time until the button is more behaves as you expect... that should signal where you hit a snag.

  • buttons inside video clips

    I created a button and placed within a clip.  I added the script (as2) the button below however when I test the movie, the button does not work.

    on (release) {}
    tellTarget (_root) {}
    Stop ("226");
    }
    }

    The button is located in clip "page1".

    Page 1 is on frame 120

    I don't know that I have not included.

    Tracey

    You may be having a problem because tellTArget is supposed to get a string argument, and maybe because you are citing the frame number which must be given not (unless it's an image tag).  Since you are using AS2, try using...

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

  • 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

  • Buttons in video Clips

    I am currently working with a menu and submenu buttons in the video clips - the script on the buttons in the clip is

    on (release) {}
    gotoAndPlay ("scenename", "#labelname");
    }

    When the button is tested by itself, the code works, but when the button is placed in the clip that it doesn't work anymore - is there a way to make the buttons work to in the clip?

    -Bill

    Yes, to return to a level, you can use this...

    on (release) {}
    _parent.gotoAndPlay ("BlahBlahBlah")
    }

    _parent. you will do as many levels as you want to go and _root. you will need to return to the main timeline.

  • Need help... buttons & amp; video clips

    On stage 1, I have a movie clip symbol. Inside the movie clip symbol are the button symbols that are being animated. Basically, I want these buttons allow to fly on the screen and the user and then click one of these buttons to go to an image within the current scene label (btw, there is only 1 scene and it is called stage 1). The buttons are created and the animation of their flight on the screen works beautifully; However, they do not attend any image labels.

    In my button symbols, I have my different States.
    In my video, I placed the button symbols, created animations, and in the last frame on each button, I have a goto action script and read the label for specific image.
    In my scene, I placed the clip.

    What I am doing wrong?

    Richie - you totally rock! Thank you very much!

    Just in case anyone has the same problem, I've done here is the answer that Richie gave me...

    I think that something is wrong with the call of the film of root with the image tags. I coded buttons on the main reach timeline directly it worked fine. For example... If you put this

    on (release) {}
    _root.gotoAndStop (13).
    }

    on the 2 button on the project, it works fine. The code just the buttons with the frame number and you should be home free. I hope this helps.
    Richie

    THANK YOU ONCE AGAIN RICHIE!
    Kimberly

  • How do reactivate you a button inside a Clip (which was disabled)?

    I am tempted to call a clip and when that film is called the other buttons on the frame are disabled. I got the correct part.

    However, the problem starts when I close the clip. the buttons I disabled are not enabled (see the reActivateButtonsfunction). I didn't do something correctly. There is code in two places, on the chassis and on the frame in the clip which is called. Please see the code.

    CODE ON THE TIMELINE OF THE HAND

    Stop();


    pop up screens

    CreditPop.stop ();

    Active keys from the popup screens when the movieclip is closed. ;

    stage.addEventListener ("ReActivateMainButtons", reActivateButtons);

    function reActivateButtons(e:Event):void

    {

    Credits_bnt.mouseEnabled = true;

    goLongA_bnt.mouseEnabled = true;

    goLongE_bnt.mouseEnabled = true;

    goLongI_bnt.mouseEnabled = true;

    goLongO_bnt.mouseEnabled = true;

    goLongU_bnt.mouseEnabled = true;

    }

    Name the clip and disables the buttons.

    stage.addEventListener (MouseEvent.MOUSE_DOWN, touchGo);

    function touchGo(event:MouseEvent):void

    {

    If (event.target is Credits_bnt)

    {

    SoundMixer.stopAll ();

    CreditPop.play ();

    Credits_bnt.mouseEnabled = false;

    goLongA_bnt.mouseEnabled = false;

    goLongE_bnt.mouseEnabled = false;

    goLongI_bnt.mouseEnabled = false;

    goLongO_bnt.mouseEnabled = false;

    goLongU_bnt.mouseEnabled = false;

    Event.stopImmediatePropagation;

    }

    CODE INSIDE THE MOVIE CLIP: Code in the video which is called. I created a dispatch to activate ReActivateMainButtons.

    Stop();

    closeCredit.addEventListener (MouseEvent.MOUSE_DOWN, closeCreditPopupScreen);

    function closeCreditPopupScreen (event: MouseEvent): void

    {

    gotoAndPlay ("closeCredit");

    this.dispatchEvent (new event ("ReActivateMainButtons"));

    }

    Question: How can reactivate these buttons that have been disabled?

    Try ading the listener for the object that dispatches the event instead of the scene

  • Buttons and video Clips (in and out)

    I'm working on my own website for my graphic design work and I use flash for the introductory movie, you can either ignore or after a time, will send you directly to the home page.

    On this introduction movie (which animatedface_mc sick call) I put two other clips with flashing eyes (left and right). The eyes would be constantly flashing, this page is in progress. That we work.

    On the side are buttons of the names of celebrities and once clicked on adding video clips to the main animatedface_mc. For example if I clicked on the monroe_mc, it adds this famous Marilyn Monroe mole (using the mask or opacity, depending on the function of the face) on the animatedface_mc. If I clicked on tyson_mc, he adds his face tattoo. I used the following code to it:

    monroe_btn.addEventListener (MouseEvent.CLICK, monroeshow);
    function monroeshow (event: MouseEvent) {}
    monroe_mc. Play();
    }

    tyson_btn.addEventListener (MouseEvent.CLICK, tysonshow);
    function tysonshow (event: MouseEvent) {}
    tyson_mc. Play();
    }

    There are at least 10 other buttons on this page, but I just realized that some of the features of the face are running too and so seems not good. I was wondering if there was a way that when you click a button, it turns off the video clips which are already turned on, so maybe that tyson_mc and chaplin_mc were already, and I clicked on monroe_btn, monroe_mc shows to the top and tyson / video clips chaplin may be disabled. Tyson and chaplin buttons would still be clickable, it's just that their film clips, if already, could be put off.

    I tried the following, but it doesn't seem to work: tyson_mc.enabled = false;

    Thanks in advance for the help.

    You need not have a frame on the main timeline 2 If you have any framework 1 now.  You can use tyson_mc.visible = true;  When it is click on the button of tyson as if it was previously invisible, it becomes visible again.

    That would be the basic series of commands by clicking a button that is capable of producing...

    function resetMCs() {/ / shared by all buttons}

    monroe_mc.gotoAndStop (1);    or monroe_mc.visible = false;

    tyson_mc.gotoAndStop (1);       or tyson_mc.visible = false;

    }

    monroe_btn.addEventListener (MouseEvent.CLICK, monroeshow);
    function monroeshow (event: MouseEvent) {}

    resetMCs();

    monroe_mc. Visible = true;

    monroe_mc. Play();    See the comments below
    }

    tyson_btn.addEventListener (MouseEvent.CLICK, tysonshow);
    function tysonshow (event: MouseEvent) {}

    resetMCs();

    tyson_mc. Visible = true;
    tyson_mc. Play();       See the comments below

    }

    If mole and tatoo movies don't really animate at all and tell them to play fair, then you could end up with several images for them and only control their visibility instead of telling them to play.

  • The buttons in a clip do not go to image tags

    Hello, I have 1 button inbeded in a clip named mcintroclp that is located on frame 1 of the main script, image 2 is labeled port_btn on the main timeline. In the timeline of the movie clip mcintroclp, I put the code:

    Stop();

    function buttonClick(event:MouseEvent):void

    {

    gotoAndPlay (event.target.name);

    }

    port_btn.addEventListener (MouseEvent.Click, ButtonClick);

    The problem is that when you press the port_btn starts it from the read head from the beginning of the main timeline not in box 2 with port_btn label. Anyone know what I am doing wrong, please

    SQ

    The timeline that contains the code is the clip named mcintroClip I put the code on a layer action on the last frame of the timeline of MC. That is the same timeline that contains two buttons.

    When mcintroClip reached this last image, it must stay in this framework, correct?  or mcintroClip moves to another frame after that?

    What is the next show after clicking on port_btn:

    Stop();

    function buttonClick(event:MouseEvent):void {}

    trace (Event.Target.Name, Event.currentTarget.Name);

    trace (MovieClip (parent) .currentLabels);

    MovieClip (parent) .gotoAndPlay (event.target.name);

    }

    port_btn.addEventListener (MouseEvent.Click, ButtonClick);

  • Button inside a clip controlling the main timeline

    Hello-

    I have a clip on the main stage - inside that movie clip is a button - I want that button to contol a function on the main timeline.

    example: the Script button

    closeAll_btn.addEventListener (MouseEvent.MOUSE_DOWN, goCloseAll);

    function goCloseAll(e:MouseEvent):void {}


    * do not know what to put here to activate "closeAllOpenMovieClips" on the main stage *


    }

    example: main stadium Timeline Script

    function closeAllOpenMovieClips (): void {}
    trek_mc.gotoAndStop (1);
    lost_arts_mc.gotoAndStop (1);
    rain_mc.gotoAndStop (1);
    vintage_mc.gotoAndStop (1);
    }


    do not know if I need a script more on chronology of main stadium that comes "from function."

    Thank you - Ben L

    If the button is in part 2, then the event listener so that it must be well on frame 2... or you could make the button visible/invisible betrween frames 1 and 2).

    But if you want to head back to your original approach...

    closeAll_btn.addEventListener (MouseEvent.MOUSE_DOWN, goCloseAll);

    function goCloseAll(e:MouseEvent):void {}

    MovieClip (root) .closeAllOpenMovieClips ();

    }

  • EventListener for a clip within a clip

    I'm kinda a noob actionscript so sorry if this is a stupid question and to be honest, there is a big part of me who wants to try and understand it, but I would like any advice or pointers.

    What I'm trying to do is set up a grid of 4 x 5 boxes.  Inside each box are 1) using the arrow keys image 2) four 3) a text field to enter the code for the image.  The idea is that someone might enter product in each text field codes and be able to record this information in an external xml file.  If they wanted to change the order, but keep a picture, they could just use the arrow keys to move the product around the grid.


    When I run problems, it is that I can put the boxes up on the screen in a grid.  I can give an instance name to each box.  But I have not yet discovered a way to address a clip (for example one of the arrow buttons) which is a child of the original movieclip place by my curls.  Ideally, I'm looking to find a way, target values and change:

    Box1-> up arrow

    Arrow pointing down

    Left arrow

    Right arrow key

    Image

    Text box

    Box2-> up arrow

    Arrow pointing down

    Left arrow

    Right arrow key

    Image

    Text box

    But I'd be just as happy if I could just give each button an instance name, and then respond like that.

    Here's my class until now:

    package {}
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    Import Card_mc;
    Import Up_Button_mc;

    public class place_cards extends MovieClip {}
    private var _card:Card_mc;
    private var _up_button_mc:Up_Button_mc;

    private var _cardX:Number;
    private var _cardY:Number;
    private var _card_counter:Number;
    private var current_target: *;

    public void place_cards() {}
    createCards();
    }


    private function createCards (): void {}
    This function places the initial cards on the screen

    _card_counter = 0;
    _cardY = 25;
    for (var j: Number = 0; j < 5; j ++) {}
    _cardX = 25;

    for (var i: Number = 0; i < 4; i ++) {}
    _card_counter += 1;
    _card = new Card_mc();
    addChild (_card);

    _card.x = _cardX;
    _card.y = _cardY;
    _cardX += _card.width + 20;
    _card. Name = "Card_mc" + _card_counter;
    _card.addEventListener (MouseEvent.CLICK, OnClick);
    _up_button_mc.addEventListener (MouseEvent.CLICK, DirectionClick);
    }
    _cardY += _card.height + 20;
    }
    }

    private void OnClick(event:MouseEvent):void {}

    Debug subroutine to see if my card names correct
    trace (Event.Target.Name);
    }
    private void DirectionClick(event:MouseEvent):void {}

    Check if the arrow keys were clicked.

    If they have, perform actions.

    Consider using a new class for behaviors.


    trace ("direction click:" + event.target.name);
    }
    }
    }

    There is almost always a way with flash.  but I still don't know what you are looking for.  possibly:

    var will tell: Array = ["up", "down", "left", "right"];

    for (var i: uint = 0; i<>

    _card ["_" + say [i] + "_button_mc"] .addEventListener (...);

    }

  • Disable the buttons in a clip

    Hello!

    I have a screen with transparency that opens to a full button movieclip.

    I need to turn off the video clip or buttons so that they do not work when the pop-up appears.

    Cannot make it work with this code:

    myMC._enabled = false;

    or

    myMC.myBTN._enabled = false;

    both of these pieces of code, the buttons still work?

    Any ideas?

    Maybe your instance names are not assigned correctly - if your transition buttons in at all, then you need to be sure to appoint them to all keyframes.

    Maybe you should do is create a function to turn the keys... Put it inside the movieclip to accompany.  In this way, you can call the function and confirm that you at least target the function properly by including a trace in it.

    In any case, "allowed" without the underscore character is the right way to code.

  • To access the components nested within a clip instantiated at run time

    I'm having this problem with actionscript 2:

    I have a class that instantiates a movieclip in the library, for example:

    myBar:MovieClip = level0.AttachMovie("debugbar", "debugbar_mc", 999);
    

    myBar is an instance of the class variable.

    Now, the important part - debugbar in the library is a movieclip that contains some items - textInputs and buttons. The problem comes when trying to access these components.

    I would have thought this could work:

    myBar.input_txt.text = "hello";

    to set the text of the "input_txt", the name of the instance of a TextInput component on the scenario of the clip (image 1 of the mc 1 frame).

    It does not work. Infact, I can't access "component" specific properties - they return not defined. I can't added the handlers for component events either.

    I can however set and retrieve the MovieClip properties for the "input_txt", such as _x. However there is one extra strange thing with this too - _visible affecting false doesn't seem to work (a component by default substitutes however maybe this).

    I tried on a cast component, such as:

    var temp:TextInput = TextInput(myBar.input_txt);
    trace(temp);
    

    who gave 'temp' as null. Without casting, it gives the path correctly.

    It almost seems that the components are somehow broken when you try to access it this way--or that they are not accessible in this way?

    The thing is, I was able to access all of this before, when it was placed the code to do it on the timeline (frame 1, the only framework) of the debugbar itself, where the components have been placed to the above.

    I need to have it in a class, I need to spend in some items that need to be accessible by the mc. I am quite puzzled as to why it does not work.

    Thanks for your time, cheers

    the solution I've seen had to for as3.

    for as2, I think you can use onLoad() method:

    {yourMC.yourcomponent.onLoad = function ()}

    do everything.  your component is ready.

    }

  • problem with buttons in a clip

    Hello

    I created a video in which I put several buttons... the idea is to create a menu that falls under the botton to give the choice of subclass several... Example for my support of botton, I want a delete submenu under with the buttons 'video' 'music' "photo".

    I am using flash CS3 and I created a picture on my calendar, the end of the menu animation a fall, with the manuscript of the action that follows:

    Stop()

    photo.addEventListener (MouseEvent.CLICK, b5);

    function b5(e:MouseEvent):void {}
    root.gotoAndPlay ("Pho") ;}

    The idea is to release the clip of 'media' that contains buttons and go to Pho label on my main stage.

    for help in the forums, you must copy and paste your error message, if you see one.

    in this case, I believe that this will stop the error message:

    Stop()

    photo.addEventListener (MouseEvent.CLICK, b5);

    function b5(e:MouseEvent):void {}
         MovieClip (root) .gotoAndPlay ("Pho") ;}

  • Button control Movie Clip

    I have a button on the script main control an animation that reside in a clip. I have a mask in the clip that opens and displays an image when the button is in the rollover State. I want the mask to close on the deployment status. If I do a Tween with her opening and closing an interpolation with her, when the rollsOut user of the button prematurely, he climbs to the last part of the open animation. I want it to be fluid. I don't know how to do that with actionscript, and I want my code to be on the main timeline. Here is an example of the code:

    tv_btn.onRollOver = function () {}
    tv_mc.gotoAndPlay ("Open");
    }
    tv_btn.onRollOut = function () {}
    tv_mc.gotoAndPlay ("Close");
    }

    www.gladstien.com/Files/sample_animation.fla

Maybe you are looking for

  • Unhandled system thread

    When you do certain things I get this message "system only thread not handled" (bcmw63a.sys) on the BSOD then it restarts and will continue to work ok but some programs seem to trigger this. "" I have a newish laptop Toshiba Windows 10. I looked on g

  • Apple ID is blocked and cannot make purchases

    I wanted to buy an app from the apple store, I entered my password and then I was required to answer some questions of security, but I forgot the answers so I tried different combinations, but none of them worked and then I got the message that my ID

  • calculation of text file

    Hi all How to extract 2 or 3 fields from txt file and do caculation and save it to another file. are there examples for this. Thank you

  • Determine eligible SampTimingTypes for a given device?

    I'm sure that this should be simple, but I can't find the right way to determine if a device supports the synchronization of DAQmx_Val_OnDemand. For example, I can get a list of the modes supported by using DAQmxGetDevAISampModes sample; Is there an

  • ID of Module cRIO-9081

    I use a property of e/s FPGA node to get the serial number and the ID of the Module for each module in my cRIO-9081.  The serial numbers match exactly what I thought, it was in my cRIO.  The ID of the Module, however, makes no sense.  I thought that