Select to view content in your preferred language

Show youtube Video in Infowindow using info window

589
1
02-22-2012 01:22 AM
shafitrumboo
Occasional Contributor
I have declared a control containing you tube player that is shown as info window as follows.

    <fx:Component className="YouTube_InfoWindowRenderer">
            <mx:VBox verticalGap="0" autoLayout="true">
                <media:YouTubePlayer id="youTubePlayer" videoID="{data.videoID}" quality1="medium" aspectRatio="widescreen" />
                <!--<mx:Label text="Published: {data.published}" paddingTop="0" paddingBottom="0" horizontalCenter="0" />-->
            </mx:VBox>
        </fx:Component>

On click of the graphics i have created the object of YouTube_InfoWindowRenderer and assign the attribute property. Can you tell me is this correct way the code line below and also same is highlighted in red.
Because every time i see this videoID is blank.

map.infoWindow.data        = graphic.attributes;       

protected function graphic1_clickHandler(event:MouseEvent):void
            {
                // TODO Auto-generated method stub
                var infoWindowContent:DisplayObject;
                var infoWindowRenderer:ClassFactory;
               
                if (event.currentTarget != null)
                {
                    var recreate:Boolean = true;
                     map.infoWindow.hide();
                    var graphic:Graphic = Graphic(event.currentTarget);   
                    var infoclickGraphic:Graphic;
                    infoWindowRenderer = new ClassFactory(YouTube_InfoWindowRenderer);
                    infoWindowContent = infoWindowRenderer.newInstance();
                    map.infoWindow.content    = infoWindowContent as UIComponent;                   
                    map.infoWindow.label         = graphic.attributes.title;
                    map.infoWindow.data        = graphic.attributes;               
                    map.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));
                }                
            }
Tags (2)
0 Kudos
1 Reply
PremRadhakrishnan
Regular Contributor
This should be correct. What are your attribute values ? This question was answered in a previous post I believe and the videoId property of the youTube component should be the unique value assigned by YouTube for example for the Mass Effect 3 trailer http://www.youtube.com/watch?v=Vs7kix6_8Ks  the videoId will be  "Vs7kix6_8Ks" . According to your code the graphic should have an attribute called videoId corresponding to the id assigned by Youtube. If not then data.videoId will be null and the player will not play anything.
0 Kudos