Comunidad de diseño web y desarrollo en internet online

google maps web flash

Citar            
MensajeEscrito el 20 Mar 2013 04:51 am
Hola, a ver si me pueden dar una mano.
hice una web en flash con as3 que tiene 4 secciones : inicio, servicios , contacto y descargas.
En la parte de contacto le agregue un google map que encontre en un post del foro, la web va bien al abrirla, al ir a la seccion Contacto ,se carga el mapa perfectamente pero cuando salgo de ahi y voy a cualquier otra seccion de la web se sigue cargado el mapa, es decir no se borra y se queda ensima del contenido de las demas secciones.

Codigo as3 :
//IMPORTAR LAS CLASES NECESARIAS
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.controls.*;
import com.google.maps.LatLng;
import com.google.maps.overlays.*;
import com.google.maps.MapMouseEvent;
import com.google.maps.InfoWindowOptions;

//DEFINE ANCHO Y ALTO DE LA PELICULA
var ANCHO:int = stage.stageWidth;
var ALTO:int = stage.stageHeight;

//CREA EL MAPA
var map:Map = new Map();

//SE CREA UNA VARIABLE TIPO MARKER PARA LOS MARCADORES
var marker:Marker;

//LA GOOGLE API KEY(LA DA GOOGLE)
map.key = "Mi apy key";
map.x = 0
map.y = 260
//ANCHO Y ALTO DEL MAPA = A LOS DE LA PELI
map.setSize(new Point(500, 260));

//DETECTAR SI EL MAPA YA CARGO
map.addEventListener(MapEvent.MAP_READY, onMapReady);

//SE CARGA EL MAPA PARA LA VISUALIZACION
this.addChild(map);

//SE DEFINE EL CAMPO DE TEXTO Y SUS ATRIBUTOS PARA LAS COORDENADAS DEL CENTRO
var texto:TextField = new TextField();
var formatoTexto:TextFormat = new TextFormat();
this.addChild(texto);
formatoTexto.font = "arial";
formatoTexto.size = 12;
formatoTexto.align = TextFormatAlign.LEFT;
formatoTexto.bold = true;
texto.multiline = true;
texto.background = true;
texto.autoSize = TextFieldAutoSize.LEFT;
texto.defaultTextFormat = formatoTexto;

//SE DEFINE EL CAMPO DE TEXTO Y SUS ATRIBUTOS PARA LAS COORDENADAS DE LOS MARKERS
var texto1:TextField = new TextField();
var formatoTexto1:TextFormat = new TextFormat();
this.addChild(texto1);
formatoTexto1.font = "arial";
formatoTexto1.size = 12;
formatoTexto1.align = TextFormatAlign.RIGHT;
formatoTexto1.bold = true;
texto1.multiline = true;
texto1.background = true;
texto1.autoSize = TextFieldAutoSize.RIGHT;
texto1.defaultTextFormat = formatoTexto1;

//SI TODO SE CARGO OK EJECUTA
function onMapReady(event:Event):void {
//CENTRAR EL MAPA, DEFINIR EL ZOOM Y EL TIPO DE MAPA
map.setCenter(new LatLng(-32.913737, -60.735382), 16, MapType.NORMAL_MAP_TYPE);
//MUESTRA EL CONTROL DE ZOOM
map.addControl(new ZoomControl());
//MUESTRA EL CONTROL DE POSICIÓN
map.addControl(new PositionControl());
//MUESTRA EL CONTROL DE TIPO DE MAPA
map.addControl(new MapTypeControl());
//CREA UN MARKER
marker=new Marker(new LatLng(-32.913737, -60.735382));
//Y LO AGREGA A LA VISUALIZACION DEL MAPA
map.addOverlay(marker);
//DEFINE LAS OPCIONES DEL MARKER
var options:MarkerOptions =
new MarkerOptions( { fillStyle: { color:0xFF0000, alpha:0.8 }} );
marker.setOptions(options);

}

Por facundonahuel

6 de clabLevel



 

chrome
Citar            
MensajeEscrito el 20 Mar 2013 11:04 am
Mete todo dentro de un MovieClip, o incluso en un peli externa que cargues en un contenedor. Luego haces invisible o descargas el MovieClip o la peli

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 20 Mar 2013 08:45 pm
Gracias, pero intente lo del movieclip y me sigue pasando lo mismo :(
intente tambien : hacerlo en otro swf, pero al cargarlo al principal me da un error

1119: Acceso a una propiedad contentLoader posiblemente no definida mediante una referencia con tipo estatico flash.display:Loader.



import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;

var SWF:Loader = new Loader();
var ruta:URLRequest = new URLRequest("swfs/mapgugle.swf");
SWF.load(ruta);
SWF.contentLoader.info.addEventListener(Event.Complete, añadir); <------ en esta linea
function añadir (e:Event):void{
addChild(SWF);
SWF.x=0
SWF.y=260
}

Por facundonahuel

6 de clabLevel



 

chrome
Citar            
MensajeEscrito el 20 Mar 2013 09:32 pm
Tenes un puntito de mas y una mayuscula de menos, es

SWF.contentLoaderInfo.addEventListener(Event.Complete, añadir);

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 20 Mar 2013 10:05 pm
al volver a corregir :
1119: Acceso a una propiedad Complete posiblemente no definida mediante una referencia con tipo estatico Class

Por facundonahuel

6 de clabLevel



 

chrome
Citar            
MensajeEscrito el 21 Mar 2013 06:35 am
Escribe en mayúsculas el nombre del evento: Event.COMPLETE

Por Lukánicos

Claber

468 de clabLevel



Genero:Masculino  

chrome
Citar            
MensajeEscrito el 21 Mar 2013 07:36 am
mm... en errores de compilacion ya no hay ningun error pero si en salida ( al lado de linea de tiempo ) :

TypeError: Error #1009: No se puede acceder a una propiedad o a un método de una referencia a un objeto nulo.
at mapgugle_fla::MainTimeline/frame1()


la verdad q ya me da verguenza seguir preguntando ja :) asi que me doy por vencido me gano el google maps. muchisimas gracias por tu paciencia ayuda y buena voluntad ! saludos :)

Por facundonahuel

6 de clabLevel



 

chrome
Citar            
MensajeEscrito el 21 Mar 2013 11:24 am
En verdad no estas precargando nada, si lo que quieres es agregarlo al escenario con esto es suficiente

Código ActionScript :

var SWF:Loader = new Loader();
SWF.y = 260;
addChild(SWF)
var ruta:URLRequest = new URLRequest("swfs/mapgugle.swf");
SWF.load(ruta);


Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 21 Mar 2013 07:47 pm
Casi perfecto. Ahora volvimos al problema original
Antes de ingresar a la seccion contacto :


Uploaded with ImageShack.us

Despues de ingresar a la seccion contacto e ir a otra:


Uploaded with ImageShack.us

probe poniendole un stop al final del codigo para insertar el mapa al escenario pero no funciono.
cuando lo hice directamente en el swf principal me pasaba esto y tambien probe con un stop pero tampoco funciono.
Gracias..

Por facundonahuel

6 de clabLevel



 

chrome
Citar            
MensajeEscrito el 21 Mar 2013 08:30 pm
Lo que se carga se debe descargar

SWF.unload()

O al menos ocultar

SWF.visible = false

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 21 Mar 2013 09:22 pm
Al finn. Muchisimas gracias campeon ! Saludos y la mejor de las suertes ! :) :)

Por facundonahuel

6 de clabLevel



 

chrome

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.