2 Replies Latest reply on Mar 25, 2010 3:06 PM by Flex harUI

    HTTPService loader data Display Errors

    alice_data Level 1

      Hi,

       

        This is really weird. I have the code here as in the following:

       

      public function changeMap():void{   
            
            
              var from_string:String = from.join("-");   
              var state_colors_string:String = stateColors.join("-");       
              var change_string:String =  drive_time.join("-");       
                          
              var url:String = "http://localhost/generic.php";
              var variables:URLVariables = new URLVariables();
                  variables.from= from_string;
                  variables.state_colors = state_colors_string;
                  variables.state = state;
                  variables.change = change_string;          
              var encode:String= encodeURI(url);
              var pattern:RegExp = /#/g;
              var decode:String = encode.replace(pattern,"%23");
              var request:URLRequest = new URLRequest(decode);           
              request.method = URLRequestMethod.POST;           
              request.data= variables;
                     
              var loader:URLLoader = new URLLoader();      
              loader.addEventListener(Event.COMPLETE, onLoadComplete);   
              loader.load(request);                    
              }      

       

              public function onLoadComplete(event:Event):void {   
                 
                      if(vbox.getChildAt(0).toString() == "main8.vbox.SvgMap5") vbox.removeChild(vbox.getChildAt(0));
                      var ui:UIComponent = new UIComponent();
                         var loader:URLLoader = URLLoader(event.target);  
                               
                      canvas = new Sprite();
                      paths = new SvgPaths(loader.data);                                          
                      paths.drawToGraphics(canvas.graphics, 1, 0, 0);
                      trace(loader.data);        //This displays accurately                         
                      ui.addChild(canvas);      //Add sprite to UI component                 
                      vbox.addChild(ui);          //I see the image, but has no colors unlike the data shown in the trace statement                                      
             
              }         

       

        For some reason, my UI Component gets added correctly, and not only that, the data that outputs the svg via HTTPservice seems to display the accurate data, but yet, my image is not colored, which does not match the data.

       

      Here is a snippet of one of the elements of what I want to display:

       

      <path
      style="font-size:12px;fill:#d0d0d0;fill-rule:nonzero;stroke:#000000;stroke-opacity:1;strok e-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-linecap:butt;marker-start:non e;stroke-linejoin:bevel;fill:rgb(146,148,192)"
      d="M 242.94398,186.824 L 246.13098,186.959 L 251.68798,187.188 L 252.57498,187.229 L 252.34998,192.534 L 252.29198,193.747 L 246.71198,193.498 L 242.51598,193.287 L 242.75498,188.765 L 242.83998,188.762 L 242.94398,186.824"
      id="40007"
      inkscape:label="Beaver, OK" />

       

      Obviously the color is a valid color here in the style attribute, then why I am not seeing any colors?
      Thanks for your help.

       

      Alice