11 Replies Latest reply on Apr 11, 2007 8:31 AM by mmaler

    Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????

    mmaler

      I am in the process of building an application where all of the functions will be eventually exported into seperate AS files. I am having issues with a Sub Navigation that is attached and managed dynamically.

      The Sub Navigation is in an MC which contains a mask (which has a tween animation to add a fade in effect), and a blank MC which will contain all of the navigation items.

      Upon load of an XML file, the navigation items are extracted and buttons are created within the blank MC. Each button is inserted using the blank MC instance name at the next highest depth.

      All of the actions associated with the above need to be issued from the root timeline but when I call the dynamically attached clips (full target path) it cannot seem to find the clips. I have checked the target path numerous times and used a variety of debugging techniques but no luck.

      Has anyone else had issued targeting dynamically attached MC's that are nested two - three levels deep?

      Thank you so much in advance!
        • 1. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
          crazyjoemilan
          Has anyone else had issued targeting dynamically attached MC's that are nested two - three levels deep?

          not at all, do you have the procedure correct? Post some code, and I'll look at it for you.

          HmcH.
          • 2. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
            Rothrock Level 5
            My guess would be that you aren't quite getting the path quite right.

            You say you have used a variety of debugging techniques, but that is far to vague.

            In the testing environment go to Debug and list variables. this will show you what the path actually is. So copy that and post it here.

            Also from the place you are trying to access them add the following line:

            trace("Current scope is: "+this);

            Copy and past the results of that trace here. And then give us the line where you are trying to reference them.

            Finally you don't tell us what you are trying to "call" the dynamic clips. Often I've had the problem where my path/scope is fine, but I'm actually asking for something that doesn't make any sense to Flash. So the real problem might be someplace else.
            • 3. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
              mmaler Level 1

              The result of the trace is: _level0.NAV_Master.SNAV_Master

              Within the SNAV_Master clip, the first frame is blank with a stop command (so the Sub Navigation does not display until it is activated) and all of the buttons / items are the second key frame.

              Below is the code that is on the root timeline to activate the Scroll Button rollover and rollout functions. If the code is placed directly on the timeline within the nested movie clip it works as expected, but as soon as it goes on the root the button doesnt do anything:


              NAV_Master.SNAV_Master.Scroll_Up.onRollOver = function()
              {
              NAV_Master.SNAV_Master.Scroll_Up.States.gotoAndStop("B");
              };

              NAV_Master.SNAV_Master.Scroll_Up.onRollOut = function()
              {
              NAV_Master.SNAV_Master.Scroll_Up.States.gotoAndStop("A");
              };

              I have tried adding _root, _level0, etc but nothing seems to work?
              • 4. Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
                crazyjoemilan Level 2
                NAV_Master.SNAV_Master.Scroll_Up.onRollOver = function()
                {
                NAV_Master.SNAV_Master.Scroll_Up.States.gotoAndStop("B");
                };

                when you write a button's code like that (which is fine) your scope changes to on that button. So you'd say...

                NAV_Master.SNAV_Master.Scroll_Up.onRollOver = function()
                {
                trace("the scope of your rollover is correct");
                this._parent.States.gotoAndStop("B");
                };

                if you see no trace, the scope of your rollover button is wrong.
                • 5. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
                  mmaler Level 1

                  Wow! I can't believe I overlooked that - good call!!

                  Im not getting a trace back but am using the scope that is being returned from inside the clip that the container is actually stored in.

                  The function:

                  NAV_Master.SNAV_Master.Scroll_Up.onRollOver = function()

                  is stored in the root timeline - but for some reason it still will not find the clip.

                  Do you think that it has anything to do with the clip itself being on the second frame of the timeline within the clip? But that still wouldnt make sense to me.

                  Thanks again for all your help!!!
                  • 6. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
                    Rothrock Level 5
                    Oh, if the clip is on the second frame, but the movie is stopped on the first frame then the clip doesn't yet exist and as such cannot have event handlers assigned.

                    Clips have to exist before they can have code assigned. With Flash you can't get a burger today for which you will gladly pay next Thursday!
                    • 7. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
                      mmaler Level 1

                      I just corrected that and I have other clips attaching properly.

                      For some reason, still I am unable to target the Scroll_Up clip from the root. It's very very odd.
                      • 8. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
                        Rothrock Level 5
                        I still haven't seen a paste of what you get from the Debug->List Variables window. Maybe things aren't where you think they are.
                        • 9. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
                          mmaler Level 1
                          Here is what is being returned by the output when the Sub Navigation is displayed:

                          Level #0:
                          Variable _level0.$version = "MAC 8,0,22,0"
                          Variable _level0.NAV_Active = false
                          Variable _level0.NAV_ActiveButton = 0
                          Variable _level0.NAV_MaximumButtons = 7
                          Variable _level0.NAV_EaseSpeed = 1.5
                          Variable _level0.Navigation_ActiveButton = 0
                          Variable _level0.SubNavigation_XML = "_xml/DestinationDetails.xml"
                          Variable _level0.SubNavigation_ItemCount = 0
                          Variable _level0.SubNavigation_ItemsXPositioning = 10
                          Variable _level0.SubNavigation_ItemsYPositioning = 12
                          Movie Clip: Target="_level0.instance1"
                          Movie Clip: Target="_level0.instance2"
                          Movie Clip: Target="_level0.instance3"
                          Movie Clip: Target="_level0.instance4"
                          Movie Clip: Target="_level0.instance5"
                          Movie Clip: Target="_level0.instance6"
                          Movie Clip: Target="_level0.NAV_Master"
                          Movie Clip: Target="_level0.NAV_Master.instance7"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.instance8"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Button_Container"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.instance9"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Down"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Down.States"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Down.States.instance10"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Down.instance11"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Up"
                          Variable _level0.NAV_Master.SNAV_Master.Scroll_Up.onRollOver = [function 'onRollOver']
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Up.States"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Up.States.instance12"
                          Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Up.instance13"
                          Movie Clip: Target="_level0.NAV_Master.PNB_6"
                          Variable _level0.NAV_Master.PNB_6.onRollOver = [function 'onRollOver']
                          Variable _level0.NAV_Master.PNB_6.onRollOut = [function 'onRollOut']
                          Variable _level0.NAV_Master.PNB_6.onRelease = [function 'onRelease']
                          Movie Clip: Target="_level0.NAV_Master.PNB_6.PNBS_6"
                          Movie Clip: Target="_level0.NAV_Master.PNB_5"
                          Variable _level0.NAV_Master.PNB_5.onRollOver = [function 'onRollOver']
                          Variable _level0.NAV_Master.PNB_5.onRollOut = [function 'onRollOut']
                          Variable _level0.NAV_Master.PNB_5.onRelease = [function 'onRelease']
                          Movie Clip: Target="_level0.NAV_Master.PNB_5.PNBS_5"
                          Movie Clip: Target="_level0.NAV_Master.PNB_4"
                          Variable _level0.NAV_Master.PNB_4.onRollOver = [function 'onRollOver']
                          Variable _level0.NAV_Master.PNB_4.onRollOut = [function 'onRollOut']
                          Variable _level0.NAV_Master.PNB_4.onRelease = [function 'onRelease']
                          Movie Clip: Target="_level0.NAV_Master.PNB_4.PNBS_4"
                          Movie Clip: Target="_level0.NAV_Master.PNB_3"
                          Variable _level0.NAV_Master.PNB_3.onRollOver = [function 'onRollOver']
                          Variable _level0.NAV_Master.PNB_3.onRollOut = [function 'onRollOut']
                          Variable _level0.NAV_Master.PNB_3.onRelease = [function 'onRelease']
                          Movie Clip: Target="_level0.NAV_Master.PNB_3.PNBS_3"
                          Movie Clip: Target="_level0.NAV_Master.PNB_2"
                          Variable _level0.NAV_Master.PNB_2.onRollOver = [function 'onRollOver']
                          Variable _level0.NAV_Master.PNB_2.onRollOut = [function 'onRollOut']
                          Variable _level0.NAV_Master.PNB_2.onRelease = [function 'onRelease']
                          Movie Clip: Target="_level0.NAV_Master.PNB_2.PNBS_2"
                          Movie Clip: Target="_level0.NAV_Master.PNB_1"
                          Variable _level0.NAV_Master.PNB_1.onRollOver = [function 'onRollOver']
                          Variable _level0.NAV_Master.PNB_1.onRollOut = [function 'onRollOut']
                          Variable _level0.NAV_Master.PNB_1.onRelease = [function 'onRelease']
                          Movie Clip: Target="_level0.NAV_Master.PNB_1.PNBS_1"
                          Movie Clip: Target="_level0.NAV_Master.PNB_0"
                          Variable _level0.NAV_Master.PNB_0.onRollOver = [function 'onRollOver']
                          Variable _level0.NAV_Master.PNB_0.onRollOut = [function 'onRollOut']
                          Variable _level0.NAV_Master.PNB_0.onRelease = [function 'onRelease']
                          Movie Clip: Target="_level0.NAV_Master.PNB_0.PNBS_0"
                          • 10. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
                            Rothrock Level 5
                            Well, I'm not following all of this so closely because this isn't my project. But let's look at the following bit of that which I find interesting.

                            Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Up"
                            Variable _level0.NAV_Master.SNAV_Master.Scroll_Up.onRollOver = [function 'onRollOver']
                            Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Up.States"
                            Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Up.States.instance12"
                            Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Up.instance13"
                            Movie Clip: Target="_level0.NAV_Master.PNB_6"
                            Variable _level0.NAV_Master.PNB_6.onRollOver = [function 'onRollOver']
                            Variable _level0.NAV_Master.PNB_6.onRollOut = [function 'onRollOut']
                            Variable _level0.NAV_Master.PNB_6.onRelease = [function 'onRelease']

                            I notice that inside your Scroll_Up there are two instances of movieClips that don't have names assigned by you. They are getting the default instanceN names from Flash. Don't know if you intend that or not.

                            Also notice that there is an onRollOver attached to the Scroll_Up target so you are getting it in at least one place. Figure out what you are doing there that is different.
                            • 11. Re: Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root????
                              mmaler Level 1
                              I was able to finally get this working yesterday.

                              For some reason Flash did not like the instance name "Scroll_Up". As soon as I changed the instance name, everything worked properly, and again as soon as I changed it back it stopped working.

                              I appreciate everyones help on this!!!