5 Replies Latest reply on Aug 21, 2008 8:01 AM by kglad

    can't trigger function

    vin-E
      Follow me if you can.

      I have a shell .swf. Inside of that shell I have a frame script that inits a function:

      function callPop(who){

      trace("you called "+who);
      }

      The shell loads a few MC's. Inside one o the movie clips I am trying to call the function. But it is not working. I have a button with the following script:

      on (release)
      {
      _root.callPop("Root call pops");
      this.callPop("this popUp");
      _parent.callPop("parent the call pop");
      callPop("just call pop");
      this._parent.callPop("this parent call pop");
      trace("You did push a button");
      }

      As you can guess, the simple trace of "You did push a button shows. None of the others seem to fire off the function. When I debug - There is a variable called callPop, but it has no value when I click.

      I am trying to make a popup window, one that will close when other menu items are opened.

      I think the problem is the path, buyt I tried every option. It appears as such in debugger. I know this is hard to debug remotely - but is there a rule against calling fucntions in other swf's?

      Any thoughts?

      V
        • 1. Re: can't trigger function
          kglad Adobe Community Professional & MVP
          if callPop() is on the main timeline of your _level0 swf and you're loading other movieclips into _level0, then prefixing callPop() with _root would work as long as callPop() is defined when your button is released.
          • 2. Re: can't trigger function
            vin-E Level 1
            I am stuck. The loaded .swf REFUSES to call the function. I am at a lsot as to how to test this. I even REBUILT the entire project (lots of copy paste)

            If on the root level, I create a button and add the code:
            on (release) {
            call_Pop("Drew Barrymore");
            }

            The function "call_Pop" will return a trace command saing Drew Barrymore has been selected (I am using peoples names to know where the command is triggered.

            But on the loadedMovie .swf, the same command returns Nothing. I have a trace on the button itself and everything works internally to that MC. but I cannot seem to fire off this command.

            again, the goal is to simply create a popup on the screen, and if one already exists, replace it with another popup, and if I leave a scetion to close the popup. This is essentially why I am using a root level script.

            the Timeline at root level is being controlled by the embedded .swf.

            Any thoughts?
            • 3. Re: can't trigger function
              kglad Adobe Community Professional & MVP
              are you loading into the same level? if so:

              on (release) {
              _root.call_Pop("Drew Barrymore");
              }

              will work.

              if not, use:

              on (release) {
              _level0.call_Pop("Drew Barrymore");
              }
              • 4. Re: can't trigger function
                vin-E Level 1
                That worked. But I have to ask, how does _root differ from _level0?

                It should have worked as _root. Both should take me to the BASE .swf timeline.

                Vince
                • 5. Re: can't trigger function
                  kglad Adobe Community Professional & MVP
                  _root references the main timeline of a _level.

                  so, if your button containing swf is loaded into a non-zero _level, _root and _level0 will not reference the same timeline.