2010-10-31 2 views
1

Je suis en train de créer une petite application cartographique où l'on vous donne des informations, des vidéos et des images concernant différents campus dans une université. J'utilise la méthode customContent pour insérer un objet lecteur vidéo dans infoWindow, mais quand je le fais, il se débarrasse de mon contenu textuel et devient la seule chose visible pour l'utilisateur.Google Maps Flash API Problème de contenu personnalisé

Comment puis-je contourner ce problème et avoir du texte et de la vidéo dans infoWindow?

Demo link

public function createMarker(latlng:LatLng, name:String, address:String, video:String):Marker 
     { 
      var marker:Marker=new Marker(latlng); 

      marker.addEventListener(MapMouseEvent.CLICK, function(e:MapMouseEvent):void 
      { 
       //marker.openInfoWindow(new InfoWindowOptions({contentHTML:html + moulVid})); 
       var infoWindow:InfoWindowOptions = new InfoWindowOptions(); 

       infoWindow.title = name; 
       var videoPlayer:VideoPlayer = new VideoPlayer(); 
       videoPlayer.source = '../assets/video/' + video.toLocaleLowerCase(); 
       videoPlayer.autoPlay = false; 
       videoPlayer.alpha = 0.8; 

       titleFormat = new TextFormat(); 
       titleFormat.font = "Arial"; 
       titleFormat.size = 14; 
       titleFormat.bold = true; 

       contentFormat = new TextFormat(); 
       contentFormat.font = "Arial"; 
       contentFormat.size = 12; 

       infoWindow.drawDefaultFrame = true; 
       infoWindow.titleFormat = titleFormat; 

       if (video != "") { 
        infoWindow.customContent = videoPlayer; 
        infoWindow.height = 300; 
       } 

       infoWindow.width = 380; 

       infoWindow.content = address; 
       infoWindow.contentFormat = contentFormat; 

       infoWindow.padding = 10; 

       marker.openInfoWindow(infoWindow); 
      }); 

Répondre

2

Vous devez créer un nouvel objet, appelé comme VideoAndTextInfoWindow, en font étendre DisplayObject. Maintenant, dans le constructeur de ce composant, créez et ajoutez un VideoPlayer et un TextField. Ce composant peut exposer publiquement une vidéoSource et une propriété de texte. Créez des paramètres pour ces propriétés afin qu'ils définissent les propriétés correctes sur les instances VideoPlayer et TextField. Maintenant, définissez infoWindow.customContent sur une nouvelle instance de votre composant VideoAndTextInfoWindow.

+0

Merci beaucoup. Cela a résolu mon problème – XGreen