I believe from the example and the error posted one of the calls to
new in the code below is pointing to a class that has no public
constructor which probably means the wrong class got imported


public function createMarker(latlng:LatLng, name:String,
address:String, type:String): Marker {
  var marker:Marker = new Marker(latlng, new MarkerOptions({icon: new
customIcons[type], iconOffset: new Point(-16, -32)}));
  var html:String = "<b>" + name + "</b> <br/>" + address;
  marker.addEventListener(MapMouseEvent.CLICK,
function(e:MapMouseEvent):void {
    marker.openInfoWindow(new InfoWindowOptions({contentHTML:html}));
  });
  return marker;
}

Basically I know you can create this error by doing the following.

var someObject:Object = {};
var anInstance = new someObject();

TypeError: Error #1007: Instantiation attempted on a non-constructor.
        at MiniTests/application1_creationCompleteHandler()[C:\Users\Shaun
\workspace\MiniTests\src\MiniTests.mxml:12]

because someObject itself is an instance of an object not a class
definition with a constructor, syntactically it's okay because Object
might be a class like this:
var someObject:Object = mx.controls.Button;
var anInstance = new someObject();

This compiles/executes without error.

you can probably comment lines out in that method until you narrow it
down to which new call it is that's causing the error then investigate
everything about that.

Good luck,
Shaun


On Dec 2, 8:58 am, Harry Lai <[email protected]> wrote:
> 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
> &apos;thought bubble&apos;
>  * 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