18 Replies Latest reply on Jun 8, 2011 9:03 PM by kglad

    .setRGB("0x"+msgA[4]);

    Ron Colmen Level 2

      I'm trying to load some data. But it pulls only the one record. Any reason why?

       

       

       

      var xPositionT:Number = 0;

      var yPositionT:Number = 0;

       

      _root.patHolder.attachMovie("Btn4","trafficL_btn"+i,_root.patHolder.getNextHighestDepth()) ;

      _root.patHolder["trafficL_btn"+i]._x = xPositionT;

      _root.patHolder["trafficL_btn"+i]._y = yPositionT;

      yPositionT = yPositionT + 31.0;

       

      var tLights = new

      Color(_root.patHolder["trafficL_btn"+i].Light);

      tLights.setRGB("0x"+msgA[4]);

        • 1. Re: .setRGB("0x"+msgA[4]);
          kglad Adobe Community Professional & MVP

          i don't see anything related to loading data.

          • 2. Re: .setRGB("0x"+msgA[4]);
            Ron Colmen Level 2

            That was only a section of the code.

             

            The trace() shows the results correctly. The btn works perfectly but the trafficL_btn shows up only for the first record.

             

             

            var senderLoad:LoadVars = new LoadVars();

            var receiveLoad:LoadVars = new LoadVars();

            senderLoad.sendAndLoad("http://www.web.com./the.php",receiveLoad,"POST");

            receiveLoad.onData = function(src) {

                 var messageA:Array = src.split(",,,");

            messageA.pop();

             

            var xPosition:Number = 0;

            var yPosition:Number = 0;

            for(var i:Number=0; i<messageA.length; i++){

                       var msgA:Array = messageA[i].split(",,");

               _root.patHolder.attachMovie("Btn1","btn"+i,_root.patHolder.getNextHighestDepth());

             

            _root.patHolder["btn"+i]._x = xPosition;

            _root.patHolder["btn"+i]._y = yPosition;

            yPosition = yPosition + 31.0;

             

            //////////the problem

            var xPositionT:Number = 0;

            var yPositionT:Number = 0;

             

            _root.patHolder.attachMovie("Btn4","trafficL_btn"+i,_root.patHolder.getNextHighestDepth()) ;

            _root.patHolder["trafficL_btn"+i]._x = xPositionT;

            _root.patHolder["trafficL_btn"+i]._y = yPositionT;

            yPositionT = yPositionT + 31.0;

             

            var ["tLights"+i] = new

            Color(_root.patHolder["trafficL_btn"+i].Light);

            ["tLights"+i].setRGB("0x"+msgA[4]);

            }

            }

            • 3. Re: .setRGB("0x"+msgA[4]);
              kglad Adobe Community Professional & MVP

              what trace() function?

               

              the following isn't going to work:

               

              var ["tLights"+i] = new

              Color(_root.patHolder["trafficL_btn"+i].Light);

              ["tLights"+i].setRGB("0x"+msgA[4]);

              }

              }

               

              remove that code and see if that solves your problem.

              1 person found this helpful
              • 4. Re: .setRGB("0x"+msgA[4]);
                Ron Colmen Level 2

                Thanks Kglad. oh! I was tryingout few things... just copied and pasted the code as it was at that very moment. Sorry.

                 

                I mean trace (msgA[2]) & trace (msgA[4])

                 

                msgA[4] calls a hex color. I want to change the color of _root.patHolder["trafficL_btn"+i].Light in each record. _root.patHolder["trafficL_btn"+i].Light showup only in the first record - doesn't show in the remaining records.

                 

                 

                var tLights = new

                Color(_root.patHolder["trafficL_btn"+i].Light);

                tLights.setRGB("0x"+msgA[4]);

                • 5. Re: .setRGB("0x"+msgA[4]);
                  kglad Adobe Community Professional & MVP

                  maybe you're out of depths.  are you using a component?

                   

                  if not, copy and paste the trace() output:

                   

                  var senderLoad:LoadVars = new LoadVars();

                  var receiveLoad:LoadVars = new LoadVars();

                  senderLoad.sendAndLoad("http://www.web.com./the.php",receiveLoad,"POST");

                  receiveLoad.onData = function(src) {

                       var messageA:Array = src.split(",,,");

                  messageA.pop();

                   

                  var xPosition:Number = 0;

                  var yPosition:Number = 0;

                  for(var i:Number=0; i<messageA.length; i++){

                             var msgA:Array = messageA[i].split(",,");

                     _root.patHolder.attachMovie("Btn1","btn"+i,_root.patHolder.getNextHighestDepth());

                   

                  _root.patHolder["btn"+i]._x = xPosition;

                  _root.patHolder["btn"+i]._y = yPosition;

                  yPosition = yPosition + 31.0;

                   

                  //////////the problem

                  var xPositionT:Number = 0;

                  var yPositionT:Number = 0;

                   

                  var mc:MovieClip=_root.patHolder.attachMovie("Btn4","trafficL_btn"+i,_root.patHolder.getNextH ighestDepth());

                  _root.patHolder["trafficL_btn"+i]._x = xPositionT;

                  _root.patHolder["trafficL_btn"+i]._y = yPositionT;

                  yPositionT = yPositionT + 31.0;

                   

                  trace(i+" "+mc+" "+mc._x+","+mc._y+mc.getDepth());

                  }

                  }

                  • 6. Re: .setRGB("0x"+msgA[4]);
                    Ron Colmen Level 2

                    Yes. I'm loading these in to a ScrollPane. How can I overcome this?

                    • 7. Re: .setRGB("0x"+msgA[4]);
                      kglad Adobe Community Professional & MVP

                      manually track depths:

                       

                      var dep:Number=0;

                       

                      whatever.attachMovie("xx",xx",dep++);  // this uses the current dep and increments it ready for use in the next attachMovie() method - or createEmptyMovieclip().

                      • 8. Re: .setRGB("0x"+msgA[4]);
                        Ron Colmen Level 2

                         

                        I'm not too sure if this what you wanted me to check.

                         

                        var xPositionT:Number = 0;

                        var yPositionT:Number = 0;

                         

                        var dep:Number=0;

                         

                        whatever.attachMovie("xx",xx",dep++);

                         

                        trace (dep) //outputs 720

                        _root.patHolder["trafficL_btn"+i]._x = xPositionT;

                        _root.patHolder["trafficL_btn"+i]._y = yPositionT;

                         

                         

                         

                        var xPositionT:Number = 0;

                        var yPositionT:Number = 0;

                        var dep:Number=0;

                        whatever.attachMovie("xx",xx",dep++);

                        trace (dep) //outputs 379

                        _root.patHolder.attachMovie("Btn4","trafficL_btn"+i,_root.patHolder.getNextHighestDepth()) ;

                        _root.patHolder["trafficL_btn"+i]._x = xPositionT;

                        _root.patHolder["trafficL_btn"+i]._y = yPositionT;

                         

                         

                         

                        • 9. Re: .setRGB("0x"+msgA[4]);
                          kglad Adobe Community Professional & MVP

                          use:

                           


                          var dep:Number=0;

                          var senderLoad:LoadVars = new LoadVars();

                          var receiveLoad:LoadVars = new LoadVars();

                          senderLoad.sendAndLoad("http://www.web.com./the.php",receiveLoad,"POST");

                          receiveLoad.onData = function(src) {

                               var messageA:Array = src.split(",,,");

                          messageA.pop();

                           

                          var xPosition:Number = 0;

                          var yPosition:Number = 0;

                          for(var i:Number=0; i<messageA.length; i++){

                                     var msgA:Array = messageA[i].split(",,");

                             _root.patHolder.attachMovie("Btn1","btn"+i,dep++);

                           

                          _root.patHolder["btn"+i]._x = xPosition;

                          _root.patHolder["btn"+i]._y = yPosition;

                          yPosition = yPosition + 31.0;

                           

                          //////////the problem

                          var xPositionT:Number = 0;

                          var yPositionT:Number = 0;

                           

                          var mc:MovieClip=_root.patHolder.attachMovie("Btn4","trafficL_btn"+i,dep++);

                          _root.patHolder["trafficL_btn"+i]._x = xPositionT;

                          _root.patHolder["trafficL_btn"+i]._y = yPositionT;

                          yPositionT = yPositionT + 31.0;

                           

                          trace(i+" "+mc+" "+mc._x+","+mc._y+mc.getDepth());

                          }

                          }

                          1 person found this helpful
                          • 10. Re: .setRGB("0x"+msgA[4]);
                            Ron Colmen Level 2

                            Thanks kglad.

                             

                            378 _level0.sp.spContentHolder.trafficL_btn378 0,00

                            • 11. Re: .setRGB("0x"+msgA[4]);
                              kglad Adobe Community Professional & MVP

                              that's just one of the trace() outputs?  (i hope.)

                              • 12. Re: .setRGB("0x"+msgA[4]);
                                Ron Colmen Level 2

                                yes, that's the final one. it continies from 1.

                                • 13. Re: .setRGB("0x"+msgA[4]);
                                  kglad Adobe Community Professional & MVP

                                  ok.   i'm assuming you want the scrollpane to function like a scrollpane.

                                   

                                  if so, you must assign the contentPath for your scrollpane to start.  that can be a Btn1 instance or, you'll find it easier to use an empty movieclip for that job.  from there you can attach movieclips (using attachMovie() to the scrollpane's spContentHolder.

                                   

                                  in order to see the different Btn4 movieclips, you need to remove that line of code that resets the _y value of your Btn4 instances to zero repeatedly.  and that's the cause of the problem you're seeing.  once you remove that yPositionT=0 line, you'll find your scrollpane isn't working like a scrollpane and that's why you'll need to follow the directions in my 2nd paragraph.

                                   

                                  also, assuming you want each pair of Btn1 and Btn4 movieclips to occupy the same x,y positions, you could just remove the yPositionT variable and xPosition,xPositionT variables because they aren't needed.  just use yPosition for both Btn1 and Btn4 movieclips.

                                  1 person found this helpful
                                  • 14. Re: .setRGB("0x"+msgA[4]);
                                    Ron Colmen Level 2

                                    Thank you for the explanation. I'll be back if I come accross any difficulties.

                                     

                                    for the sp I'm using

                                     

                                    sp.contentPath = "patHolderID";

                                    var patHolder:MovieClip = sp.content;

                                    • 15. Re: .setRGB("0x"+msgA[4]);
                                      kglad Adobe Community Professional & MVP

                                      you're welcome.

                                      • 16. Re: .setRGB("0x"+msgA[4]);
                                        Ron Colmen Level 2

                                        That worked. Just one little issue. The sp shows as below.

                                         

                                        btn41 

                                        btn42   btn21

                                        btn43   btn22

                                        btn44   btn23

                                                  btn24

                                         

                                        why isn't 1, 2, 3, etc... on the same level?

                                        • 17. Re: .setRGB("0x"+msgA[4]);
                                          Ron Colmen Level 2

                                          Got it working!!  Thanks Kglad!

                                          • 18. Re: .setRGB("0x"+msgA[4]);
                                            kglad Adobe Community Professional & MVP

                                            you're welcome.