I couldn't see any issue with the URLLoader from the component.
(http://gmaps-samples-flash.googlecode.com/svn/trunk/demos/
InfoWindowDBSaver/srcview/index.html)

Any quick pointer to fix it? Thanks for helping.


/*
* Copyright 2008 Google Inc.
* Licensed under the Apache License, Version 2.0:
*  http://www.apache.org/licenses/LICENSE-2.0
*/
package {

import com.google.maps.overlays.Marker;

import flash.events.MouseEvent;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;

import mx.collections.ArrayCollection;
import mx.containers.Box;
import mx.containers.HBox;
import mx.controls.Alert;
import mx.controls.Button;
import mx.controls.ComboBox;
import mx.controls.Label;
import mx.controls.TextInput;
import mx.core.UIComponent;

/**
 * InfoWindowSprite consists of several ellipses arranged in a
'thought bubble'
 * manner, the largest of which contains an embedded image and a
circular
 * close button.
 * It can dispatch an Event instance (type: "close"), which the user
can listen
 * for and use to call map.closeInfoWindow();
 */
public class InfoWindowTabbedComponent extends UIComponent {

  public var textInputName:TextInput;
  public var comboBoxType:ComboBox;
  public var marker:Marker;

  public function InfoWindowTabbedComponent(m:Marker) {
      marker = m;

      var panel:Box = new Box();
      panel.width = 290;
      panel.height = 100;

      var hbox:HBox = new HBox();
      var labelName:Label = new Label();
      labelName.text = "Name: ";
      labelName.width = 70;
      textInputName = new TextInput();
      textInputName.id = "name";
      textInputName.percentWidth = 100;
      textInputName.text = "bla bla";

      hbox.addChild(labelName);
      hbox.addChild(textInputName);

      var hbox2:HBox = new HBox();
      var labelType:Label = new Label();
      labelType.text = "Type: ";
      labelType.width = 70;
      comboBoxType = new ComboBox();
      comboBoxType.id = "type";
      comboBoxType.dataProvider = new ArrayCollection(
                [ {label:"bar", data:"bar"},
                  {label:"restaurant", data:"restaurant"}]);
      hbox2.addChild(labelType);
      hbox2.addChild(comboBoxType);

      var button:Button = new Button();
      button.label = "Submit";
      button.addEventListener(MouseEvent.CLICK,
function(e:MouseEvent):void {
      saveData();
      });

      panel.addChild(hbox);
      panel.addChild(hbox2);
      panel.addChild(button);
      addChild(panel);

  }

  public function saveData():void {
    var name:String = textInputName.text;
    var type:String = comboBoxType.text;
    var lat:Number = marker.getLatLng().lat();
    var lng:Number = marker.getLatLng().lng();
    var urlRequest:URLRequest = new URLRequest("http://imagine-it.org/
mashplanet/phpsqlflex_addrow.php");
    urlRequest.data = "name=" + name + "&type=" + type + "&lat=" + lat
+ "&lng=" + lng;
    urlRequest.method = URLRequestMethod.POST;
    var urlLoader:URLLoader = new URLLoader(urlRequest);
    urlLoader.addEventListener("complete", function(e:Event):void {
       if (urlLoader.data.length <= 1) {
         Alert.show("Successfully added!");
         marker.closeInfoWindow();
       } else {
            Alert.show("There was an error adding the data :(");
       }
    });
  }


}

}





On Dec 1, 9:20 pm, Daniel <[email protected]> wrote:
> Sounds like it is creating a new instance of an object that is a static
> class.
> On Dec 1, 2010 5:33 PM, "Harry Lai" <[email protected]> wrote:> This nice 
> tutorial seems to have an issue. Anybody knows what might
> > caused this issue? Really wanted to see a working version. Thanks!!!
> >http://code.google.com/apis/maps/articles/phpsqlflex.html
>
> > TypeError: Error #1007: Instantiation attempted on a non-constructor.
> > at XmlParsingDemo/createMarker()
> > at XmlParsingDemo/readXml()
> > at flash.events::EventDispatcher/dispatchEventFunction()
> > at flash.events::EventDispatcher/dispatchEvent()
> > at flash.net::URLLoader/onComplete()
>
> > --
> > You received this message because you are subscribed to the Google Groups
>
> "Google Maps API For Flash" group.> To post to this group, send email to
>
> [email protected].> To unsubscribe from this group, 
> send email to
>
> [email protected]<google-maps-api-for-­flash%[email protected]>
> .> For more options, visit this group at
>
> http://groups.google.com/group/google-maps-api-for-flash?hl=en.
>
>
>
> - Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en.

Reply via email to