Hi Phoenix, I think I haven't explained very well.
Then here we go:
My program is very simple: A map with a marker, this marker has a
custom InfoWindow with a VideoDisplay object inside.
I have 2 files, main.mxml and InfoWindowTabbedComponent.as
InfoWindowTabbedComponent.as is a class which defines the structure of
my infowindow, and inside InfoWindowTabbedComponent.as I create the
VideoDisplay() object.
At main.mxml I simply create a map, and a marker with a custom
infowindow.
Then here is the code of the 2 files, very simplified:
------------------------------------
Main.mxml
---------------------------------------------------------
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
xmlns:maps="com.google.maps.*" layout="absolute" width="100%"
height="100%" viewSourceURL="srcview/index.html">
  <mx:Panel title="Google Maps API for Flash Demo" width="100%"
height="100%">
  <maps:Map  id="map"
key="ABQIAAAA7QUChpcnvnmXxsjC7s1fCxQGj0PqsCtxKvarsoS-
iqLdqZSKfxTd7Xf-2rEc_PC9o8IsJde80Wnj4g" mapevent_mapready="onMapReady
(event)"   width="100%" height="100%"/>
   </mx:Panel>

   <mx:Script>
       <![CDATA[

        import mx.controls.VideoDisplay;
       import com.google.maps.InfoWindowOptions;
       import com.google.maps.overlays.MarkerOptions;
       import com.google.maps.LatLng;
       import com.google.maps.MapEvent;
       import com.google.maps.overlays.Marker;
       import com.google.maps.MapMouseEvent;
       import com.google.maps.Map;
       import com.google.maps.controls.ZoomControl;

       private function onMapReady(event:Event):void
       {
           this.map.setCenter(new LatLng(29, -90), 6);

            // Create a marker with an info window whose body is
customized

            var marker2:Marker = new Marker(new LatLng(28,-92), new
MarkerOptions({label: "2"}));

           var options2:InfoWindowOptions = new InfoWindowOptions({
                customContent:new InfoWindowTabbedComponent(),
                customOffset: new Point(0, 10),
                width: 400,
                height: 400,
                drawDefaultFrame: true
            });
            marker2.addEventListener(MapMouseEvent.CLICK, function
(e:Event):void {
                marker2.openInfoWindow(options2);
            });
             map.addEventListener(MapEvent.INFOWINDOW_CLOSED,function
(e:MapEvent):void {
                 // I THINK HERE IS WHERE I HAVE TO stop VideoDisplay
Object, but I don't know how to reference VideoDisplay object form
here, because I have   created it inside customContent:new
InfoWindowTabbedComponent(), and I don't know how to access it.
             });
            map.addOverlay(marker2);

       }
       ]]>
   </mx:Script>
</mx:Application>
------------------------------------------------------------
InfoWindowTabbedComponent.as
--------------------------------------------------------
package {

import mx.containers.Canvas;
import mx.controls.VideoDisplay;
import mx.core.UIComponent;

public class InfoWindowTabbedComponent extends UIComponent {

  public function InfoWindowTabbedComponent() {
    var c:Canvas=new Canvas();
         c.width=300;
         c.height=300;
     var v:VideoDisplay=new VideoDisplay();
          v.source="http://localhost/PFC/timelapse.flv";;
          v.height=200;
          v.width=200;
    c.addChild(v);
    addChild(c);
   }
}

}
------------------------------------------------------------------------------

I hope that wth these examples my question be more clear.
Notice that the VideoDisplay doesn't have Play or Stop button.., I
have made the program so simple because my unique problem is how to
stop the videodisplay if the user close the InfoWindow without
pressing stop button...

Thanks so much by your time.
Regards.

On May 27, 9:55 am, phoenix-slk <[email protected]> wrote:
> Hi javier,
> In first, excuse me if i don't help you but i don't know your skill
> level and i don't understand your problem was to target the video
> component cause you wrote :
> "I doesnt' know how to detect  with an eventListener if the user close
> the infowindow "
>
> If you don't know how to target the video, the most easy way is to use
> a variable "refVideo" at the same level of the code handle the
> INFOWINDOW_CLOSING event.
> When your video starts you have to store the target of it in refVideo
> And use a try catch block  in the INFOWINDOW_CLOSING handler, to stop
> your video by targeting the "refVideo" variable.
>
> I hope this can give you the way.
>
> Regards
>
> On 26 mai, 19:56, Javier <[email protected]> wrote:
>
> > Hi
> > I know that the trick is listening these events, but how can I stop
> > the VideoDisplay object?.  I create this object inside the
> > InfoWindowCustom class, then how I can access to this object at the
> > main.mxml outside of InfoWindowCustom.as?
> > Thanks.
> > On May 26, 3:23 pm, phoenix-slk <[email protected]> wrote:
>
> > > HI,
> > > you have to listen to the INFOWINDOW_CLOSING event
>
> > > look at the MapEvent class
> > > MapEvent.INFOWINDOW_CLOSING
> > > or MapEvent.INFOWINDOW_CLOSED
>
> > >  map.addEventListener(MapEvent.INFOWINDOW_CLOSING, IW_Closing)
>
> > > On 25 mai, 15:02, Javier <[email protected]> wrote:
>
> > > > Hi, I had a problem with the video in my InfoWindow. I have a PLAY /
> > > > STOP button, but If the user clicks and opens other Infowindow or
> > > > close the InfoWindow wihout stopping the video it goes playing at
> > > > bakckground.
>
> > > > My infowindow is an InfoWindowTabbedComponent with 3 tabs:
> > > > "information", "images", "video"
>
> > > > I doesnt' know how to detect  with an eventListener if the user close
> > > > the infowindow or opens a new infowindow, (with the structure of my
> > > > program)and execute VideoDisplay.stop().
>
> > > > The structure of my InfoWindow CustomContent:
>
> > > > public function InfoWindowCustomContent(parameters) {
> > > >     var tabNavigator:TabNavigator = new TabNavigator();
> > > >           tabNavigator.addChild(createTab("Information", arguments ));
> > > >           tabNavigator.addChild(createTab("Images", arguments ));
> > > >           tabNavigator.addChild(createTab("Video", arguments ));
> > > >     addChild(tabNavigator);
>
> > > > }
>
> > > > public function createTab(label:String,arguments):Tile{
>
> > > >      var container:Tile = new Tile() ;
> > > >      if (label == "Information")
> > > >          //Add some text to the container
> > > >         container.addChild (the information)
> > > >       if (label  == "Images")
> > > >        //Add an image gallery to the container
> > > >                container.addChild (an image gallery)
> > > >       if (label  == "Video"){
> > > >             var Video:VideoDisplayComponent = new VideoDisplayComponent
> > > > ();
> > > >                     container.addChild (Video);
>
> > > >    return container;
>
> > > > }
>
> > > > And VideoDisplayComponent is a simple component based on Canvas with a
> > > > VideoDisplay inside and a Play/Stop button.
>
> > > > Anybody has a solution?
> > > > Thanks!
--~--~---------~--~----~------------~-------~--~----~
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