Hi there-
You can delete InfoWindowSprite.as, and just have the following in
your main MXML:
var marker2:Marker = new Marker(new LatLng(28,-92), new
MarkerOptions({label: "2"}));
var options2:InfoWindowOptions = new InfoWindowOptions({
customContent: new InfoWindowBodySprite(),
customOffset: new Point(0, 10),
height: 100,
drawDefaultFrame: true
});
marker2.addEventListener(MapMouseEvent.CLICK,
function(e:Event):void {
marker2.openInfoWindow(options2);
});
this.map.addOverlay(marker2);
That creates an InfoWindowOptions object with the customContent set to
use the InfoWindowBodySprite class, and then uses that when a marker's
infowindow is opened.
- pamela
On Sat, Jan 31, 2009 at 4:42 AM, WikiFlex_Newbie <[email protected]> wrote:
>
> Thanks for the response Pamela.
>
> Ok I modified my InfoWindowBodySprite class with the code provided by
> you. Here is my source code below for the InfoWindowBodySprite class.
> What other things/code do I have left for the InfoWindowSprite.as,
> InfoWindowBodySprite.as, and the CustomInfoWindowStyledDemo.mxml so
> the link and text will appear in the infowindow (keep in mind Im a
> newbie). Note: I havent added any code to InfoWindowSprite.as, and
> CustomInfoWindowStyledDemo.mxml
>
> package {
>
> import flash.display.Sprite;
> import flash.events.Event;
> import flash.events.MouseEvent;
> import flash.text.TextField;
> import flash.text.TextFormat;
> import mx.managers.CursorManager;
> import mx.controls.LinkButton;
> import flash.net.URLRequest;
> import flash.net.navigateToURL;
>
> public class InfoWindowBodySprite extends Sprite {
> [Embed(source="secretagent.ttf",fontFamily="SecretAgent")]
> public var SecretAgentFont:Class;
>
> public function InfoWindowBodySprite() {
> height = 100;
>
>
> var clickMore:LinkButton = new LinkButton();
> clickMore.percentWidth = 100;
> clickMore.label = "Google";
> clickMore.addEventListener(MouseEvent.CLICK, function
> (e:MouseEvent):void {
> var request:URLRequest = new URLRequest("http://
> www.google.com");
> navigateToURL(request, "_blank");
> });
> addChild(clickMore);
>
> var bodyTextFormat:TextFormat = new TextFormat();
> bodyTextFormat.font = "SecretAgent";
> bodyTextFormat.color = 0xFF0000;
> bodyTextFormat.size = 30;
> bodyTextFormat.align = "center";
>
>
> var bodyTextField:TextField = new TextField();
> bodyTextField.x = -70;
> bodyTextField.y = -80;
> bodyTextField.width = 150;
> bodyTextField.height = 100;
> bodyTextField.text = "Hello!";
> bodyTextField.embedFonts = true;
> bodyTextField.selectable = false;
> bodyTextField.setTextFormat(bodyTextFormat);
> addChild(bodyTextField);
>
> cacheAsBitmap = true;
> }
> }
>
> }
>
>
>
>
> On Jan 29, 8:32 pm, pamela fox <[email protected]> wrote:
>> Hi WikiFlex-
>>
>> I would suggest using customContent for your info windows, modifying
>> the InfoWindowBodySprite class used
>> here:http://gmaps-samples-flash.googlecode.com/svn/trunk/demos/CustomInfoW...
>>
>> Then you can put code like the following in your body:
>>
>> var clickMore:LinkButton = new LinkButton();
>> clickMore.percentWidth = 100;
>> clickMore.label = "Google";
>> clickMore.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
>> var request:URLRequest = new URLRequest("http://www.google.com");
>> navigateToURL(request, "_blank");
>> });
>> addChild(clickMore);
>>
>> - pamela
>>
>>
>>
>> On Thu, Jan 29, 2009 at 4:57 AM, WikiFlex_Newbie <[email protected]> wrote:
>>
>> > Hi everyone this is my first post! I just have a question regarding
>> > info windows and linking to urls. Im using the Toggling Marker
>> > Categories example located at "http://gmaps-samples-
>> > flash.googlecode.com/svn/trunk/demos/MarkerCategoriesDemo/srcview/
>> > index.html".
>>
>> > How would I go about setting up a website link within a info window.
>> > For example, lets say I click on the marker for The Melting Pot. This
>> > brings up the info window which includes the address for The Melting
>> > Pot along with a website link for Melting Pot. So by clicking on the
>> > website link within the info window, a new web browser would open up
>> > and display a website.- 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
-~----------~----~----~----~------~----~------~--~---