ActionScript 3.0 :: Mouseclick Event - Shoot The Zombies, None Of Them Are Clickable?
Oct 11, 2010
When I run the file and try to shoot the zombies, none of them are clickable. I really can't tell what I have done wrong here. Here is my code:
stage.addEventListener(Event.ENTER_FRAME, moveBullseye);
function moveBullseye(event:Event) {
bullseye_mc.x=mouseX;[code].....
View 2 Replies
Similar Posts:
Aug 11, 2011
My goal is to shoot a bullet everytime I click on ship. What happens, in fact, is that If I click on it once, the bullet is shot, but if I click on it twice before the first bullet is off the screen, the first bullet literally stops(it does not disappear, only stops) and the second bullet is shot.
public var ship:Ship = new Ship();
public var bullet:Bullet = new Bullet();
stage.addChild(ship);[code]...
View 2 Replies
Nov 5, 2008
I'm working on a custom AS visual component, based on UIComponent class. Inside this component, I have a button I programatically added. I set the mouseClick event of it, and it works fine. When the mouseClick for the button starts, it adds a listener for MouseDown on the stage. This is my problem. Once that MouseDown event listener is initiated it won't ever pay attention to the MouseClick listener of the button (which will
turn off the MouseDown listener!). I've tried setting the priority number when creating the listeners, but this is not working. My mouseClick listeners gets ignored.
View 3 Replies
Jan 26, 2009
Let's say I have 10 different buttons, a click on each button will open a different website. Currently, I have 10 different functions for 10 buttons. Is there a way to simplify the code and only have one function for all the buttons and only pass the URL to the onclick function?
button121.addEventListener(MouseEvent.CLICK, clickButton121("http://www.myurl.com"));
function clickButton121(event:MouseEvent, urlString:String):void{
myURL = new URLRequest(urlString);
navigateToURL(myURL);
}
I can say it will be very inefficient if i have 100 buttons and having to write 100 functions.
View 3 Replies
Apr 28, 2009
I have a button class which disables the current button when it is clicked, the problem is I need to restore the mouseclick event to all the other button or eventually if you work through the menu all the button will be disabled. How can I iterate through all non-clicked items and restore the clicks to the non-clicked buttons?
public function onClick(e:MouseEvent)
{
this.parent.gotoAndStop(e.target.name);
e.target.removeEventListener(MouseEvent.CLICK, onClick);
}
View 1 Replies
Dec 5, 2009
trouble to slide a mc that loads external image through a addChild function.How do I change the code in order to slide the mc that contains the new mc addChild that the loader has created?Heres my code, I have been trying to crack this for days and I couldn't seem to solve it.trying to convert myself from AS2 to AS3
Code:
var speed:Number=4;
var imageLoader:Loader;
[code].....
View 1 Replies
Jun 25, 2010
I created a game entirely in flash develop. It's running great and looking good. One small problem...I have to make the menu and mouseclick event for replay etc...but they game is entirely on the first frame since it was made in flash develop. as to how I can work around this? I was thinking maybe making the menu movieclips etc and incorporating timers or something of that nature. But when you load the SWF the game goes...so i'd have to pause the game too somehow while the menu is in progress.
View 1 Replies
Apr 10, 2009
I have tried the following code to create a thumbnail preview that loops and is clickable to go to a new page with a video gallery. The video plays anbd loops, but, it does not seem to recognize the mouse click i have a trace that isn't being triggered an nothing happens. code is below.
[Code]...
View 11 Replies
Mar 4, 2012
this is in my bullet movie clip on the timeline.[code]It all works but when i turn around it still shoots the same way im sure its something simple but i just cant work it out.
View 7 Replies
Dec 5, 2011
I have a TargetCirlce_mc which moves on "y" axis from top to bottom. And I have an arrow_mc which is on x:100 & y:200. How can I shoot an arrow exactly on the registration point of the TargetCircle_mc (automatically) while it is exactly opposite to the arrow_mc?
View 1 Replies
Nov 8, 2009
I'm doing a simple game where you move the character using the arrow keys and shoot using the Mouse. The character rotates based on the Mouse angle. I have two problems: when I move the character, he moves once, then stops then moves again as normal. My other problem is that when I click over a MovieClip, the bullet goes to the wrong angle.My moving function:
Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
function keyHandler(event:KeyboardEvent):void {
[code]....
View 2 Replies
Aug 13, 2004
How do you make a MC like shoot a gun or something when you press the spacebar?
View 1 Replies
Aug 5, 2011
what i whant is when any of the units get to a certain distance of the enemy it should trace(shoot).
[CODE]...
View 6 Replies
Feb 8, 2003
I'm working on a new project, its a side scrolling game where an airplane (user) has to shoot down a bunch of other enemy planes. how to create an AS to shoot lasers from the nose of the plane
View 6 Replies
Dec 25, 2006
How would you go about making a movie clip shoot a bullet from it, but have the movieclip able to move around, like a sidescroller game...
View 2 Replies
Sep 21, 2009
I found a basic example of how to create something that'll shoot an object and create an arc based on an angle. I added a power Bar to it, but I noticed something bad about it.
The way it works the higher the speed is the further it goes and the faster it moves across the screen. This doesn't give me enough control. Because essentially I want fast moving projectiles but I want to also be able to shoot both near and far.
With this current system that's an impossibility.. Can anyone shed some light on how I can do this better? Here's the current way it's being done (important parts):
Code:
bullet = new Bullet;
this.stage.addChild(bullet);
bullet.speed = 1 + powerBar.scaleX * 20;
[Code].....
View 2 Replies
Nov 23, 2011
THIS THREAD IS SOLVED.. Answer lies upon a website tutorial. Final Page on this Thread.So far so good, i've gotten most my as2 to as3.. And coming out good Buttons are working, The only last part im working on is upon shooting, it'll bring in the calls to Fire the missle.. (tracein the button works great).
[Code]...
This is what im trying.. But it says undefined use for addchild.. so im taking im missing somthing..
(the missile is a animation graphic i created).I have made a Missile.as to control what the missle does when its addchild is placed on stage. Problem is, (addchild isnt doing it) and im not sure if its going to shoot out the nose of the hero..
View 14 Replies
Sep 28, 2002
i've posted many times and got loads of responses but i dont understand how to make a bullet hole appear when you shoot an object. MSN me a [URL] to have a chat about doin the actionscript.
View 1 Replies
Mar 16, 2005
I havent used flash in years and I wanted to make a game. Ive made a few before but i didnt ever finish them and now i dont have them anymore. I wanna make this game where you are this man that can move around. (i can remember how to do that) and you shoot these huge exploding cats. How do i make the person shoot when you press the spacebar?How do i make the barrel of the gun follow the mouse and the bullets shoot that way?
View 10 Replies
Feb 25, 2010
I am developing a game like this. [URL]. I just start this game And stuck in a problem. Moving arrow of game according mouse moveing like Given URL just check out. I know it is just a mathematical calculation. I have done according X position of mouse moving. But confuse something With Y position also. So I am not getting proper solution of X & Y position Both Togather.
View 2 Replies
Feb 15, 2003
I have just read the tut on the shooting aspect of games and i tried it for myself. I altered it so that you shoot on the x axis and you shoot when the space button is pressed.My question is, how do you make the bullets shoot when the space button is releases? And or can make the bullet shoot at an interval of one second or so when the space is pressed... The bullets for me are shooting at a continuous streem and that may be a too great advantage for a user..
View 6 Replies
Jun 7, 2010
I have a machine that shoots canon balls into three different barrels, each on a different x axis, I need to be able to shoot at an arc into the target barrel, the target barrel will be randomly determined right before the ball is fired, the barrels will be randomly placed from stage to stage
the friction and gravity applied are constant variables, how can i determine both the correct x and y veleocity to shoot the balls out so that they end up in the correct barrel. I don't want to hard code any variables
View 2 Replies
Sep 24, 2010
So I've set myself a little project to build a bowman game. Everythings working smashing until the math at the point where the computer needs to figure out the power and angle to shoot the arrow back at you. What I've been working off is my knowledge from applied-math classes in school. I've been using the following formula where g is gravity, t is time (this would be in frames for flash), sx is the distance between the players, u is the initial force of the arrow and a is the angle we need to find. With a bit of moving around to seperate the angle, this becomes For my AS3 this translates to:
[Code]...
What happens is that it always fires the projectile at a very low angle that doesnt change to match the correct circumstances and I can't figure out how to get around this. Changing the force doesnt make any difference and the program will need to get around changing distances between the player so this math is pretty necessary (I think). Any math heads out there know what I should change?
View 1 Replies
Nov 26, 2008
Im currently making a game that has one of those old-skool Fallout maps (a world map where you click somewhere and the "you" marker moves there) that im trying to replicate.I already have the scripts ready for map interaction (using onhit here). But i was wondering if someone could help me with a script that works this way:
1. I have a movieclip (the character)
2. When i click somewhere on the map i want this movieclip to move there. Not instantly but moving over the screen to that point where you clicked.
3. I also want there to be passages that when the movieclip hit that movieclip (named hit for example) it stops dead and doesn't move (will be used on the map for mountains and such) and the player has to click somewhere else to move it that path (im assuming this will be something like onhit: hit - speed=0 something but im not a good scripter and it would had to be worked into the script.
4. ok this one is kinda optional but would be great! If it's possible to have it worked in the script that when the clip doesn't move (and is stationary on the map) the movieclip stays on frame 1 but when the movieclip is in motion (and moving across the screen) the movieclip is on frame 2 (and reverts to frame 1 when it's not moving anymore and so no)
View 15 Replies
Sep 17, 2009
I am trying to get an object to rotate similar to the globe on this sitei have found the
code:
onClipEvent(enterFrame){
_rotation += (Math.floor(180*Math.atan2(_ymouse,_xmouse)/Math.PI)+90);
[code].....
View 5 Replies
Dec 27, 2010
at first ihave 3 frames coded with AS3
frame1 has var i = 0;
then frame2 has AS3 buttons (action inserted)
function Click(e:MouseEvent):void {
gotoAndPlay(2); var i = 1;
and the last one has (without click, this one works very well)gotoAndPlay(2); i++ (but it gets i=0; on click)how can i change the value ? (and this way works very well on AS2)
View 4 Replies
May 26, 2009
I have recently made a piano in CS3 using AS2. The basic idea is that you can both click on a piano key and click on a key on your keyboard to hear the sound that particular key makes.Everything works just dandy apart from the fact that the sound doesn't seem to work at all.Below I have posted the action script (the comments are in Dutch) perhaps you'll need the FLA file as well.
Code:
stop();
//Maakt een sound object en verbind het met de piano movie clip op de stage
[code].....
View 1 Replies
May 14, 2009
im loading a swf into my flash but the whole swf that is loaded gets the "click hand"
is there a way to get rid of this?
View 5 Replies
Oct 12, 2010
All of my buttons load their respective external swf files. However, they load on top of each other. How do I set each button to UNLOAD the external swf's that have already been loaded by the previous buttons.Here is what I have now:
movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF);
var fl_Loader:Loader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad:Boolean = true;
[code]......
View 2 Replies
Jan 6, 2012
I have a most simple animation which I want to start on mouse click. I use CS5 and ActionScript 3.0. I have one layer where my animation is in, and an actions layer. When I add a stop(); at frame 1, the whole thing does not start. So far, so good. How do I tell Flash that it should then start the animation after clicking the mouse?I am a complete newbie but have tried since hours to overcome this problem.
View 3 Replies