6 Replies Latest reply on Oct 8, 2006 8:01 AM by kglad

    Buttons in nested movie clips not responding to action script

    RedRidings
      Here is my script that I have placed on the timeline of Thalamus_mc. I have determined that it is the problem relates to the path to the button.

      I have checked that there are no spelling errors and all instance names are unique. Can anybody help?

      stop();
      //Load this dynamic text
      _root.brain_txt.text = "Roll the cursor over a label for a simplified overview of the effects of stroke.";
      _root.title_txt.text = "Effects of Stroke";
      //show this text when the mouse moves over the label
      _root.Thalamus_mc.thalsmall_mc.inferolat_but.onRollOver = function() {
      _root.brain_txt.text = "Inferolateral thalamic infarcts are the most common thalamic lesion. Symptoms may include: headache, degrees of hemiparesis and hemisensory changes."+newline+""+newline+"Consciousness is not generally impaired in an isolated infarct in this area."+newline+""+newline+"(Bogousslavsky et al, 1988)";
      _root.title_txt.text ="Inferolateral arterial territory infarct";
      };
      //show this text when the user moves the mouse off label
      _root.Thalamus_mc.thalsmall_mc.inferolat_but.onRollOut = function() {
      _root.brain_txt.text = "Roll the cursor over the image for a simplified overview of the effects of stroke.";
      _root.title_txt.text = "Effects of Stroke";
      };

      This is my script:

      _root.thalamus_mc.thalsmall_mc.buttonInstanceName_but.onRelease = function(){

      _ Text
        • 1. Re: Buttons in nested movie clips not responding to action script
          kglad Adobe Community Professional & MVP
          use the trace() function to find your problem. is your button a true button or movieclip button. if the former put a trace(this) on the timeline of the movieclip that contains your button (_root.Thalamus_mc.thalsmall_mc) and if the later put a trace(this) on the timeline of your movieclip button. the result in the output panel is the path to your button. to the output panel's display append the button's instance name if it's a true button.

          p.s. you have shown two different (to flash) ways you've entered thalamus_mc.
          • 2. Re: Buttons in nested movie clips not responding to action script
            RedRidings Level 1
            Thank you for replying it is sincerely appreciated.

            my button is a true button, so I placed the trace function on the timeline of the movie in which it is located.

            The output read: _level0.Thalamus_mc.thalsmall_mc

            I placed the following code on the main timeline:
            //show this text when the mouse moves over the label
            _level0.Thalamus_mc.thalsmall_mc.inferolat_but.onRollOver = function() {
            _level0.brain_txt.text = "Inferolateral thalamic infarcts are the most common thalamic lesion. Symptoms may include: headache, degrees of hemiparesis and hemisensory changes."+newline+""+newline+"Consciousness is not generally impaired in an isolated infarct in this area."+newline+""+newline+"(Bogousslavsky et al, 1988)";
            _level0.title_txt.text = "Inferolateral arterial territory infarct";
            };
            //show this text when the user moves the mouse off image
            _level0.Thalamus_mc.thalsmall_mc.inferolat_but.onRollOut = function() {
            _level0.brain_txt.text = "Roll the cursor over the image for a simplified overview of the effects of stroke.";
            _level0.title_txt.text = "Effects of Stroke";
            };

            But i still haven't had any success. If I put the appropriate actionscript on the timeline of the movie inwhich the button is located, all is well. However, I am a learner and trying to establish good habits and would like the script to work form the main timeline.

            I didn't understand your comment about showing two different ways I've entered Thalamus_mc.

            I'd be grateful if you could help me nut this problem out.


            • 3. Re: Buttons in nested movie clips not responding to action script
              kglad Adobe Community Professional & MVP
              the functioning of your script is not related to the timeline to which it is attached because you're using absolute paths.

              however, if you mean that all is well if you attach an on(rollOver) to your button, then the problem is your button's instance name.

              to remedy, click on an empty region of the stage (or off-stage), click on your button and in the properties panel you should see your button's instance name: inferolat_but. do you?
              • 4. Re: Buttons in nested movie clips not responding to action script
                kglad Adobe Community Professional & MVP
                p.s. in your first message you used _root.thalamus_mc and _root.Thalamus_mc which are not the same to flash (since flash 6). but that doesn't look like something you did in your flash, just in this forum.
                • 5. Re: Buttons in nested movie clips not responding to action script
                  RedRidings Level 1
                  grateful again

                  I used a relative path on the timeline of the mc in which the button was contained. My action only fails when I use an abolute pathway.

                  I can't see a mistake in my scripting except that it doesn't work. I think it must have something to do with my naming conventions of the movie clips.

                  Is it a good idea to make the instance name different from the mc name?

                  As I have the action working, I'll stop looking for a solution, but try and prevent the problem occurring again.

                  Thanks for your time.



                  • 6. Re: Buttons in nested movie clips not responding to action script
                    kglad Adobe Community Professional & MVP
                    it's good practice to use instance names different from (but related) to the library name of your movieclips because it's common to use the same movieclip to create more than one instance (and each instance must have a distinct name). but it causes no problem to use the same name.

                    with a library name of gyrus, for example, you might use gyrus1, gyrus2 etc for instance name.

                    anyway, post a link to your fla and i'll correct it. specifiy the location of the code if it's not obvious.