Button within a movieclip

Hi all,
I am relatively new to Flash and am looking for help with a
file I am working on.
I have created a movieclip of an area which is placed so that
only the outer right edge is on the stage. When the mouse hovers
over the area, it moves onto the stage and reveals menu options. It
works beautifully as an animation, and the menu options (which have
over, down, and hit states) work when not part of this movieclip,
but when I place instances of the buttons within the tweened
movieclip, they no longer work.
I have been scouring the web for answers and most people say
that you cannot have a rollover within a rollover as the first
rollover (in my case, the movieclip) is still active.
I have seen this work with various files in flashden for
example where the menu slides out from the side and then slides
back in when you 'roll off' but while you are 'rolled on' you have
access to menu options which all perform their own roll on/off
movies.
Hopefully there is a simple answer!
Thanks in advance.
J.

I had to step out for awhile too.
Well, I'll give you a jump start on the AS version of Tweens.
Taking this approach will give you a better bit of sliding. With
your gotoAndPlay(label), you'd end up having things probably still
jumping around when it moves from the background to a button and
vice-versa which would end up complicating the coding to avoid it.
Below is a link to a small sample file I made for you that
you can study/utilize... it was easier than trying to explain it in
this forum. It shows you a better way of coding mouse interaction
stuff as well (using on(...) attached to objects is bad practice...
now outlawed in AS3).
The way I did it has all of the code visible in the main
timeline so you don't have to go digging and clicking on things to
find code.
The menu's background is a movieclip and the menu's button is
a button. I only have one button, but the more the merrier as long
as they all have their own code and instance names. Though for the
rollOver you could assign them all as follows:
btn1.onrollOver = btn2.onrollOver = btn3.onrollOver =
function(){...}
I forget during this edit (some hours later) if I have a
rollOut for the button, but since/if the background surrounds it on
all sides, you can probably eliminate it... only the background
would need to have that aspect covered.
There are two versions of the file linked below... a CS3
version and a Flash 8 version.
Sample Fla
File - CS3
Sample Fla
File - Flash 8
PS - my host's server is acting up today, so be
patient.

Similar Messages

  • How do I use a button within a movieclip to go to the root?

    Hi there, I am new to flash and AS3 and need some help
    getting my buttons to work.
    I made a script for the file that i am working with that has
    buttons located within 2 movieclips. I want that button to load and
    image into a UILoader (problemLoader_mc) that I placed on the stage
    on the main timeline (the timeline that 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 have tried multiple 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 out with this, I would greatly
    appreciate it, I am banging my head against a wall at the moment.
    (Also, please excuse my vague descriptions, I am still learning the
    official terms.)
    Here is the code that I have written that pertains to this
    problem:

    I have a mental block for reasoning things out as far as
    assigning the listener to an object two mc's away from the main
    timeline while having the function in the main timeline, so I may
    play with that on my own for awhile. One thing you didn't do
    though, was to pay the same attention to the problemArray[0]
    assignment in that function, which I assume also lives in the root.
    But here's what I'd do for the moment.
    Take all that code except the array and plant it in the
    timeline where WEEK1btn lives, modifying it as follows....
    WEEK1_btn.addEventListener(MouseEvent.CLICK, pload1);
    function pload1(event:Event)
    MovieClip(this.parent.parent).problemLoader_mc.source =
    MovieClip(this.parent.parent).problemArray[0];
    I haven't utlized root myself yet, so I am not comfortable
    offering you a solution that attempts it.

  • Play a Movie Clip on a frame In Main SWF from a button, within 2 MovieClips

    I’m using AS2, Flash 8
    I have a frame on my main Timeline Called “Gallery” within this frame I have 2 movie clips, which I need to work together:
    One is called:
    Gall_Lge_1
    Which contains 37 frames.
    Each frame has a different movie – basically 37 different photos which pop up on each frame.
    (MC’s named Lge_1, Lge_2, Lge_3 etc)
    The second Movie Clip I have on here is called:
    gall_strip_mc
    Which contains a movie clip called strip1 , (which is set to scroll its contents controlled by buttons on ”Gallery”- which works) inside that is a movie clip called strip_all , and contains one frame with 37 buttons/photo thumbnails, (Buttons named btn1, btn2, btn3 etc which I require to link each individual button to the corresponding photo/frame in Gall_Lge_1  …
    So,
    btn1 will go to and play Lge_1(Frame 1 of Gall_Lge_1)
    btn2 will go to and play Lge_2(Frame 2 of Gall_Lge_1)
    I’m stuck and can’t get it to work..
    Here is the site – under ‘Gallery’ so you can see what I’m trying to achieve
    http://www.blueshelldesign.com.au/draft/
    (I’ve placed in Back and Next buttons next to ‘Gall_Lge_1’ so you can see how its suppose to look when the thumbnails from ‘gall_strip_mc’ are clicked)

    First, you do not use quotes when you are specifying a frame number, so try changing that first.  The only time you use quotes for that argument is for frame label strings.
    If it still won't play, are you sure that the button is coded properly and executes the function when clicked?  You should put a trace in the function to make sure.  Also, you could try using _root instead of _level0... I forget the difference, if any, but _root will definitely get you to the main timeline.
    btn2.onRelease = function() {
         trace("btn2 clicked");
        _root.Gall_Lge_1.gotoAndPlay(2);

  • How do I make buttons within a movieclip play from a specific frame in scene 1?

    Hi guys
    I have a movie clip on the main timeline. This movieclip has buttons that I want to play different frames in scene 1.
    At the moment, this is the code I'm using in scene 1.
    learnclouds_mc.anna_btn.addEventListener(MouseEvent.CLICK, clickanna);
    function clickanna(evtObj:MouseEvent){
    gotoAndStop("annasstory", "Scene 1");
    I'm getting the error below but have no idea what I should be doing.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at Work_Life_Flash_Stage_1_fla::MainTimeline/frame4()
        at flash.display::MovieClip/gotoAndStop()
        at Work_Life_Flash_Stage_1_fla::MainTimeline/golearnclouds()
    i hope somebody can help me!

    If you only have the one scene, you do not need to include the scene argument in the goto method call.
    The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....
    - is not in the display list
    - doesn't have an instance name (or the instance name is mispelled)
    - does not exist in the frame where that code is trying to talk to it
    - is animated into place but is not assigned instance names in every keyframe for it
    - is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
    If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

  • Embed Button Within Movieclip--not finding button in script

    I want to now edit my movieclip to include another symbol (button) that will be recognized by script...I tried embedding..and adding the normal event listener however it doesn't see my button within the mc...what am i doing wrong...im sure it is something simple.
    My changes are in bold, and work as long as the button is not within the movieclip.  Any Ideas?
    ignore filename :/ i was making sure i didn't overwrite my original fla
    var xVel:Number = 0;
    stop()
    stage.addEventListener(Event.ENTER_FRAME,moveMC);
    tour_mc.addEventListener(Event.ENTER_FRAME,
    play_btn.addEventListener(MouseEvent.CLICK,forwardPlay);
    back_btn.addEventListener(MouseEvent.CLICK, backPlay);
    stop_btn.addEventListener(MouseEvent.CLICK,stopPlay);
    ff_btn.addEventListener(MouseEvent.CLICK,ffPlay);
    fr_btn.addEventListener(MouseEvent.CLICK,frPlay);
    kit2_btn.addEventListener(MouseEvent.CLICK,mvFrame);
    function moveMC(myEvent:Event):void {
         tour_mc.x += xVel;
         if(tour_mc.x <= stage.stageWidth-tour_mc.width){
             tour_mc.x = stage.stageWidth-tour_mc.width;
         if(tour_mc.x >= 0){
             tour_mc.x = 0;
    function forwardPlay(myEvent:MouseEvent):void {
         xVel = 2;
    function backPlay(myEvent:MouseEvent):void {
         xVel = -2
    function stopPlay(myEvent:MouseEvent):void {
         xVel = 0;
    function ffPlay(myEvent:MouseEvent):void {
         xVel=6;
    function frPlay(myEvent:MouseEvent):void {
        xVel=-6;
    function mvFrame(myEvent:MouseEvent):void{
         gotoAndStop(14);

    This is the answer...i figured it out not too long after i setup this question
    movieclipname.button.name.addEventListener(MouseEvent.CLICK,function);
    in my case it was :
    tour_mc.kit2_btn.addEventListener(MouseEvent.CLICK,mvFrame);

  • Button "Over" State Not Working Within Visible MovieClip

    Hi Folks,
    My button states aren't working right, and I'm pulling my hair out:
    http://www.miklas.org/test/test.htm
    The desired behavior is under the "Design..."  button--notice how when you mouseover the "Our Philosophy" link it turns blue? Why isn't  this happening for the "What We Can Do For You" and "Our Process" buttons in the other movieclips?
    The document is structured as follows:
    MovieClip 1: Design: Your Silent Salesperson
    ---Text
    ---Images
    ---Button: Our Philosophy
    MovieClip 2: Who Owns Your Brand
    ---Text
    ---Images
    ---Button: What We Can Do For You
    MovieClip 3: What's Your Brand's Persona
    ---Text
    ---Images:
    ---Button: Our Process
    DETAILED EXPLANATION:
    I have three separate movie clips with a bunch of objects. Using AS3,  I  tween their alpha value from 0 to 1 to make them visible depending on a  user mouseover. As part of each movieclip I have a button. It is text  with an underline; made to look like a hyperlink. When the user mouses  over the text, I want it to change color from orange to blue. This works  on the first movieclip, but doesn't on the second and third! What's  weird is that if I cut-and-paste the button from the second or third  movieclip to the first, the over state works fine. If I set Control  -> Enable Simple Buttons, the over state works fine. But when I  export it to .swf, it doesn't work!?
    tyvm!

    OK I finally got it! My layers were indeed out of whack--the entire problem was solved by the"setChildIndex" function.
    Basically, when the user mouses over the buttons, I fade in the new clip, and set the depth above the other movie clips. Here's the code:
    buttons_movieClip.whyDesign_button.addEventListener(
      MouseEvent.MOUSE_OVER,
      function(evt:MouseEvent):void
          if (active != whyDesign_movieClip)
            fade(whyDesign_movieClip);
            setChildIndex(whyDesign_movieClip,3);
            setChildIndex(whoOwns_movieClip,2);
            setChildIndex(persona_movieClip,1);
    There is a black background at depth 0. The following forum post helped a lot:
    http://www.smithmediafusion.com/blog/?p=435
    tyvm!

  • Button within a movie clip not working

    Hiya,
    I have a movie clip within my swf website that is basically
    an icon that you roll over to produce the menu. The movie clip has
    coding inside it to produce the rollover effect. This is as
    follows:
    stop();
    this.onEnterFrame = function(){
    if(rewind == true){
    prevFrame();
    this.onRollOver = function(){
    rewind = false;
    play();
    this.onRollOut = function(){
    rewind = true;
    Whilst this coding works fine for this movie clip, for some
    reason the buttons within the movie clip that appear as you
    rollover them will not work when pressed. I am trying to get them
    to navigate the main timeline, i.e. coding as follows:
    on (release) {
    _parent.gotoAndPlay("home")
    _parent should be correct, I've tried it without and with
    _parent._parent however still it has no effect. From what I can see
    everything should be working fine.
    Is there some reason why buttons will not work within this
    sort of roll over effect movie clip?
    Thanks for your help.

    you can't assign mouse handlers to a parent movieclip and
    expect a child movieclip to respond to mouse events: the parent
    will intercept those events.
    to remedy, either assign all your mouse handlers on the child
    generation movieclips or use a hitTest() for one of the
    generations.

  • Calling a function from within a movieclip

    How do I do this, and Is it wrong to do it this way?
    I have a movieclip on the timeline and within that movieclip
    it has buttons which I've placed listeners. I'm doing it this way
    rather than putting the code in the document class because the
    buttons don't appear right away in the movieclip (not until around
    frame 10). The function is defined in the document class because it
    is used with other movieclips.
    Anyone have an idea on how to properly do this?

    Well, I'm at least not getting an error - however, nothing is
    happening when I click the button to call the function (which is
    indeed public). Inside the function is a simple trace. I've even
    added a param to the function just for fun, and there's no error
    when calling the function from the button.

  • Remove child within a movieclip

    Hi guys,
    Does anyone know the actionscript 3.0 parameters in removing the child within a movieclip?
    This is my scenario:
    1. I have two (2) languages which play on the main timeline. Each languages are movieclips.
    2. I have a movieclip which has buttons. These buttons are added dynamically using "stage.addChild(main_menu)"
    3. I have a go back button together with the main timeline.
    How can remove a child on a timeline?
    For example when I choose the language A: it will play through by a movieclip and the buttons will be added dynamically [the dynamically added buttons are inside this movieclip; also the AS3 is inside that movieclip]. I wanted to remove the added child when the go back button is pressed and return to certain frame on the main timeline. The go back button is not included in the said movieclip--it is within the same timeline of languages and I wanted the script to be on the main timeline.
    Hope someone could help me. Thanks a lot.
    YSONG

    http://mtrinitaria.com/mykhel/as3-tips-of-the-day-removechild/
    http://mtrinitaria.com/mykhel/as3-tip-of-the-day-removechild-problems-and-solutions/
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObjectConta iner.html

  • Get the value of a selected radio button within a ToggleGroup

    All
    Please see the script below. All I'm trying to do is to identify the selected radio button within a ToggleGroup. This has been working in JavaFX 1.2.
    This is JavaFX 1.3 running on NetBeans 6.9 (beta) on Ubuntu 10.04
    Does anyone know why this is no longer working?
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    import javafx.scene.control.ToggleGroup;
    import javafx.scene.control.RadioButton;
    import javafx.scene.layout.HBox;
    import javafx.scene.control.Toggle;
    def levelGroup = ToggleGroup {};
    var selected: Toggle = bind levelGroup.selectedToggle on replace {
        // here I want to capture the value of the selected toggle
        // the outputted value is always 'null'
        println("level toggle = {selected.value}");
        println("selectedToggle = {levelGroup.selectedToggle.value}");
    Stage {
       scene: Scene {
          width: 300
          height: 300
          content: [
             HBox {
                    translateX: 100
                    translateY: 67
                    spacing: 20
                    content: [
                        RadioButton {
                            toggleGroup: levelGroup
                            text: "Easy"
                            selected: false
                        RadioButton {
                            toggleGroup: levelGroup
                            text: "Medium"
                            selected: true
                        RadioButton {
                            toggleGroup: levelGroup
                            text: "Hard"
                            selected: false
    }

    Actually, your code above wouldn't have worked in JavaFX 1.2 as we only added the value property to the new Toggle mixin in 1.3. I believe what worked for you in 1.2 was when you referred to text, which is not a property on Toggle, so you need to cast the selected variable from Toggle to a RadioButton, which does have a text property. For example, this would work:
    var selected: Toggle = bind levelGroup.selectedToggle on replace {
        println("level toggle = {(selected as RadioButton).text}");
        println("selectedToggle = {(levelGroup.selectedToggle as RadioButton).text}");
    }Alternatively, instead of casting like this, you can store a value in the value property of the Toggle mixin class, which is extended by RadioButton. For example, your code could be changed to the following (in particular note that the only change is the addition of the value properties in each of the RadioButton):
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    import javafx.scene.control.ToggleGroup;
    import javafx.scene.control.RadioButton;
    import javafx.scene.layout.HBox;
    import javafx.scene.control.Toggle;
    def levelGroup = ToggleGroup {};
    var selected: Toggle = bind levelGroup.selectedToggle on replace {
        println("level toggle = {selected.value}");
        println("selectedToggle = {levelGroup.selectedToggle.value}");
    Stage {
       scene: Scene {
          width: 300
          height: 300
          content: [
             HBox {
                    translateX: 100
                    translateY: 67
                    spacing: 20
                    content: [
                        RadioButton {
                            toggleGroup: levelGroup
                            text: "Easy"
                            selected: false
                            value: "Easy"
                        RadioButton {
                            toggleGroup: levelGroup
                            text: "Medium"
                            selected: true
                            value: "Medium"
                        RadioButton {
                            toggleGroup: levelGroup
                            text: "Hard"
                            selected: false
                            value: "Hard"
    }This approach saves you from having to cast from Toggle to RadioButton. This second approach is actually very powerful, as you can store any object in the value field, and can then easily retrieve it at a later point when the user selects the desired RadioButton. Of course, you can just use it as in the simple case above as well.
    I hope that helps.

  • How do I Re enabled the Buttons in MainMovie.swf from a Button within SecondMovie.swf???

    I have the following situation
    MainMove.swf is doing a loadmovie of SecondMovie.swf
    The Button that loads SecondMovie.swf also disables other buttons in MainMovie.swf
    on (release) {
        _root.intro_btn.enabled = false;
        loadMovieNum("SecondMovie.swf", 2);
    How do I Re enabled the Buttons in MainMovie.swf from a Button within SecondMovie.swf???
    Using AS2 is this current project
    Thanks

    lol Sorry bout that I'm brand new here and was looking for the option to remove the post from the other location.

  • Buttons within Complex Buttons

    Hi all - i'm trying to create a navigation system fairly
    indentical to this one:
    http://www.thefieryfurnaces.com/
    I am using a complex button with actionscript, however I
    can't get any of the navigation buttons to work on top of this. I'd
    like them to be complex buttons also ... can anyone help me work
    around this? Tearing my hair out!
    Cheers //
    Heath.
    Actionscript for the complex buttons i'm using below:
    stop();
    this.onEnterFrame = function(){
    if(rewind == true){
    prevFrame();
    this.onRollOver = function(){
    rewind = false;
    play();
    this.onRollOut = function(){
    rewind = true;

    One thing to get straight right away is that these buttons
    inside of movieclips. The buttons make the movieclips play, which
    is where the slideout effect comes in. The words are also buttons,
    with the over state containing the bouncing ball movieclip. All of
    these buttons are contained inside of another movieclip which make
    it looks like they are inside a sliding menu.
    What was the question again? haha

  • Controlling the main time line of a movie via a button within a movie on a different level.

    Hi there!
    I have two movie is two different levels,
    Level 5 is my base movie and I am loading another movie on
    top of this into level 10.
    Once the user clicks onto a button within the movie on level
    10, I would like the animation in level 5 to stop (the animation
    runs on the main root timeline of level 5).
    Once the user clicks on a different button within the movie
    on level 10, I would like the animation on the main timeline of the
    movie in level 5 to start again from the point where it previously
    left off.
    Is this possible?
    It would be great if someone could help me out with this.
    Thanks, midi_ie

    midi_ie wrote:
    > Hi there!
    > I have two movie is two different levels,
    > Level 5 is my base movie and I am loading another movie
    on top of this into
    > level 10.
    > Once the user clicks onto a button within the movie on
    level 10, I would like
    > the animation in level 5 to stop (the animation runs on
    the main root timeline
    > of level 5).
    >
    > Once the user clicks on a different button within the
    movie on level 10, I
    > would like the animation on the main timeline of the
    movie in level 5 to start
    > again from the point where it previously left off.
    > Is this possible?
    _level5.gotoAndPlay("someLabelframe");
    Use your regular action to target timeline or movie clips,
    just define the level number at the beginning of the path.
    Pretty much it :)
    Best Regards
    Urami
    !!!!!!! Merry Christmas !!!!!!!
    Happy New Year
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Remove child on the root timeline from within a movieclip

    Hi
    How do I remove a child from the root timeline from within a separate movieclip?
    I've tried
    MovieClip(parent).removeChild(mc1);
    But I get this error
    1120: Access of undefined property mc1.
    I could write a function in the root timeline that just removes child and then run that from within the movieclip but is there a better way?
    Thanks in advance.

    Thanks for replying.
    I asked on Kirupa but I couldn't access the site so I asked here.
    I guy answered with this
    MovieClip(parent).removeChild(MovieClip(parent).getChildByName("mc1"));
    It works fine, is this the best way to do it?
    Not sure if I understand what you meant?
    Just to be clear I have to movie clips on the stage mc1 and mc2 and i want to remove mc1 from within mc2's timeline.
    Thanks again

  • Can I place a "Return Button" within a clip?

    Is it possible to place a button within a video clip that would enable a user to return to the previous menu? I am using submenus and to return to the submenu requires going back to the main menu and then back into the submenu.
    24 inch iMac   Mac OS X (10.4.8)  

    Is it possible to place a button within a video clip that would enable a user to return to the previous menu?
    short answer is no. However you can add a button for the main menu
    If you have a project with submenus, you can add a button that viewers can click to go back to the main menu.
    To add a button for the main menu:
    Open the menu where you want to add the button and choose Project > Add Title Menu Button.
    Hope this helps.
    SDMacuser

Maybe you are looking for