1 Reply Latest reply on Sep 20, 2006 8:37 AM by jordana309

    Referencing component parameters from other components

    jordana309
      I have a training application that uses a variety of components, including a browser that, as a parameter, takes a movie clip instance and will move it around when the scroll bars and the browser are used. I also have transparent buttons that on mouse-over turn slightly opaque so the user can see very obviously that they're mousing over something. I also have popups that, as a parameter, take the button instance name, and comes up when the button is moused over. When the button is clicked, is passes a parameter to an isCorrect variable (true or false) that is used by the popup to determine what color to turn the text (green if isCorrect == true, red else). The popup then puts up some additional text, to steer the user right. The problem with this is that all the wrong answers usually say the same thing, and only to correct one says something different, and often there are well over 50 popups per page, meaning each must be changed manually. And if, when reviewed, the text is determined to have to change, then it takes far too long to change it! So, as a solution, I put a parameter on my browser component called Popup Text with a variable name _browserPopupText. I need to be able to refrence it from the popup component. I am able to refrence the button currently because the instance name is entered as a parameter.

      By way of extra information, the popup instances are are placed inside of the movieClip that is moved around by the browser, so it isn't on the same layer. I've tried using this._parent._parent, which resolves properly (this being the button, this._parent refrencing the movieClip object, this._parent._parent being a relative way to say _root (since I have multiple _levels that need to move around on each other a lot), which resolves to the _level# that the clip and browser are on). however, I don't know how to refrence the browser without giving it an instance name, which I'd rather not force users to do (this training building app will be used by more-or-less computer illiterate people to build training Flash apps, and so I want to make it as uninvolved as possible).

      So, if there is a way to NOT have to give the browser an instance name and still refrence parameters in it from the popup, i would greatly appreciate hearing it.
      JA
        • 1. Re: Referencing component parameters from other components
          jordana309 Level 1
          k. I found myself a work-around. In the browser component, during the init() function initiallizing the browser, i simply added the following line of code:
          _global.browserPopupText = _browserPopupText;

          This works just fine. Then, i just refrence the _global variable. Also, I moved the isCertify from the buttons to the browser, so that I don't have to change every button from "isCertify = false" to "isCertify = true". Now All these things that used to be in literally hundreds of components has been moved to a handful of them--just the browser. Anyway, there's my work-around. I'm still open for a better way to do it.