lundi 23 novembre 2015

I have two externally loaded SWF files and I would like for each to recognize that the other has loaded or !loaded?

After loading 2 SWF files via two separate buttons, I am attempting to get one to recognize that the other is being viewed and unload. What would be the best way given the code here?

function matrixLoad(event:MouseEvent): void
{
if (fl_ToLoad3)
{
    fl_Proloader3 = new fl_Proloader3();
    fl_Proloader3.load(new URLRequest("assets/matrix1.swf"));
    addChild(fl_Proloader3);
    fl_Proloader3.x = 0;
    fl_Proloader3.y = 300;
    trace("Matrix1 Load");
}
else
{
    fl_Proloader3.unload();
    removeChild(fl_Proloader3);
    fl_Proloader3 = null;
    trace("Matrix1 UnLoad");
}
fl_ToLoad3 = !fl_ToLoad3;
}

function matrixLoad2(event:MouseEvent): void
{
if (fl_ToLoad4)
{
    fl_Proloader4 = new fl_Proloader4();
    fl_Proloader4.load(new URLRequest("assets/matrix2.swf"));
    addChild(fl_Proloader4);
    fl_Proloader4.x = 0;
    fl_Proloader4.y = 300;
    trace("Matrix2 Load");
}
else
{
    fl_Proloader4.unload();
    removeChild(fl_Proloader4);
    fl_Proloader4 = null;
    trace("Matrix2 UnLoad");
}
fl_ToLoad4 = !fl_ToLoad4;
}


matrix1.addEventListener(MouseEvent.CLICK, matrixLoad);
matrix2.addEventListener(MouseEvent.CLICK, matrixLoad2);

Aucun commentaire:

Enregistrer un commentaire