3 Replies Latest reply on Jun 14, 2010 5:00 AM by Sudheendra Sathavalli

    Error in the following code

    folio1

      Hi

       

      If anyone can let me know why there is a problem with the following code. I get the following errors:

      ')' or ',' expected

        • 1. Re: Error in the following code
          Petro O. Bochan Level 3

          Do u mind posting the code or at least the line an error occurred at?

          • 2. Re: Error in the following code
            folio1 Level 1

            Sorry I did add in but it did not post....Anyway code below the erroe line are in bold. Line: 22,23 & 24.

             


            function scaleMovieClip(movieclip, seconds, startAtX, endAtX, startAtY, endAtY, trans)
            {
                new mx.transitions.Tween(movieclip, "_yscale", trans, startAtY, endAtY, seconds, true);
                var _loc2 = new mx.transitions.Tween(movieclip, "_xscale", trans, startAtX, endAtX, seconds, true);
            } // End of the function
            function setPage()
            {
                btnN = ["b" + prod];
                page = btnN;
                pageT.text = page;
                ptest.text = mypage;
                var mcTween = new mx.transitions.Tween(main, "_alpha", mx.transitions.easing.Strong.easeOut, 100, 0, 1.000000E-001, true);
                mcTween.onMotionFinished = function (ev)
                {
                    main.gotoAndStop(page);
                    var _loc1 = new mx.transitions.Tween(main, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 3, true);
                };
                for (i = 0; i < prodArray.length; i++)
                {
                    bNum = i + 1;
                   eval("["b" + bNum]")._xscale = 100;
                    eval("["b" + bNum]")._yscale = 100;
                    eval("["b" + bNum]").enabled = true;

                } // end of for
                eval("[page]").swapDepths(_root.getNextHighestDepth());
                quote1.removeMovieClip();
                eval("[page]").enabled = false;
                eval("[page]")._xscale = 120;
                eval("[page]")._yscale = 120;
            } // End of the function
            stop();
            prodArray = new Array("CFL Change-Over", "Showerheads", "Insulation", "Solar PV", "Solar Hot Water", "Tank to Toilet", "Heat Pumps", "Misc Hot Water");
            b1.onRollOver = b2.onRollOver = b3.onRollOver = b4.onRollOver = b5.onRollOver = b6.onRollOver = b7.onRollOver = b8.onRollOver = function ()
            {
                scaleMovieClip(this, 1, 100, 120, 100, 120, mx.transitions.easing.Strong.easeOut);
                attachMovie("quote", "quote1", _root.getNextHighestDepth());
                quote1._x = -300;
                quote1._x = _xmouse + 10;
                quote1._y = _ymouse + 35;
                trace (_xmouse);
                if (_xmouse <= 130)
                {
                    quote1.gotoAndStop(2);
                    quote1._x = _xmouse;
                    quote1._y = _ymouse + 35;
                } // end if
                if (_xmouse >= 790)
                {
                    quote1.gotoAndStop(3);
                    quote1._x = _xmouse + 10;
                    quote1._y = _ymouse + 35;
                } // end if
                quote1.startDrag(lockcenter);
                btnN = this._name;
                item = btnN.substr(btnN.length - 1, btnN.length) - 1;
                myMsg = prodArray[item];
                quote1.msg = myMsg;
            };
            b1.onRollOut = b2.onRollOut = b3.onRollOut = b4.onRollOut = b5.onRollOut = b6.onRollOut = b7.onRollOut = b8.onRollOut = function ()
            {
                scaleMovieClip(this, 1, 120, 100, 120, 100, mx.transitions.easing.Strong.easeOut);
                quote1.removeMovieClip();
            };
            b1.onRelease = b2.onRelease = b3.onRelease = b4.onRelease = b5.onRelease = b6.onRelease = b7.onRelease = b8.onRelease = function ()
            {
                btnN = this._name;
                item = btnN.substr(btnN.length - 1, btnN.length) - 1;
                page = btnN;
                var mcTween = new mx.transitions.Tween(main, "_alpha", mx.transitions.easing.Strong.easeOut, 100, 0, 1.000000E-001, true);
                mcTween.onMotionFinished = function (ev)
                {
                    main.gotoAndStop(page);
                    var _loc1 = new mx.transitions.Tween(main, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 3, true);
                };
                for (i = 0; i < prodArray.length; i++)
                {
                    bNum = i + 1;
                    eval("["b" + bNum]")._xscale = 100;
                    eval("["b" + bNum]")._yscale = 100;
                    eval("["b" + bNum]").enabled = true;
                } // end of for
                this.swapDepths(_root.getNextHighestDepth());
                quote1.removeMovieClip();
                this.enabled = false;
                this._xscale = 120;
                this._yscale = 120;
            };
            if (prod != "" || prod != null)
            {
                prodTxt.text = prod;
                setPage();
            } // end if

            • 3. Re: Error in the following code
              Sudheendra Sathavalli Level 1

              I think error is because Eval always expects the expression in it should be String , where as in usage of Eval in the code at lines 22 ,23 and 24 b is not recognized as string.

              if you r trying to access any object with instance name like b ,b1 ,b2 etc using eval the code should be

              eval("b" + bNum)._xscale = 100;

              eval("b" + bNum)._yscale = 100;

              eval("b" + bNum).enabled = true; where bNum is a variable of data type int