View Full Version : button enable and event call
DanglingChap
March 28th, 2008, 09:48 AM
I have placed a button component on stage and i have set it's enabled propert = false on certain events and then set it true on other events.
I have added MouseEvent.CLICK on it. and the callback methad that i have binded to it is called even when that button has it's "enabled property = false" .. why it is being called if it is disbaled?
icio
March 28th, 2008, 02:56 PM
It is being called when it is clicked because MouseEvent.CLICK is an event fired when a DisplayObject (which your button will extend, somewhere along the line) is clicked.
Since this event is defined out-with the button it has nothing to do with the button's "enabled" property. The solution would be to check whether or not the button is enabled in your callback method.
Thedizz
March 28th, 2008, 09:41 PM
I've a question here too, I added a button component for my mail form.
Now i want it after they clicked send that it opens gotsend.php where is this script:
<?
<php
<SCRIPT LANGUAGE="JavaScript">
javascript:Alert("Your message has been send we will help you as soon as possible!")
</script>
Header("Location: http://www.somesite.com/")
?>
But since i cant do it on the buttons layers in AS. I dont know how else to call up the button and make it run the php page. Is it like . addEventListener (MouseEvent.CLICK ???????????
Thats all i could think of :P
Hope you can help :p
icio
March 29th, 2008, 04:44 PM
Wait, are you wanting to redirect the user away from the page with the flash movie and respective button on it?
If that is the case then you would use navigateToURL (see here: http://scriptplayground.com/tutorials/as/getURL-in-Actionscript-3/)
Also, there is an error in your PHP script. You should try the following instead:
<?php
<script language="JavaScript" type="text/javascript">
alert("Your message has been sent and we will help you as soon as possible!");
window.location = "http://www.somesite.com/";
</script>
?>
Hope that helps :thumb:
Thedizz
March 29th, 2008, 09:51 PM
Wait, are you wanting to redirect the user away from the page with the flash movie and respective button on it?
If that is the case then you would use navigateToURL (see here: http://scriptplayground.com/tutorials/as/getURL-in-Actionscript-3/)
Also, there is an error in your PHP script. You should try the following instead:
<?php
<script language="JavaScript" type="text/javascript">
alert("Your message has been sent and we will help you as soon as possible!");
window.location = "http://www.somesite.com/";
</script>
?>
Hope that helps :thumb:
K fixed the .php file but the button isnt working yet.
I have a sort of mail form, and when you click the send button and it got sended away. i want it to run the php script. So a pop up that opens than, and link the user away. Wich is in the .php. Just need to get it there... What i've tried didnt work.
btnVerzend.addEventListener(MouseEvent.CLICK, -What should i put here?);
var url:String (http://www.kirupa.com/forum/String) = "http://www.leroyc.nl/Thedo/gotsend.php";
var request:URLRequest = new URLRequest("http://www.leroyc.nl/Thedo/gotsend.php");
try {
navigateToURL(request, '_self'); // second argument is target
} catch (e:Error) {
trace("Error occurred!");
It might work if the event would call up the code but im not sure how im a newb... :(
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.