lomac
asked on
insert an AS3 code to a Close Button
I am trying to create a close button on a transparent flash movie and it is not working. My movie is playing in an html page in its own window. I inserted a button in a layer and add this code :
. When the button is pressed I want to close the flash movie. How do I do this?
Thanks in Advance!
. When the button is pressed I want to close the flash movie. How do I do this?
Thanks in Advance!
this.close_btn.addEventListener(MouseEvent.CLICK,closeall);
function closeall(event:MouseEvent):void
Fscommand ("quit")
ASKER
Many thanks for your reply, I have these errors
what should i do?
Scene 1, Layer 'Actions', Frame 300, Line 2 1126: Function does not have a body.
ComponentShim (Compiled Clip), Line 1 5000: The class 'fl.controls.Button' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
what should i do?
Try this:
// the function that runs when after button was clicked
function closeall(e:MouseEvent):voi d {
var req:URLRequest = new URLRequest("javascript:win dow.close( );");
navigateToURL(req, "_self");
}
close_btn.addEventListener (MouseEven t.CLICK,cl oseall);
The error that you forwarded has nothing to do with the code i provided.
To debug that you need to share some more of your code snippet.
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
// the function that runs when after button was clicked
function closeall(e:MouseEvent):voi
var req:URLRequest = new URLRequest("javascript:win
navigateToURL(req, "_self");
}
close_btn.addEventListener
The error that you forwarded has nothing to do with the code i provided.
To debug that you need to share some more of your code snippet.
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
ASKER
here is my flash movie
simple-transparent-ads.zip
when i click on close button, i want to close only the flashmovie
not the entire window of the web page where it's included
thanks for your help
simple-transparent-ads.zip
when i click on close button, i want to close only the flashmovie
not the entire window of the web page where it's included
thanks for your help
Hi,
There is no such direct way.
You can call a javascript function from flash which will hide the flash object.
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
There is no such direct way.
You can call a javascript function from flash which will hide the flash object.
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
ASKER
Good evening,
After many research, i confirm that there is no direct way; but, please, how could i do this ?
is there any code to add in the html?
warm regards
After many research, i confirm that there is no direct way; but, please, how could i do this ?
is there any code to add in the html?
warm regards
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Did the solution helped you. If yes, kindly mark this as solved.
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
this.close_btn.addEventLis
function closeall(event:MouseEvent)
ExternalInterface.call("ja
}
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com