Copy link to clipboard
Copied
Hi .. I'm working on my project and I need help. I'm not an expert.
I have a main swf, and this one has several external swf (test1, test2)
I have menu and submenu, which load external swf.
Load well external swf.
Create the close button in the main swf, and close the external swf correctly.
THE PROBLEM is always visible the close button
I would like the close button to be visible only when loading the external swf. But always be hidden
I would prefer to place the close button on each of the external swf, is it possible ?.
Or does the close button have to be in the main swf?
thanks for your help
........................code................
import flash.events.MouseEvent;
ruta0_btn.removeEventListener(MouseEvent.ROLL_OVER, activar)
activador_mc.addEventListener(MouseEvent.ROLL_OVER, desactivar);
function desactivar (event:MouseEvent):void
{
gotoAndPlay("fuera");
}
import flash.display.Loader;
import flash.net.URLRequest;
var SWF:Loader = new Loader();
SWF.name = "holder"
/* Comienzo BOTON 1 */
ruta1_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
var ruta:URLRequest = new URLRequest ("images/test1.swf");
SWF.load(ruta);
SWF.contentLoaderInfo.addEventListener(Event.COMPLETE, añadir);
stage.frameRate = 50;
}
/* Fin BOTON 1 */
/* Comienzo BOTON 2 */
ruta2_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);
function fl_MouseClickHandler_2(event:MouseEvent):void
{
var ruta:URLRequest = new URLRequest ("images/test2.swf");
SWF.load(ruta);
SWF.contentLoaderInfo.addEventListener(Event.COMPLETE, añadir)
stage.frameRate = 50;
}
/* Fin BOTON 2 */
function añadir (e:Event):void {
if(!this.getChildByName('holder')){
addChild(SWF);
SWF.x = -32;
SWF.y = -470;
}
}
/* CLOSE BUTTON */
borra_btn.addEventListener(MouseEvent.CLICK, borrarSWF);
function borrarSWF(event:MouseEvent):void {
removeChild(SWF);
}
Copy link to clipboard
Copied
the close button can be in the loaded swf's.
Loader(this.parent).unloadAndStop();
Copy link to clipboard
Copied
thanks for answering.
Could you indicate how I should do it? ... where should I place the code, in the external swf? ...
Or do you have an example where I can check?
I proceeded to create the close button in the external swf, add the code that you indicate to me, it did not work.
Stop loading the external swf
Copy link to clipboard
Copied
is your button on the main timeline of your external swf? did you test after publishing your external swf and then testing the main swf?
if so, show the button's code.
Copy link to clipboard
Copied
This is my external swf. It has the close button (top, right), instance name "cierra_btn".
The code inside external swf, but it does not work,
If the code works, if the close button is in the main swf
Copy link to clipboard
Copied
Someone knows how this can be done .. Can anyone help me?
Copy link to clipboard
Copied
can you see message 1?
if yes, can you see the code in message 1?
if yes, why aren't you using that code?
Copy link to clipboard
Copied
That option I answered on 02/12/2016 07:40
I proceeded to create the close button in the external swf, add the code that you indicate to me, it did not work.
Stop loading the external swf
Surely it is badly loaded .. that is why I consult you where and how the code goes .. since I am not an expert.
But as I indicated .. with that code does not load the external swf.
When I call it from the main swf, it does not load.
I remove that code (Loader (this.parent) .unloadAndStop) and reload the file
Copy link to clipboard
Copied
that code goes in your button listener: the same place where your have removeChild(SWF).
Copy link to clipboard
Copied
The removeChild, I have it in the main swf.
The close button I want it in the external swf.
I leave you an example of what I need, so you can identify what exactly my problem is.
I leave attached the 2 file, swf main and external
Copy link to clipboard
Copied
that code (and the close button) goes in the loaded swf. that's what you asked for.
is that still what you want?
Copy link to clipboard
Copied
Yes .. that's what I need.
Try, but it does not work, as I indicated before, if I add that code to the close button of the swf-external file, when I load it from the main one, it does not work
I already tried it, and it does not work
Copy link to clipboard
Copied
show the code in your external (loaded) swf.
Copy link to clipboard
Copied
Sorry friend, but I do not understand you.
Already add the code that you indicate to the button to close. I've shown you the image with the code, instance name, etc. Since I'm not an expert, I can not understand you
Find more inspiration, events, and resources on the new Adobe Community
Explore Now