You might have to take a look to the documentation pointed by
Jonathan.
Also, check Adobe Livedocs on text formatting:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextFormat.html
function createMarker(latlng:LatLng, number:Number, tip,
myTitle,myContent):Marker {
// it's best to define this formatting objects elsewhere, for
reusability
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = "Verdana";
myTextFormat.italic = true;
// ditto with InfowindowOptions
var myInfoWindowOptions:InfoWindowOptions = new InfoWindowOptions({
fillStyle: {color: 0xFFFFFF,alpha: 0.9}
});
// it's also a good idea to use descriptive names for variables, using
short variable names like "i" can hit you later, trust me
var myMarker:Marker = new Marker(
latlng, new MarkerOptions({hasShadow: true, tooltip: ""+tip})
);
myMarker.addEventListener(MapMouseEvent.CLICK, function
(event:MapMouseEvent):void
{
map.openInfoWindow(event.latLng, ,
titleFormat: myTextFormat,
myInfoWindowOptionswidth: 500,
height: 400,
titleHTML: ""+myTitle,
contentHTML: ""+myContent
}));
});
return myMarker;
}// end function createMarker
On 8 ene, 12:11, Alison <[email protected]> wrote:
> How weird... my actionscript in Flash doesn't actually have the
> semicolons at the end of each line... something funky must have
> happened when I copied and pasted it here. Thanks for the tip though.
>
> I'm still struggling with changing the font. Below is the createMarker
> function portion of my code. Is my titleFormat code in the right
> place? I think that is what's throwing it off.
>
> function createMarker(latlng:LatLng, number:Number, tip, myTitle,
> myContent):Marker {
> var i:Marker = new Marker(
> latlng,
> new MarkerOptions({
> hasShadow: true,
> tooltip: ""+tip
> })
> );
> i.addEventListener(MapMouseEvent.CLICK, function
> (event:MapMouseEvent):void
> {
>
> map.openInfoWindow(event.latLng, new InfoWindowOptions({
> fillStyle: {
> color:
> "FFFFFF",
> alpha: 90
> },
> titleFormat: {
> font:
> ("Verdana"),
> fontstyle:
> ("italic")
> },
> width: 500,
> height: 400,
> titleHTML:
> ""+myTitle,
> contentHTML:
> ""+myContent
> }));
>
> });
> return i;
> }// end function createMarker
>
> On Jan 8, 12:24 am, Jonathan Wagner <[email protected]> wrote:
>
> > Hey Alison,
>
> > Ya I remember going from AS 2.0 to 3.0 :\ Well first thing, the ; is
> > used to denote the end of a statement (or action), you don't need to
> > put it at the end of every line, in fact this will make thinks not
> > work. A lot of coders put it at the end of each line, but it's not
> > strictly necessary, although it is good practice. Let me give a really
> > quick example say in my code I have the line
>
> > var a:int = 0 var b:int = 1
>
> > this will actually deliver an error, however
>
> > var a:int = 0; var b:int = 1
>
> > would not because the ; explains that it is two separate actions. The
> > { } actually designate objects, and are actually single entities, but
> > people, and fancy Google programmers break it up so it easier to read.
> > For the formatting take a look at this:
>
> >http://code.google.com/apis/maps/documentation/flash/reference.html#I...
>
> > Good Luck,
>
> > Jonathan
> > Scribblemaps.com
>
> > On Jan 7, 5:48 pm, Alison <[email protected]> wrote:
>
> > > Hi all,
>
> > > First off, I'm new to both AS 3.0 and Google maps API so it's safe to
> > > assume I don't know much! (Up until now I've been using AS 2.0.)
>
> > > I am trying to figure out how to change the font (size, color, font)
> > > of the title and description of an infowindow.
>
> > > My infowindows are called up from an xml file (like in this
> > > tutorialhttp://active.tutsplus.com/tutorials/xml/implement-a-map-using-the-go...)
> > > so i can't figure out how the code demos and examples that pamela and
> > > others have previously posted here would work with my project.
>
> > > I figured out how to change the fill style, and figured maybe font
> > > would be done similarly, so below is what I tried. The actionscript
> > > reported no errors, but it didn't change the font. It's probably
> > > something really easy, but any help would be appreciated! Thanks!
>
> > > // Add Markers On The Map
> > > function createMarker(latlng:LatLng, number:Number, tip,
> > > myTitle,
> > > myContent):Marker {
> > > var i:Marker = new Marker(
> > > latlng,
> > > new MarkerOptions({
>
> > > hasShadow: true,
> > >
> > > tooltip: ""+tip
> > >
> > > })
> > > );
> > > i.addEventListener(MapMouseEvent.CLICK, function
> > > (event:MapMouseEvent):void ;
> > > {
> > > map.openInfoWindow(event.latLng, new
> > > InfoWindowOptions({;
> > > fillStyle: {;
> > > color: 333333,;
> > > alpha: 90;
> > > },;
> > > titleFormat: {;
> > > font: ("Verdana"),;
> > > fontstyle: ("italic");
> > > },;
> > > width: 500,;
> > > height: 400,;
> > > titleHTML: ""+myTitle, ;
> > > contentHTML: ""+myContent;
> > > }));
>
> > > });
> > > return i;
> > > }// end function createMarker
> > > }// end of loadXML function
>
> > > var xmlLoader:URLLoader = new URLLoader();
> > > xmlLoader.addEventListener(Event.COMPLETE, loadXML);
> > > xmlLoader.load(new URLRequest("xml.xml"));
> > > }
--
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.