2 Replies Latest reply on Sep 20, 2010 3:59 AM by aditi_bk

    Buttons not accessible

    aditi_bk

      Hi,

       

      I have several buttons within a flash file. The hierarchy is this:

       

      mainmcholder ----> workmc ---> service1mc

       

      All three are separate swf's loaded into holders. Now within service1mc, there are several buttons..clicking any buttons loads another external swf, related to that button, within an emtpy movieclip which is placed above these buttons. Now when one button is clicked, all the buttons are disabled and dimmed. When the user closes the external button-related swf, all buttons are enabled and _alpha is made 100 again.

       

      Everything works fine till the external button-related swf is closed. The buttons are disabled and dimmed, but when the swf is closed, the buttons are inaccessible.

       

      I have placed the code within onLoadInit(), wherein the external swf (_mc), has an event listener attached to it. When the event is dispatched, (which is successfully completed), a function is executed, which is enabling the buttons. The function is also getting executed, but the buttons are not reachable. It seems to be a path issue.

       

      The code is :

       

      _mc.addEventListener("end", endClip);

       

      function endClip() {

      trace("in function endclip");

      var j:Number = 1;

      while (j<=23) {

      this._parent.folioholdermc["img"+j]._alpha = 100;

      trace("img"+j + " alpha " + this.folioholdermc["img"+j]._alpha);

      this._parent.folioholdermc["img"+j].enabled = false;

      j++;

      trace("img"+j+" fixed");

      }

      };

       

      the output shows

       

      img1 alpha undefined

      img2 alpha undefined

       

      and so on...

       

      I have used the same path for disabling them, and that seems to work. What could be wrong???

        • 1. Re: Buttons not accessible
          Ned Murphy Adobe Community Professional & MVP

          It is probably just a targeting issue.  Between these two lines of code you are trying to target the same things using different paths, so I imagine one or both of them is incorrect...

           

          this._parent.folioholdermc["img"+j]._alpha = 100;

          trace("img"+j + " alpha " + this.folioholdermc["img"+j]._alpha);

           

          Try tracing this._parent and so forth along the lineup to see where you are losing the trail.

          • 2. Re: Buttons not accessible
            aditi_bk Level 1

            Hi Ned,

             

            I checked, and I am calling the same buttons, twice in the code. The first time I do that, using the path

             

            this._parent.folioholdermc["img"+i]._alpha = 20;            it works. And the alpha is set to 20.

             

            But when I call the button using the same path the second time, it does not work.

             

            The reason you see two paths, was because I was testing different variations for the second call. The entire code is given below

             

            on (press) {

            var scrX2:Number = System.capabilities.screenResolutionX;

            var scrY2:Number = 598;

            var i:Number = 1;

            var intrvl1;

            while (i<=23) {

            this._parent.folioholdermc["img"+i]._alpha = 20;

            trace("img"+i + " alpha " + this._parent.folioholdermc["img"+i]._alpha);      //works fine here

            this._parent.folioholdermc["img"+i].enabled = false;

            i++;

            }


            var loader:MovieClipLoader = new MovieClipLoader();


            var ldrlistener = new Object();


            loader.addListener(ldrlistener);


            ldrlistener.onLoadInit = function(_mc:MovieClip) {


            var halfx:Number = (_mc._width)/2;

            var halfy:Number = _mc._height/2;

            trace("half y = "+halfy);

            trace("img height = "+_mc._height);

            _mc._x = (scrX2/2)-halfx;

            _mc._y = (scrY2/2)-halfy;

            trace("x "+_mc._x);

             

            // _root.folioholder.imgholder._mc.crossbtn.addEventListener("end",endClip);

            _mc.addEventListener("end", endClip);

            function endClip() {

            trace("in function endclip");

            var j:Number = 1;

            while (j<=23) {

            this._parent.folioholdermc["img"+j]._alpha = 100;               //does not access the button here

            trace("img"+j + " alpha " + this._parent.folioholdermc["img"+j]._alpha);  //says img[j] alpha undefined

            this._parent.folioholdermc["img"+j].enabled = false;

            j++;

            trace("img"+j+" fixed");

            }

            };

            };


            function goWork(_mc:MovieClip) {

            _mc.unloadMovie();

             

            }



            ldrlistener.onLoadProgress = function(_mc:MovieClip, loaded:Number, total:Number) {

            // code here

            };


            loader.loadClip("Portfolio/swfdesc/architecture_1/img1desc.swf",imgholder);



            }

             

            So I know that this._parent.folioholder...path works fine, but only once. I cannot understand what is happening here. Any help will be greatly appreciated.