12 Replies Latest reply on Jun 30, 2007 10:17 AM by Greg Dove

    Formating

    Sarawinder Level 1
      I am sending the x,y values of the points where I click mouse I want to send them to php in the format like x,y|x1,y1|x2,y2
      but I am getting the output like x|y|x1|y1

      I am **** it like(where lineat is the array)

        • 1. Re: Formating
          Greg Dove Level 4
          try:

          lineat.push([_xmouse, _ymouse]);
          • 2. Re: Formating
            kglad Adobe Community Professional & MVP
            :

            • 3. Re: Formating
              kglad Adobe Community Professional & MVP
              she probably won't want to push an array because the php file is probably expecting lineat to be a string (in which case she'll need to use):

              lineat.join("");
              • 4. Formating
                Greg Dove Level 4
                @kglad this is a string:

                lvOut.lineat= lineat.join("|");

                (the join character only works with the top level array elements... an array inside an element is joined with a comma - you don't get a choice)
                • 5. Re: Formating
                  Sarawinder Level 1
                  Thanks guys I am still getting the same output. My be its because of the way I am using it in my code

                  this.onMouseDown=function(){
                  if(!mouseDownCount){
                  mouseDownCount=1;
                  } else {
                  mouseDownCount++;
                  }
                  if(Number(iTF)>mouseDownCount){
                  selectedColor._x=_root._xmouse;
                  selectedColor._y=_root._ymouse-20; // you'll need to adjust this when the mousedown is near the stage top
                  myNewColor = "0x" + myBitmapData.getPixel(_xmouse,_ymouse).toString(16);
                  lineat.push(_xmouse, _ymouse,"|");
                  //lvOut.lineat= lineat.join("|");
                  trace(lineat);
                  //sendvalue();
                  newColor.setRGB(myNewColor);
                  selectedColor.colorValue.text = myNewColor;

                  }
                  if(Number(iTF)==mouseDownCount){
                  sendvalue();
                  }
                  }

                  }
                  function sendvalue(){

                  lvOut.send( " http://localhost:8080/dogyears.php","blank");
                  }
                  • 6. Re: Formating
                    Greg Dove Level 4
                    Give it a try like this:

                    this.onMouseDown=function(){
                    if(!mouseDownCount){
                    mouseDownCount=1;
                    } else {
                    mouseDownCount++;
                    }
                    if(Number(iTF)>mouseDownCount){
                    selectedColor._x=_root._xmouse;
                    selectedColor._y=_root._ymouse-20; // you'll need to adjust this when the mousedown is near the stage top
                    myNewColor = "0x" + myBitmapData.getPixel(_xmouse,_ymouse).toString(16);
                    lineat.push([_xmouse, _ymouse]);
                    lvOut.lineat= lineat.join("|");
                    trace(lvOut.lineat);
                    //sendvalue();
                    newColor.setRGB(myNewColor);
                    selectedColor.colorValue.text = myNewColor;

                    }
                    if(Number(iTF)==mouseDownCount){
                    sendvalue();
                    }
                    }

                    }
                    function sendvalue(){

                    lvOut.send( " http://localhost:8080/dogyears.php","blank");
                    }
                    • 7. Re: Formating
                      Sarawinder Level 1
                      Thanks GWD it works perfectly fine. with [ ] thing
                      • 8. Re: Formating
                        Greg Dove Level 4
                        I think its the first time in around 6 months I knew something that kglad didn't! Most of the time I read his posts to learn new stuff.
                        @kglad... I know where you were going with what you were doing, but I've been using a lot of array joins recently so had this fresh in my mind.
                        • 9. Re: Formating
                          Sarawinder Level 1
                          Yeah , i was thinking the same. He is the guru around here with 25k posts and everything he has ever told me is spot on.
                          Thanks agian both u guys. GWD and Kglad.
                          • 10. Re: Formating
                            Greg Dove Level 4
                            cheers, you're welcome.
                            • 11. Re: Formating
                              kglad Adobe Community Professional & MVP
                              glad you got this straightened out despite my (non)help.
                              • 12. Re: Formating
                                Greg Dove Level 4
                                @kglad... it wasn't non-help... you were just going to do it a different way.

                                I was curious to see which would be faster - not that its important here - I wondered afterwards whether the overhead of creating new arrays might be greater than pushing additional, less complex, elements. I actually thought my way might be slower (and perhaps it is if its tested properly - I guess this is not a real test) but it appeared to be marginally faster.