hello
I have been having a problem which has ended driving me mad. It turns out that I had tested a flash site locally and it seemed to work fine. Nonetheless, right after uploading the site to my server I realized that there was something wrong. After that, I did some additional test by using the simulated download option from the view menu from the window shown when testing a movie in flash. What I have seen is that it works fine if I use T1 speed or when I don't use the simulated download. Otherwise, if I use a simulated download with a speed under T1, for example, DSL 32.6k the movie doesn't have the behaviour I expect.
The problem is because I implemented the onloadinit method to try to scale and set the position of an image after it is loaded:
The problem turns out when I try to load an image scaled into a container called p_contenedor. If I test this movie locally or with a speed of T1(132kb) then, the images are positioned and scaled successfully. Otherwise, if we are using simulated download with low speed, the images get neither positioned nor scaled properly.Code:var esto:MovieClip=this; esto = this; function actualiza(p_texto:String, p_file:String){ if (!_root.contenido_mc) { _root.attachMovie("Contenido_mc","contenido_mc",getNextHighestDepth(),{_x:50,_y:272.1,_width:700,_height:305}); _root.Menu_mc.swapDepths(_root.contenido_mc); } _root.contenido_mc.gotoAndStop("Servicios"); _root.contenido_mc.texto_txt.text = p_texto; //trace(_root.contenido_mc.imagen2_mc["imagen_mc"] == undefined); _root.contenido_mc.imagen2_mc.createEmptyMovieClip("imagen_mc", 1); var pic_mcl:MovieClipLoader = new MovieClipLoader(); pic_mcl.unloadClip(_root.contenido_mc.imagen2_mc.imagen_mc); pic_mcl.addListener(esto); esto.onLoadInit=function($target_mc:MovieClip) { // this is called after the image has completely loaded esto.escala(253, _root.contenido_mc.imagen2_mc.imagen_mc); $target_mc._x = - $target_mc._width/2; $target_mc._y = - $target_mc._height/2; } pic_mcl.loadClip(p_file,_root.contenido_mc.imagen2_mc.imagen_mc); } enablePseudoButtonEvents(incidencias1_mc, true, "onEnterFrame"); incidencias1_mc.Texto_mc.texto_txt.text="Sonido y video"; incidencias1_mc.onReleaseHandler = function(){ actualiza("Resolución de problemas con el sonido y el vídeo de archivos: winxp, windows vista, etc.", "images/codecs.jpg"); } function escala(tamFinal:Number,p_contenedor:MovieClip){ // if (_root.imagenEscalada==0){ if (p_contenedor._width>p_contenedor._height) { p_contenedor._yscale = p_contenedor._xscale=(tamFinal*100)/(p_contenedor._width); } else { p_contenedor._yscale = p_contenedor._xscale=(tamFinal*100)/(p_contenedor._height); } // _root.imagenEscalada = 1; // } }
Does someone have any suggestion about why this problem might be happening?
You can take a glance at www.arreglaordenador.com at the menu Servicios->Resolución de incidencias->Sonido y video or any othe option from the menu Servicios. You will be able to see that the image does not get centered and scaled as I expected inside the square. It is strange however that it does work when I run this site in a local server installed in my computer. That has to do with the internet connection speed.
Thanks in advance




Bookmarks