MouseEvent.CLICK Problem i think...
I am making a game that wil be included in a school project. its a basic shoot the alien type game. My problem is that it will not respond to a mouse click at all. The weired thing is using the same exact code just changing the event to MOUSE_OVER instead of CLICK it works fine. But I want it to work on the click. Any help would be greatly appreciated. Heres my code for the game_alien class:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class game_alien extends MovieClip{
private var health = 2;
public function game_alien() {
this.addEventListener(MouseEvent.CLICK, hit); //here is the problem
private function hit(event:MouseEvent) {
trace(health);
health--;
if (health == 1){
this.gotoAndPlay("first_hit");
if (health == 0){
this.gotoAndPlay("end");
parent.removeChild(this);
and i dont know if this would help anything but here is the code for the game class which encapsulates the game_alien object:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.ui.Mouse;
public class game extends MovieClip{
var new_cursor:Cursor = new Cursor();
var alien:game_alien = new game_alien();
public function game() {
changeCursor();
addAlien();
private function addAlien(){
addChild(alien);
public function changeCursor(){
Mouse.hide();
stage.addChild(new_cursor);
new_cursor.startDrag(true);
Also it isnt throwing any errors or message to the output box (besides my trace statement ). Its kinda like due in two days two so any response on the idea is realllyyyyy apreciated thanks
you're welcome.
p.s. in the future, mark helpful/correct answers, if there are any.
Similar Messages
-
MacBook Pro Trackpad: Clicking problems
I have a MacBook Pro, (15 inch, Late 2008) and have always had fairly significant issues with the trackpad. It only registers clicks about half of the time. I have experimented with all the trackpad settings and "tap to click" also fails to register consistently. I usually have to press very hard, after the trackpad depresses for the click to register in the OS. I've continually experienced this problem in Leopard, Snow Leopard, and now Lion.
I've read that a lot of other people have had similiar issues with their trackpads over the last 3 years, but I've never heard about any fix or remedy. My trackpad does depress just fine, so I don't think that the trackpad screw would need to be adjusted at all. An external mouse registers clicks 100% of the time, so it isn't a software issue. I've heard that some people's ribbon that connects the trackpad could be loose, but I'm nervous to open it up and mess around with it.
I click with the side of my thumb--as most other people do. However clicking with my index finger also fails to register clicks, so I don't think it is a "accidental input" issue or a multitouch issue.
My girlfriend has the exact same model of Macbook Pro. Same year, same season, exact same specs. Her trackpad works perfectly.
I brought the computer to a Genius Bar, and the "Genius" said that it was just fine and somehow magically got it to register his clicks. I think maybe he had a sercret Magic Mouse under the table. I left bewildered and defeated.
Maybe I should just navigate via keyboard...Don't worry about what the 'Genius' had to say most are just Apple grunts, slugging it out in the trenches.
If you are out of warranty / AppleCare then I would suggest finding an authorized independent Apple repair company. Go there, get a ridiculous quote (most likely) then ask around and find a local computer repair shop. Any place with "Apple Authorized" is basically like dealing with Apple.
You could also ask another 'Genius' or a 'Super Genius' (ie Manager.)
I promise you are not alone.
I have killed keyboards and trackpads with the following:
- A glass of Merlot.
- A glass of water
- Another glass of water
- A dog, knocking the laptop off the couch and to the floor.
I could continue, but seriously. Don't get up. The other option is to get a bluetooth mouse. Personally I love mine. -
Actual target for MouseEvent.CLICK - spark skins
Hello,
I have a question about Event Listeners and targeting events.
In my AIR app for mobile I need to click / tap on a number of s:Image objects.
At first I added to each of them an Event Listener linked to an Event Handler. Then, trying to optimize my code, I moved the Event Listener to the container object as suggested in various optimization resources I found online.
The problem was that the event.target property was not the clicked image, but a s:Group. I eventually figured out that the s:Group was part of the skin of the s:Image, and I fixed the problem by using the target.owner property, but this behavior really created a lot of confusion. I couldn’t find anything about it on the Adobe development resources, as they just insist on (and explain quite well) the difference between the target and currentTarget properties.
Below you can find a simple representation of my workaround, but I was wondering if:
1) This was actually caused by some mistake I made, and if it could be more easily avoided;
2) There is a better or more efficient workaround than the one I came up with;
3) The topic is discussed somewhere in the documentation.
Thanks a lot!
import spark.components.Image;
private var image1:Image;
private function initComponent():void
image1 = new Image();
image1.source = "assets/aaa.png";
image1.id = "thisIsTheImage";
addElement(image1);
addEventListener(MouseEvent.CLICK, clickHandler); // 1
// image1.addEventListener(MouseEvent.CLICK, clickHandler); // 2 - the old one
private function clickHandler(event:MouseEvent):void
trace("event.currentTarget \t\t\t" + event.currentTarget);
trace("event.target \t\t\t\t" + event.target);
trace("event.target.owner.owner \t\t" + event.target.owner.owner);
trace("image1.imageDisplay.displayObject \t" + image1.imageDisplay.displayObject);
if(event.target.owner.owner is Image){
// do something
console:
event.currentTarget TestApp0.ViewNavigatorApplicationSkin2.navigator.ViewNavigatorSkin4.contentGroup.TestView33
event.target TestApp0.ViewNavigatorApplicationSkin2.navigator.ViewNavigatorSkin4.contentGroup.TestView33.SkinnableContainerSkin35.contentGroup.thisIsTheImage.ImageSkin43.Group44
event.target.owner.owner TestApp0.ViewNavigatorApplicationSkin2.navigator.ViewNavigatorSkin4.contentGroup.TestView33.SkinnableContainerSkin35.contentGroup.thisIsTheImage
image1.imageDisplay.displayObject TestApp0.ViewNavigatorApplicationSkin2.navigator.ViewNavigatorSkin4.contentGroup.TestView33.SkinnableContainerSkin35.contentGroup.thisIsTheImage.ImageSkin43.Group44Hey,
thanks a lot!
What about using SpriteVisualElement?
By looking at ther inheritance chains it should be lighter than Image but heavier than BitmapImage:
Image SkinnableComponent UIComponent FlexSprite Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object
SpriteVisualElement FlexSprite Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object
BitmapImage GraphicElement EventDispatcher Object
I'd like to use it over BitmapImage beacause it inherits from InteractiveObject and is therefore clickable.
Would this be a good idea? -
I started to enconter weird problem with my laptop. Sometimes its kind of stopping me from clicking on the objects. I can move the mouse around but nothings happening when I try to click. The only way to go back to normal is to restart the computer.
I seem to have a similar problem. In my case i figured out that the clicking problem is limited to a rectengular area on bottom of the screen, and switching a program to fullscreen solves the problem within this application. Also i think, in my case, the problem occurs when working on an external monitor, not on the built. (due to the fact i didnt tested much on just the primary monitor, im not 100% sure with this)
I dont know what to do, since i cant find someone having the same issue... -
There is a screen clicking problem in my iPhone 5c..what should I do?
There is a glass clicking problem in phone 5c ..I got it replaced once... But the replaced iPhone also has started the problem now...what should I do now?
Go and get it replaced again...there is nothing else you can do
-
Samsung LED LCD's and the notorious "clicking" problems?
Has anyone had or heard of the new LED LCD's having the well known "clicking" problem that the LCD's have had?
A clicking problem? I have never heard nor have I ever experianced any such issue. If you could, please go into more detail.
Please note that whatever I state in these forums is not a direct response from Best Buy or Geek Squad. My posts are just my own personal insights. -
SimpleButton, simple problem I think
I've been modifying a slideshow class I've found on the web
and need a little direction. Everything is working fine except the
button I'm trying to add.
I want a button that covers part of the stage and I've
created that. I just cant seem to figure out how to add
addEventListener to it.
I'd like to add an event listener like:
stageButton.addEventListener(MouseEvent.CLICK, onClick);
Any suggestions?
Thanksbtn.addEventListener(MouseEvent.CLICK, onClick);
throws this error:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at
XMLSlideshow/showLoadResult()[C:\WWW\Src\flash\XMLSlideshow.as:270]
Line 270 is - btn.addEventListener(MouseEvent.CLICK,
onClick);
I've included the entire class below for review. If I add the
event to the stageBtn function(commented out in example) then call
the function(also commented out in example) it works but the
navigation(stop, play, forward, reverse) then follows the links
even though its not under the button.
Thanks for looking -
dears,
I have a problem with iPhone is that I can replace it at points of sale in the U.S. because I bought from Saudi Arabia because the problem I think in the hard ware I do resoftware more than 3 times did not fix.
Network also always missing.
I am living in KS Wichita. I hope you help me pleas.
Regards.iPhone warranty is not international. You will have to return your
iPhone to Saudi Arabia for repair/replacement. Either take it back
yourself or send to friend/relative for them to take to Apple. Apple
will not accept international shipments for repair nor will Apple
ship repaired/replaced iPhones out of the country where the repair
was done. -
i have a question my iphone4s has a problem when updated iOS8 there will be freeze problem i think iOS8 is not supported in 4s!!!!!!!!!.
one more question when i phone5 update with iOS 8.1.2 this iOS supported iphone5???Hi Ios 8.1.2 Should work on iPhone 4s / 5 You may have a bug Backup to cloud over WiFi Then Restore back to Factory Settings This will make iPhone as new. Use same Apple ID & you will get your Apps & Data back Do Restore over your WiFi. Cheers Brian
-
I am having the same problem I think. With mobileme you simply copy documents to the idisk folder and then synch. I cannot seem to sink that folder anymore. Any idea as to how I can simply copy folders to icloud and then access the MS Word and PDF files on my iphone?
Apple never bopthered to explain that this would happen
Your iDisk is still accessible after moving to iCloud in exactly the same way as before. Nothing is deleted until June 30th 2012.
, so I could easily have lost ALL of the files I kept on iDisk.
No, you couldn't. Firstly, nothing was deleted from your iDisk. Secondly, any files stored on your iDisk should never be your only copy. Even if your iDisk spontaneously combusted, you should keep local backups elsewhere.
Does Apple WANT people to move their storage elsewhere and stop paying Apple for it?
Yes. Apple doesn't provide such a service anymore, nor are you paying them for it.
Apple has made no effort to suggest remedies for the problem it has given iDisk users
They've provided instructions on how to download your files from your iDisk. What you do with them after that is your choice. -
They fixed the right click problem, but now there is a bigger problem
after updating, I can use my right click perfectly on Windows XP. however, my windows XP starts to restart very often-which means the "blue-sceen" comes out very often. I believe many poeple has this problem because I had already read couple of complains...Well...I hope apple can fix it soon.
I could not right click on my macbook's Precision aluminum unibody enclosure under windows xp, and after updating the trobubleshooter, it works. However, my windows starts to restart again and again (the blue screen) and it says it is because the applemtp.sys has some problems. I read couple of others people's experiences on the Internet, and they all so it started to happen after they fix the right click problem.
-
Beginner - mouse over IE line - and click problem
My test swf - -
http://www.jennyweir.com/testSite/
How would I remove that white mouseover white line near the
edges of the page (as seen on IE7)
I made the swf full screen to try to get it to dissapear -
but full screen is apparently only nearly full screen and it is
still there
I would like to learn how to make an swf which can live
seamlessly in a matching html page so would appreciate knowing what
to do. There is a setting I chose which I thought would fix it
(show border) but it has not worked
Also - click problem:
in Flash, I made a fill layer into a button (100% size also
and under the visible elements ) so that I could attach a goto url
action (up)
on this swf you have to click twice to go to the url
I dont follow how this has come to be
appreciate any pointers
gavHi Gavlong
Did you try adding the background color parameter in the HTML
of your page? This is different than the background in the Flash
file. I looked at the source for your page and I didn't see it.
Regarding your double-click problem it may be due to an
Internet Explorer update from earlier in the year. I've read a few
bits about how for some interactive web apps (Flash is included in
the list of affected programs) the user needs to 'activate' the
control by pressing SPACEBAR or ENTER. That would explain the need
for the second click. Apparently there's a way to enable the
control from your web page by using and external .js file but I
haven't implemented it. Here are a couple of related
links...hopefully they are of some help:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activati ng_activex.asp
http://msdn.microsoft.com/ieupdate/
http://www.adobe.com/devnet/activecontent/articles/devletter.html
-WD -
How to add add the code for the MouseEvent.CLICK event
Could anyone help me who is a beginner please?
I'd like to know step by step how to do the following
instruction.
I am trying to add a link to my flash.
I drew a shape on the stage, select it and transform it to
movie clip (hit F8 or right-click on it and select "Convert to
symbol" from the popup menu or use the main menu: Modify ->
Convert to symbol). I resized it as the same size as my stage, then
make it transparent.
Then I am supposed to do the following in order to create a
link.
"add the code for the MouseEvent.CLICK event that would open
a url using the navigateToURL() function."
But I just don't know how to. Could anyone tell me step by
step approach please?
Thanks in advance.Yes, click the frame where you have the button on stage and
open the actions panel. paste the script in, and make sure whatever
instance name you gave the button, you plug into the script. Also,
the function declaration should be like so:
function callFunction(e:MouseEvent):void{ <-- 'e' can be
anything you want, it could be 'kfjeiwajfkd' for that
matter. -
How to disable MouseEvent.CLICK events on a MovieClip
Hi all,
I am new to Flash & ActionScript 3.0. I only have basic knowledge of AS 3.0 && Flash.
My issue starts here:
Suppose, I created a MovieClip(with instance-name= "myClip") on the stage. If I need to process MouseEvent.CLICK event on this movieclip(myClip), then we use addEventListener(bla.... bla...); method.
Now, my requirement is, in certain case, I do not want to occur any MouseEvent.CLICK events on this same movieClip(i.e., myClip).Then, How to do this? (or) What is the method/class used in this context?
PLEASE, CAN YOU REPLY ME WITH AN EXAMPLE....
Please, can anyone help me in this context...
Atlast, My requirement is: How to remove/disable Mouse_CLICK events when occur on a MovieCLip.
It's urgent....
Waiting for ur reply....
Thanks in advance...
Srihari.Chyou can remove the event listener with
removeEventListener(bla.... bla...);
but depending on what it is that you actually want to do (whatever determines your 'certain case') you could also set a boolean flag for example and just do something different in your listener function based on that value -
CreateToolTip and MouseEvent.CLICK on the tooltip doesn't work
Hi,
I didn't success to get an MouseEvent.CLICK working on a tooltip created with ToolTipManager.createToolTip.
Here is the code, no Alert is shown when i click on the tooltip :
private var tt:ToolTip;
private function showToolTip( event:Event ):void
tt = ToolTipManager.createToolTip( toolTipHelpText, 0 , 0 ) as ToolTip;
tt.addEventListener( MouseEvent.CLICK, test )
private function test( event:MouseEvent ):void
Alert.show( 'test' );
Do i make something wrong ?
ThanksSet mouseEnabled=true on the ToolTip. You might experience other side effects. Tooltips aren't necessarily designed for mouse interaction
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui
Maybe you are looking for
-
Tiger Update Crashes my Mac Mini Intel
I got a new Mac Mini and finally got it going though it was not easy to transfer from my eMac. But I prevailed. Then I made the fatal mistake of updating all that the Software Update software suggested. Now my brand new Mac Mini will not run at all.
-
MacBook 2.2 GHz (late 2007, SR) and 4 GB CRUCIAL RAM
I got two sticks of RAM from CRUCIAL, and I cannot use both at the same time. The MacBook will boot with one Apple OEM and one Crucial stick, and it is happy (crucial RAM works), but as soon as I take the Apple stick out, the MacBook will not boot up
-
How to find who has locked a row in a table?
My DB is a Oracle Database 10g Enterprise Edition Release 10.2.0.4.0. My question is very simple: You try to update a row of a table but find out it is locked by somebody else. How do I find which user (or session) has locked that row?
-
Hi All, I am using SAP version 4.6c. I am using T.code MFHU to declare one handling unit. I want function module to reverse the handling unit which is declared using MFHU transaction. Thanks in advance. points assured. Krishna Yerram.
-
Calendar Meeting Request Accepted Email bug
I have come across a possible bug with the BlackBerry Calendar feature. When I invited an attendee who has a BlackBerry Curve 8520 to a meeting with a reminder time of '0 min' with my BlackBerry Bold 9780 whilst holding both phones in my hand and acc