Comunidad de diseño web y desarrollo en internet online

URLRequest

Citar            
MensajeEscrito el 16 Oct 2009 06:41 pm
Hola tengo este problema
sobre una peli
al hacer un loadMovie en as2 con esta direccion carga perfecto

http://m1.emea.2mdn.net/2077855/BA_Opp_Leisure_300x250_3loop_300x250_None_Specific_ftV2.swf?oibmac=1

ahora bien en AS3 cuando intento hacerlo se me cuelga el navegador. y queda tildado.

Security.allowDomain("*");
var urlRequest:URLRequest = new URLRequest("http://m1.emea.2mdn.net/2077855/BA_Opp_Leisure_300x250_3loop_300x250_None_Specific_ftV2.swf?oibmac=1");
var urlLoader:Loader = new Loader();
urlLoader.load (urlRequest);
stage.addChild (urlLoader);

Gracias..
Martin

Por chapacabana

4 de clabLevel



 

firefox
Citar            
MensajeEscrito el 16 Oct 2009 11:30 pm
A tu variable urlLoader debes de asignarle un detector de eventos que advierta cuando se hayan cargado todos los datos. recien entonces puedes agregar el objeto al stage.

Por marrkitos

51 de clabLevel



 

Arequipa - Peru

firefox
Citar            
MensajeEscrito el 16 Oct 2009 11:37 pm
gracias por responder te paso el .as completo, asi me dices si ves algo mal ya que tengo los detectores

package
{
import flash.display.MovieClip;
import flash.display.Loader;
import flash.system.LoaderContext;
import flash.events.*;
import flash.net.*;
import flash.system.Security;
import flash.utils.ByteArray;


public class Carga extends MovieClip
{
var SWFURLRequest:URLRequest;
var SWFURLLoader:URLLoader;

var SWFRequest:URLRequest;
var SWFLoader:Loader;

function Carga()
{
trace("Carga()\n");

Security.allowDomain("*");
//Security.allowInsecureDomain("*");

this.getSWFURL();
}

function getSWFURL()
{
trace("getSWFURL()\n");

this.SWFURLRequest = new URLRequest("http://ws.jaddspace.com/SelectiveMedia/FlashBanner/?size=300x250");
this.SWFURLLoader = new URLLoader();
this.SWFURLLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

this.SWFURLLoader.addEventListener(Event.COMPLETE, this.getSWFURLComplete);

this.SWFURLLoader.load(this.SWFURLRequest);
}

function getSWFURLComplete(event:Event):void
{
trace("getSWFURLComplete()\n");

var myLoader:URLLoader = URLLoader(event.target);
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

this.getSWF(myLoader.data.advertSwf);
}

function getSWF(SWFURL:String):void
{
trace("getSWF()\n");

this.SWFRequest = new URLRequest(SWFURL);
this.SWFLoader = new Loader();

this.SWFLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.getSWFComplete);
this.SWFLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, this.onProgressHandler);


this.SWFLoader.load(this.SWFRequest);
}

function getSWFComplete(event:Event):void
{
trace("getSWFComplete()\n");
this.addChild(event.currentTarget.loader);
}

function onProgressHandler(mProgress:ProgressEvent)
{
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
}


}
}

Por chapacabana

4 de clabLevel



 

firefox
Citar            
MensajeEscrito el 17 Oct 2009 01:15 am
Pues hermano le estas dando mucha vuelta al codigo en vano, prove tu codigo y si...tienes razon te cuelga el flash player, creo que es por los detectores de eventos: cargas algo y luego de cargado vuelves a cargarlo y vuelves otra ves, la solucion esta solo en manipular la propiedad data, la parte del codigo relevante y lo que debes cambiar esta en esta funcion, olvida lo demas:

Código ActionScript :

function getSWFURLComplete(event:Event):void
{
trace("getSWFURLComplete()\n");
//con la propiedad data de URLLoader obtienes los datos que quieras
//luego de eso los manipulas ya a tu gusto.
trace("data: "+SWFURLLoader.data);
}


Y claro no puedes agregar directamente texto al escenario, antes debes insertarlo en una caja de texto:

Código ActionScript :

private function getSWFComplete(event:Event):void
{
trace("getSWFComplete()\n");
//this.addChild(event.currentTarget.loader);
}

Por marrkitos

51 de clabLevel



 

Arequipa - Peru

firefox
Citar            
MensajeEscrito el 17 Oct 2009 03:40 am
gracias por la info, pero sigo sin dar en el error..!!!

Por chapacabana

4 de clabLevel



 

firefox

 

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