Hi there,
Thanx for the quick answer...
I'm using the LoaderMax queue because there are more stuff being loaded... : )
The problem occurs when I click any thumbnail to load another video...
I want load a video to replace the main one.
I have 8 thumbnails, every time I click one I need to load a different video in the same place...
Here's the code of the release function:
function releaseYoutube(evt:MouseEvent):void
{
var obj:Object = new Object();
obj = evt.target;
trace (obj.name.substr(7,1));
youtube.unload();
TweenMax.to(principal.carregador, .5, {autoAlpha:1});
//UNTIL HERE THE CODE IS EXECUTED...
//HERE STARTS MY PROBLEM...
var youtube:SWFLoader = new SWFLoader(MovieClip(root).youtubeLista[obj.name.substr(7,1)].media::group.media::content.(String(@url).substr(0,4) == "http").@url+"&rel=0", {name:"video"+obj.name.substr(7,1), container:principal.alvo,onProgress:progressYoutube,onComplete:videoYoutube});
carregaVideos.append( youtube );
carregaVideos.load(true);
}
I think it's simple to resolve.... but I can't figure out.
Is there a way to unload a SWFLoader and the use this same instance do load a different SWF?
Thanx again,
Tiago.
I'll paste the entire code here:
stop();
import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.display.*;
var media:Namespace = MovieClip(root).youtubeXML.namespace("media");
var yt:Namespace = MovieClip(root).youtubeXML.namespace("yt");
principal.alvo.visible = false;
var carregaVideos:LoaderMax = new LoaderMax({name:"mainQueue",onProgress:progressYoutube,onComplete:completeYoutube,onError:errorYoutube,onChildComplete:childYoutube});
var youtube:SWFLoader = new SWFLoader(MovieClip(root).youtubeLista[a].media::group.media::content.(String(@url).substr(0,4) == "http").@url+"&rel=0", {name:"videoPrincipal", container:principal.alvo});
for (var a:int = 0; a<8; a++)
{
this["youtube" + a].alvo.alpha = 0;
this["youtube" + a].addEventListener(MouseEvent.CLICK, releaseYoutube);
this["youtube" + a].addEventListener(MouseEvent.ROLL_OVER, rollOverYoutube);
this["youtube" + a].addEventListener(MouseEvent.ROLL_OUT, rollOutYoutube);
this["youtube" + a].buttonMode = true;
this["youtube" + a].mouseChildren = false;
if (a == 0)
{
carregaVideos.append( youtube );
carregaVideos.append( new ImageLoader(MovieClip(root).youtubeLista[a].media::group.media::thumbnail[0].@url, {name:"thumb"+a, width:88, height: 65.5, container:this["youtube"+a].alvo}) );
}
else
{
carregaVideos.append( new ImageLoader(MovieClip(root).youtubeLista[a].media::group.media::thumbnail[0].@url, {name:"thumb"+a, width:88, height: 65.5, container:this["youtube"+a].alvo}) );
}
}
carregaVideos.load(true);
function childYoutube(event:LoaderEvent):void
{
if (event.target.name == "videoPrincipal")
{
principal.alvo.scaleX = principal.alvo.scaleY = .8;
TweenMax.to(principal.carregador, .5, {autoAlpha:0});
TweenLite.to(principal.alvo, 2, {autoAlpha:1});
trace ("video");
}
else
{
TweenMax.to(this["youtube"+event.target.name.substr(5,1)].carregador, .5, {autoAlpha:0});
TweenMax.to(this["youtube"+event.target.name.substr(5,1)].alvo, .5, {alpha:1, delay:.5});
trace("thumbs");
}
}
function progressYoutube(event:LoaderEvent):void
{
trace("progress: " + event.target.progress);
}
function completeYoutube(event:LoaderEvent):void
{
trace(event.target + " is complete!");
}
function errorYoutube(event:LoaderEvent):void
{
trace("error occured with " + event.target + ": " + event.text);
}
function rollOverYoutube(evt:MouseEvent):void
{
var obj:Object = new Object();
obj = evt.target;
TweenMax.to(obj, .5, {alpha:.5});
}
function rollOutYoutube(evt:MouseEvent):void
{
var obj:Object = new Object();
obj = evt.target;
TweenMax.to(obj, .5, {alpha:1});
}
function releaseYoutube(evt:MouseEvent):void
{
var obj:Object = new Object();
obj = evt.target;
trace (obj.name.substr(7,1));
youtube.unload();
//youtubeGaleria.unload();
TweenMax.to(principal.carregador, .5, {autoAlpha:1});
//trace (principal.alvo)
var youtube:SWFLoader = new SWFLoader(MovieClip(root).youtubeLista[obj.name.substr(7,1)].media::group.media::content.(String(@url).substr(0,4) == "http").@url+"&rel=0", {name:"video"+obj.name.substr(7,1), container:principal.alvo,onProgress:progressYoutube,onComplete:videoYoutube});
carregaVideos.append( youtube );
carregaVideos.load(true);
}
function videoYoutube(event:LoaderEvent):void
{
TweenMax.to(principal.carregador, .5, {autoAlpha:0});
TweenLite.to(principal.alvo, 2, {autoAlpha:1});
}