ActionScript 3.0 :: Press Buttons On Screen To Move Character Left Or Right?
Nov 3, 2010
i am doing this: press buttons on screen to move character left or right, "swipe" elsewhere on screen to do other stuff.
This is how i have handled it:
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
stage.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);
stage.addEventListener(TouchEvent.TOUCH_END, onTouchEnd);
buttonContainer.addEventListener(TouchEvent.TOUCH_ OVER, tOver);
buttonContainer.addEventListener(TouchEvent.TOUCH_ OUT, tOut);
this works fine, just wondering if anyone has another way to handle it. it seems excessive to have 4 handlers for touch input, but i cant figure out any other way.
TOUCH_OVER and TOUCH_OUT check a switch statement to enable/disable buttons within buttonContainer.
TOUCH_BEGIN and TOUCH_END are used to store points and get a "swipe angle" (only if TOUCH_END is not over a button)
my only problem is i started having glitch's i think becuase so many listeners including: ORIENTATION_CHANGE, KeyboardEvents, Event.DEACTIVATE
this is why i ask if perhaps im missing someway to simplify the touch input listeners
View 1 Replies
Similar Posts:
Sep 24, 2010
I have a 9 frames image of a character.In other language generally i used to make character animation by looping the array consisting of different frames and drawing each frame when pressing key.What i want to do is when i press left or right key, i want to draw each frame that makes character movement and update x coordinates of frames, and it will appear as character is moving.
View 4 Replies
Feb 5, 2005
i want a my_mc to move when i press the < LEFT> arrow but also to fire and onEnterFrame event so it will move.. and also to delete the onEnterFrame when the key is not pressed so the onENterFrame is not going on in the background
View 4 Replies
Feb 1, 2004
I got a character to move. I want the player to be able to move the character to a button then press spacebar on it. Which will take them to another frame.
This is the code I got for the button but the trouble is u can press spacebar anywhere to go to the next frame.
on (keyPress "<Space>") {
_root.gotoAndPlay(23);
}
View 2 Replies
Dec 15, 2009
well i want to make buttons that on rollover move to left, on rollout move back to their initial position, and if clicked, they but stay this time at the final rollover place, and be there until something else is clicked. When something else is clicked, the previous button , returns to its initial place. So i ve got it all figured out except for the freeze and move part when the buttons are clicked. All it does now , is when they are clicked they freeze at the position i want, but i havent got a clue how to update them, after so they start moving back, and reacting on rollover and rollout, when the next button is clicked.
[Code]...
View 2 Replies
Nov 3, 2009
I have my character movement down, and now I want the create a map. I want the screen to move with the character, and eventually I will have it so that at certain spots on the map, the screen will not let you move and stop and enemies will come out.
View 0 Replies
May 12, 2010
I've created a walk cycle using bone tool on a character but i don't know how to make it move from one part of the screen to the other. The character is made up of 6 layers, 4 of which are armatures and 2 have motion tweens.
View 1 Replies
Oct 22, 2010
I'm creating a menu system, the text buttons should, on rollover, move all buttons to the left (of the button currently rolled over) 100 pixels, in the gap created a sub menu running vertically will appear which will break into a 2nd horizontal submenu etc. I'm still in the early stages, and have hit a stumbling block, I placed a trace (this); cmd in root of the roll over function then again in each segement of the IF/ELSE loop inside that fuction. The trace CMD in the root of the rollover gives me the feed back _level0.btn1 or 2 or what ever button I have rolled over but the ones inside the IF/ELSE loop all say _level0.btn0 regardless of the button I roll over!
[Code]...
View 2 Replies
Jan 20, 2010
How exactly do I cause the screen to move in time with the players character?
View 5 Replies
Sep 27, 2010
How do I move an image across the screen when I press a button and change its property.[code]...
View 3 Replies
Sep 18, 2009
I know everyone has wrote this a hundred times, BUT I just can't get it to work
I have a main content area called MC that is very wide Then a mask around the area I want to see of the MC
I have two buttons set up below the mask for LEFT and RIGHT
How to I make those buttons move the main content, and stop when It gets to the end of the masked area so you dont just keep scrolling
ALL I HAVE in my code right now, is attached the left and right buttons---
on(release){
MC._y = (MC._y)-50;
}
is there more to it than that? How do I stop it?
View 2 Replies
Feb 17, 2011
I want to do a web site that is very wide. so i want to put a horizontal menu on the bottom. Lets say i have 5 buttons on my menu and with these buttons i want to move the content left or right. so i could control were i want to be on my website using the buttons that just move the background or content left or right
View 2 Replies
Jan 30, 2009
This is what i have to do:
-Place 10 buttons on the screen
-Make 10 objects randomly move as i press each of the buttons.
eg: press button 1, object 1 moves to a random position press button 2, object 2 moves to a random position...
View 5 Replies
Jul 24, 2008
, i want to make a carousel -type gallery like the one from the tutorial but with a slight variation: i want it to move only when i press a button.(move left when i press the left arrow and to the right when i press the right).And i want it to move by one image at a time and i want to know which image is to the front(i've created a dynamic text field called imgName).I hope i'm explaining this correctly and i'm attaching an example with two arrows with no actions on them.
View 11 Replies
May 12, 2010
I am trying to assign buttons my on my 'gameScreen' to move my character. though I am receiving an error msg saying: Error #1010: A term is undefined and has no properties.at Mainas()
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;[code]....
View 3 Replies
Feb 20, 2005
I created the scrolling navigation, akin to [URL] by changing a script that I had. However, I'm stuck now, as all the buttons can move to the left, but not to the right. If it does not make sense, check out the attached swf and fla.
View 2 Replies
Apr 28, 2010
1. When you click on the buttons for 2 and 3, ALL three buttons move to a different part of the screen.
2. When you click on the button for 1, ALL three buttons return to their initial position.
Ideally, when the buttons move they would in fact travel across the screen rather than disappear for an instant and reappear in the new locations. Usually I would do this via a motion tween, but I can't figure out how to incorporate one here without conflicting with the other actions and thus messing everything up! I have to use a site structure similar to the one in the example because I need the intros/outros to be different for each mc.
View 0 Replies
Jun 22, 2011
I have an Image called "PanoramaImage" (which is very long in width). I want this image to move from right to left & from left to right automatically.
I am using flash as3. I am loading this image from the same folder where the .fla file exist. my image to move by using Up & Down arrow keys.
The following is the sample code i found on web.
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeHandler);
loader.load(new URLRequest("panorama.jpg"));
[Code]......
View 7 Replies
Apr 24, 2005
I have an Image called "PanoramaImage" (which is very long in width). I want this image to move from right to left & from left to right automatically.I am using flash as3. I am loading this image from the same folder where the .fla file exist. Right now I have the code which will help my image to move by using Up & Down arrow keys.The following is the sample code i found on web.
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeHandler);
loader.load(new URLRequest("panorama.jpg"));
var content_mc:Sprite = new Sprite();
[code]....
View 3 Replies
Jul 20, 2006
I have a series of thumbnails that should scroll from left to right & right to left when you roll over the movie clip buttons on either side. IT was working in another flash movie, but I moved it to a different flash file and now it's not working. The hit buttons within the movie clip buttons have this action script:
[Code]....
View 6 Replies
Feb 28, 2008
Regarding System.capabilities.screenResolutionX in FMX, how would I achieve a movie clip on my stage to automatically alight to the left of the screen/browser depending on the viewers screen resolution?
View 1 Replies
Aug 26, 2010
I am trying to get a character to jump up when I press the spacebar and come down by himself but am having a dickens of a time doing so. Here's the code I am using: This is the LevelOne class, there is also a player class:
[Code]....
View 5 Replies
Jan 6, 2003
on (press) {
/:klick = 1;
}
what does the /: do?? why is it necessary? couldnt u u use a _global.klick instead? (when i tried to change to global i used trace to see if it worked and the global doesnt get any character set when i press mouse..why is that? )
View 2 Replies
Feb 4, 2010
I am making a walk and jump game. My game would work by the character standing in a fixed place and when I press the left key he would appear to walk left but the background actually is moving right. And when I press the right key the background would move left making the character appear to move right. Now I would also like the character to jump when I press the up key. Now I have created a walk cycle in a movie clip and have a jump cycle that I could also use for the jump.
View 6 Replies
Feb 10, 2002
My only accomplishment so far with it was to create a space shooter game which i modified slightly and animated it or at least the enemy spache ships and the players spaceship.
Here is what I want to do, but cant seem to figure out
I want to have a character on screen who is standing stationary normally, but still facing a direction.(left or right)
Now I want to be able to switch to a walking animation towards the right when I press a key and a seperate animation for when he walks left also at the press of a key I want to do down and up to, but I should be able to figure those out once I learn left and right
I also want it so when I lt go of the key they stop the walking animation and return to stationary, but stay facing whatever direction i pointed them
View 7 Replies
Aug 17, 2009
i got my character to move left, right, down and up wit this code:
[Code]....
My question is, how can i block the up and down movement? I tried simply deleting some part of the script to block does movement from the user. But then the script would not work properly : s Here is the uploaded page i'm working on: link.
View 2 Replies
Dec 12, 2010
What's wrong with my code?
function moveJoeOne():void
{
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);[code].....
I've got two different instances of two different MovieClips on the stage of the fla. Visually they're identical but one is facing left and one is facing right. When the file runs, the one that's facing left appears on the stage while the one that's facing right is set to be invisible. What I'm trying to do is have the one that's facing left go invisible when the right arrow is pressed and for the one that's facing right to appear in it's place and accept further input from the right arrow key. When I run the file, the one facing left moves just fine. My problem is that when I press right, the one facing left disappears and the one facing right appears in it's place but it just moves once and stops.
View 2 Replies
Apr 11, 2004
tutorial where when you click on a movie clip it moves to a certain location on the page and then zoom in and makes it a certain size. Also i want it to move back to its original location if you click it again.I want the move and zoom to be smooth so the users can see it move across the screen then gradually get bigger.
View 5 Replies
Sep 24, 2008
I have a movieclip that will rotate by 10 right if the right button is pressed, or 10 left if the left button is pressed.Now, some genius tell me why the right button code works perfectly, but when i press left it doesnt rotate. It moves left, but no rotation to be found .heres the code
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
xspeed -= power;[code].....
View 3 Replies
Jun 23, 2009
How do you press a key (like "L") and go to the next frame?
Which event must I pick?
I assume it's something like: stage.addEventListener(Keyboard., but after that I don't know what to do.
This is for AS 3.0 by the way.
View 7 Replies