Multiple "on Press" Commands?
Can I use a button that "on press" tells current scene to finish playing then when that is done go to and play a specific other scene? Do I need to use "if" variable to check the current frame location? The big picture is that I want a movie/motion to finish/wrap up a movie when a button is clicked then proceed onto the next movie/motion specified. Any thoughts? Deadline oriented please help!
FlashKit > Flash Help > Flash ActionScript
Posted on: 02-27-2002, 12:29 PM
View Complete Forum Thread with Replies
Sponsored Links:
Two Commands On One Button Press
okay i have a button called "infobutton". i want it that when a user hits that button, variable scene is set equal to "info". got that down (i think).
next i want that after the variable is stored, the movie is continued (just a play(); command).
i cant figure out how to put the variable storage and the play command so they both happen on a button press.
heres what ive got:
Quote:
on (press) {
scene = "info";play();
}
thanks in advance,
scotty
View Replies !
View Related
One Button, Multiple Commands? :(
Hi all,
i got a bit coursework for uni and everythings going perfect, all the content and video done but im totally stuffed on this and my patience is now almost evaporated.
So any help would be welcome
Well basically, i got a small dot that follows the mouse and thats fine. When you click it the menu._visible part is either on of off. I can base the after effects footage (for the transitional menu)to play on that simple fact. I can also get the menu to stop following the mouse based on that fact.
So hes quality.
However i cant seem to do this simple instruction and once apon a time when i was ok at this i remember i ran into this problem.
I been tryin all kinds of mad stuff.
even things like menu._visible!=
Like i knew it wouldnt work but thats what i mean, i tried everything!
So how on 1 click can i just take the oposite value of what the _visible state actually is.
Click Button > oh the menu is visible so we will get rid of that.
or
Click Button > ah the menu aint there so now it will be
It seems a really simple concept but i have tried ifs, if elses an everything and nothing works
Thanks all
(my spelling seems to be fading too, maybe summit wrong)
View Replies !
View Related
Multiple Commands In One Button
I am working on an interface for a music site. One of the buttons on the navigation when pressed needs to plays an animation sequence on a different scene (around 30 frames) before jumping to another scene with the content.
I seem to have trouble figuring out what would be the actionscript for such a button. Any help from members on this forum would be greatly appreciated.
Cheers
View Replies !
View Related
MULTIPLE COMMANDS ON 1 BUTTON
Hello,
Could someone please tell me how to script multiple commands to a button?
I basically need a button, when clicked to:
A: go to and play at frame 90
B: play until frame 100 and stop
C: Start playing again at frame 110
I know that I can do this with an actions layer in the main timeline, but the thing I need to achieve requires that I do it this way.
Sorry to bug you and thanks for the help! :D
Kambiz
View Replies !
View Related
Multiple Stop Drag Commands
Ive a problem... I have created my own mouse cursor and used start drag and lock to center which works great.
But in a movie im loading in I have a scrolling text field with a button which is dragable to move the text as well as up and down buttons.
When I click and drag this dragable button to scroll the text my custom mouse cursor stays wher it is and no longer lock to the mouse.... this is probably something to do with the stop drag command on the other button.. but it shouldny as the stop drag command is only targeted at that button ???
Ive tried an on clip event on the cursor to hide it when the mouse is pressed which half works but I have to click the mouse again somwhere in the movie to get it to lock back to center... can anyone help
Many thanks
David Mattock
dave@mattockgraphicdesign.com
View Replies !
View Related
Multiple Goto Commands On Button
i have a movie that im controlling with another movie full of buttons. the timeline of the picture movie requires a button with two commands to get it to a certain spot. so the question is can a button have two different commands for the same external movie.
a Button symbol contained in a button movie with two commands controlling separate movie called background.
_root.background.gotoAndPlay (14)
_root.background.gotoAndPlay (227)
i tried this and it didnt move the timeline.
thanks
the reason i need this is that i have three pictures on a background that i want to have fade in and out controlled by button instances. click one button, the original fades out and is replaced with the one that was clicked. choose another button and the prior image fades and is replaced with the newly chosen one. i know that there has to be an action scipt out there that letsme do this please help!!!!!!
View Replies !
View Related
Actionscipt Help For Multiple Button Commands
Hi
I hope someone can help me with a problem I am having with a site I am trying to do for a friend in Flash MX 2005.
Its for a gallery. I have a button that has to open and shut a door while the next gallery picture loads. The door is a movieclip with sound and I have that working perfectly.
Where I get stuck is i told the button "on press" to play the door movie clip which is fine. And also I tell the button "on release" to the nextframe to show the next gallery picture (on main scene timeline not movie clip) but the gallery picture is coming up before the door movieclip open and shuts. I would like to know the actionscipt I need to insert to make it that the nextframe doesn't come up before the door has shut. Is there a way to delay the nextframe command?
Thank you for any advice you can give.
View Replies !
View Related
Multiple Commands With DragOver/Drop
Hello, I was wondering if anyone could point me in the right direction: I have a dog movie clip and a bone movie clip. I would like to have the following happen - when I move the bone over the dog, it wags its tail and when the bone moves away from the dog, it barks.
Right now, I have the bone moving over the dog via StartDrag/stopDrag/droptarget and it does wag, but when I move it away, nothing happens. Also, I can only do the moving and wagging one time (i.e. one click)
Any help would be appreciated - thanks!
View Replies !
View Related
Multiple Play Commands With On(release)
Hi,
I know this may be real simple, but I'm quite new to Flash & scripts, so I hope you'll bear with me.
I'm trying to write the action script for a button, that when pressed will perform 2 actions, one right after the other, without any other event happening. The actions are:
(upon mouse click)
1st - Play from here to the next Stop command (this one I've got working)
2nd - GotoAndPlay (s5).
I'm not sure how to combine these two actions within the same "on (release)" action.
Any help would be appreciated,
dave
View Replies !
View Related
Multiple LoadMovie Commands Causes Autoloading?
Hello all:
I have a unique issue. I have created a preloader that will preload multiple jpegs but for some reason once I hit more than three files at one time, Flash seems to take over and begin to fire the loadMovie commands prematurely. Is there a limit to how many files you can preload?
Thanks,
John
View Replies !
View Related
Multiple LoadMovie Commands Causes Autoloading?
Hello all:
I have a unique issue. I have created a preloader that will preload multiple jpegs but for some reason once I hit more than three files at one time, Flash seems to take over and begin to fire the loadMovie commands prematurely. Is there a limit to how many files you can preload?
Thanks,
John
View Replies !
View Related
Multiple LoadMovie Commands Causes Autoloading?
Hello all:
I have a unique issue. I have created a preloader that will preload multiple jpegs but for some reason once I hit more than three files at one time, Flash seems to take over and begin to fire the loadMovie commands prematurely. Is there a limit to how many files you can preload?
Thanks,
John
View Replies !
View Related
Multiple Key Press
Is it possible to have more than one key press for a button at the same time? ex:
instead of just:
on(release, keyPress "<Enter>")
something like:
on(release, keyPress "<Enter>", keypress "<space>")
I am sure there's a way
I just have the syntax all wrong!
View Replies !
View Related
Multiple Key Press
Okay, I want to do a multiple key press that allows the user to press "ctrl + c" but there seems to be some problem using the ctrl key with another key. Below is my key listener code. The strange thing is that it works if you have the "c" key pressed first and then press down "ctrl", but if "ctrl" is pressed first it never catches the "c". I'm assuming that this is probably running into problems because flash already catches "ctrl + c" for copying text but I'm hoping somebody can think of a good work around.
ActionScript Code:
var keyListen:Object = new Object();
keyListen.onKeyDown = function(){
if(Key.isDown(Key.DELETEKEY)){
EditDelete();
}
//Copying Items
if(Key.isDown(Key.CONTROL) && Key.isDown(67)){
EditCopy();
}
}
Key.addListener(keyListen);
Thanks in advance,
--carriker
View Replies !
View Related
Multiple Key Press Help
I'm working on a simple game where the object is to hit as many keys as possible in a given time and then be given a score.
I have used the following code:
Code:
keyListener = new Object(
keyListener.onKeyDown = function() {
numlol++;
};
Key.addListener(keyListener);
}
However, when the time runs out and you're taken to the screen where your score is displayed, the actionscript continues running and you still gain points by hitting the keys.
I've tried using a boolean, but it did not do anything. Any help?
View Replies !
View Related
Multiple Button Press -- Can You Do It?
i'm building a music mixer... i assigned each track to a seperate button to switch it on or off, and it works well. it gets trickier, hwvr, when i want to be able to flip multiple tracks on or off at the same time...
it appears that i cannot press 2 buttons at the time... in other words pressing button1+button2 != press "button1" and press "button2", but press "button1+button2"
that's fine, i accept that. but how can i differentiate them as invid keys? is there a workaround?
PLUS, i am generating these keys dynamically, as well as there will be 2 to say 10 keys, so it must be a dyanmic checking function of some sort. any help or direction would be greatly appreciated.
thanks,
jwt
View Replies !
View Related
Multiple Key Press Detection
I'm trying to run a function when a combination of three keys are pressed. If I want to detect LEFT, DOWN and SPACE arrows simultaneously, all works fine, but as soon as I change it to detect RIGHT, DOWN and SPACE arrows, it doesn't work.
This is the code I'm using:
Code:
myListener = {}
myListener.onKeyDown = function() {
if((Key.isDown(Key.LEFT)) and (Key.isDown(Key.DOWN))and (Key.isDown(Key.SPACE))){
trace("keys are pressed");
}
}
Key.addListener(myListener);
Any ideas?
View Replies !
View Related
AS3 KeyboardEvent Multiple Key Press?
My question is: How can I retrieve all the keys that were pressed at the time a KeyEven occured.
The keyCode property only stores one Key. This means that, if I was making a game for example and wanted to have it so that if the up key and the left key were pressed it would move up and left at the same time.
I've tried extending the keyboardEvent class and storing the keyCodes in an array, but It returns an error.
Here's my class.
package{
import flash.events.*
public class KeyEvent extends KeyboardEvent{
public static const KEYS_DOWN = "keysdown";
private var keys:Array;
public function KeyEvent(type:String){
super(type);
keys=new Array()
}
override public function set keyCode(value:uint):void {
keys.push(super.keyCode)
}
override public function get keyCode():Array {
return keys.concat()
}
override public function clone():Event{
return new KeyEvent(type);
}
}
}
Anyone know a good way to do it?
View Replies !
View Related
Press And Unload ( Multiple )
I have up to 4 buttons on a particular frame which will correspond to answers of a quiz.
They are individually generated by the quiz, and all 4 need to be unloaded when one of them is pressed.
Can someone please give me a hint as to how I can acheive this or point me in the right direction? Thank you!
What happens when a question will be displayed onscreen...
Code:
function DisplayQuestion( curQuestion:Question )
{
// Update the display
question_title.text = curQuestion.GetTitle();
// Indicate which question out of our total we are on
step.curQuestionText.text = myQuiz.GetCurQuestionText();
// Retrieve this question's options
var curOptions = curQuestion.GetOptions();
// Loop through our options
for(var i=0;i<curOptions.length;i++)
{
// Determine the next layer available to draw on
var depth = _root.getNextHighestDepth();
curOptions[i]._x = buttonXStart;
curOptions[i]._y = buttonYStart+((50+buttonMargin)*i);
// Draw our movieClip on the stage, with a 5 pixel bottom margin
this.attachMovie("Option", 'option'+i, depth, curOptions[i]);
// Set a variable we can use to access this clip
var newClip = _root.getInstanceAtDepth(depth);
// Set the option's Number
newClip.option_id.text = i+1;
// Set the option's Title
newClip.option_title.text = curOptions[i].GetTitle();
// Fade the option into place
var slider = new Tween(newClip, "_y", Regular.easeOut, 700, 140, 1, true);
slider.continueTo(buttonYStart+((50+buttonMargin)*i), 1);
// Introduce our buttons one at a time
newClip.pressed = false;
// Trigger an event when our button is destroyed
newClip.onUnload = function()
{
var f = new Tween(this, "_alpha", Regular.easeOut, 0, 100, 2, true);
//var x = new Tween(this, "_x", Regular.easeOut, 0, 100, 2, true);
//x.continueTo(100, .33);
f.continueTo(100, .33);
}
// Trigger an event when our button is clicked
newClip.onPress = function()
{
// This is definitely not the way I wanted to do this, but it works for now...
curQuestion.SetOptionChosen( curQuestion.GetOptionAt( this.option_id.text-1 ) );
unloadMovie(this);
} //end onPress
// Trigger an event when we hover over this button
newClip.onRollOver = function()
{
var fOut = new Tween(this, "_alpha", Regular.easeIn, 100, 0, 0, true);
fOut.continueTo(0, .33);
var fIn = new Tween(this, "_alpha", Regular.easeIn, 0, 100, 0, true);
fIn.continueTo(100, .33);
} //end onRollOver
} //end for loop
}
View Replies !
View Related
Multiple Button Press
Need some help...
Here's my code:
on (rollOver) {
tellTarget ("rollover") {
gotoAndPlay("text7IN");
}
}
on (rollOver) {
tellTarget ("headings") {
gotoAndPlay("Heading7");
}
}
on (rollOut) {
tellTarget ("rollover") {
gotoAndPlay("text7OUT");
}
}
on (rollout) {
tellTarget ("headings") {
gotoAndPlay("HeadingOUT");
}
}
on (press) {
tellTarget ("rollover") {
gotoAndPlay("text7-2");
}
}
The UI is simple...this is a simple button with a rollover/rollout technique. As a user rolls over this button, it displays a "pop-up" Header and "pop-up" text area in separate areas of the stage. Everything is working great. However I need one more action. When a user "hovers" over this button and "presses" - it correctly moves to "text7-2" (btw...there is a stop action at this frame that keeps the text area, (page 2), displayed). I want another "press" action to move to another frame - "text7-3" (page 3). All the code I've tried doesn't work..
Any clues on pressing a button multiple times to advance in the timeline.
View Replies !
View Related
Key Press Over Multiple Scene Issue
Ok... let me explain in the simplist possible way as it really isn't had to understand, but it's very very frustrating.
The problem is that i'm doing a media player and it has multiple symbol definitions i.e one for the Audio Player and one for the Volume Control.
I've assiged the volume control to go up with the + key and down with the - key. now...
When i test the scene the keyboard ONLY works when i click the mouse inside the player movie... if i click inside and then use the keyboard to go up and down, it works... when I click outside it stops responding to the keyboard...
How can i make the event listener activate the scene without having to click into it directly?
Here is a screenshot to help with my explination... pleaseeee help it's driving me nuts!!!
View Replies !
View Related
Multiple Key Press/Release Problem
I've been posting all over looking for replies and nobody seems to be able to help. Hopefully I'll have better luck here!
I'm working on a game in which the character moves forward and backward with the UP and DOWN arrow keys and turns by rotation using the LEFT and RIGHT arrow keys. Basically you control him the way you would normally control your vehicle in a flash driving game.
When you press UP (and move forward), it plays a frame in the character movie clip labeled "forward" that shows the animation of the character walking forward. When you press DOWN (and move backward), it plays a frame in the character movie clip labeled "back" that shows the animation of the character walking backwards. When you press LEFT or RIGHT (and rotate left or right), it remains on the frame it was on before you pressed LEFT or RIGHT, so if you were standing still it remains on the "idle" frame and if you were walking forward or backward it will remain on the corresponding walking animation frame.
I also tried to include some code at the end so that when none of the keys are being pressed it goes to that same "idle" frame, to keep the character from "walking in place" when he should be standing still.
SO...when you walk forward then let off the UP key, works fine. Character goes to the idle frame. When you walk backward then let off the DOWN key, works fine. Character goes to the idle frame. The problem lies when two keys are pressed at once then let go of, but only sometimes. Hopefully I can explain this without sounding too confusing/out of my mind.
When you're holding UP and LEFT simultaneously (for example, you're walking forward then you decide to turn left while still holding forward) and then let off both keys at once, depending on which key was let go of first the character will sometimes be left "walking in place" instead of going to the idle frame like it should. I came to the conclusion that this happens if the LEFT key is let off first, then the UP key. If the UP key is let off first, then the LEFT key, it goes idle like I want it to.
Now...
Is there ANY way to fix this? Here is the current character script...
----------------------------------------
onClipEvent (load)
{
speed = 2;
}
onClipEvent (enterFrame)
{
// movement
if (Key.isDown(Key.UP))
{
this.gotoAndStop("forward");
this._y -= Math.cos(_rotation*(Math.PI/180))*speed;
this._x += Math.sin(_rotation*(Math.PI/180))*speed;
}
else if (Key.isDown(Key.DOWN))
{
this.gotoAndStop("back");
this._y += Math.cos(_rotation*(Math.PI/180))*(speed/1
);
this._x -= Math.sin(_rotation*(Math.PI/180))*(speed/1
);
}
// rotation
if (Key.isDown(Key.LEFT))
{
this._rotation -= 3;
}
if (Key.isDown(Key.RIGHT))
{
this._rotation += 3;
}
}
onClipEvent (keyUp)
{
if (Key.getCode() == Key.RIGHT)
{
this.gotoAndStop("idle");
}
if (Key.getCode() == Key.LEFT)
{
this.gotoAndStop("idle");
}
if (Key.getCode() == Key.DOWN)
{
this.gotoAndStop("idle");
}
if (Key.getCode() == Key.UP)
{
this.gotoAndStop("idle");
}
}
----------------------------------------
I thought the keyUP stuff at the bottom would basically tell the game that if at any time none of those keys (UP, DOWN, LEFT, RIGHT) are being pressed then the character MUST go to the "idle" frame, but perhaps I misunderstood it. Is there a different script that will have this effect?
I would really appreciate any help you guys (or girls) can give, it's little issues like these that can really discourage me and often mean the end of a project when I can't find a solution. Thanks in advance!
View Replies !
View Related
Multiple Key Press Problem (UP And LEFT)
Hi all,
I'll get straight to the point. I suspect there is some type of bug in Actionscript 2.0 that occurs when the user holds down the UP and LEFT arrow keys simultaneously while running a program. To me, it seems that while these two keys are held down, any functions written using setInterval, keyListerners, or onEnterFrame methods will not be executed.
I suspected this while writing code for a simpe game I was developing recently. I had a character move around freely using the arrow keys and the spacebar allowed this character to jump. My code allowed the character to move diagnolly and even jump diagnolly. However, as I held the UP and LEFT arrow keys, and pressed the spacebar, my character would not jump in the NW direction as it had for the NE, SE, and SW directions.
This did not make sense to since my code for initializing a jump animation is completely independant of any other key presses.
Code:
stop();
setInterval(jump, 50);
function jump() {
if (Key.isDown(Key.SPACE)) {
//play next frames which is jump animation
play();
}
}
As you can see, it does not matter what keys are pressed, as long as the program detects the SPACE key being held it should execute the following lines. But it did not execute play(); while UP and LEFT were being held down for some strange reason.
I tried isolating and testing the problem to see if other bits of written code weren't affected it by creating a new blank document and writing the following lines of code in the first frame.
Code:
setInterval(Action,50);
function Action() {
if (Key.isDown(Key.SPACE)) {
trace("Jump");
}
}
I ran the program, pressed the Spacebar and it indeed displayed my trace method. Then I held down the RIGHT and DOWN arrow keys and pressed SPACE and that too displayed my trace. I repeated this with every 2 key combination and each of them were working. However, when it came time for UP and LEFT and pressing Spacebar, the trace method would not execute. And that is how I concluded there must be something wrong with the way Actionscript 2.0 handles that multikey press event.
So is there anyone who has already encountered this problem and can help me out with either a work-around or a good explanation of why this happens? Or is it just me and my bad luck?
View Replies !
View Related
Another Multiple Button Press Question
Wow, there are a lot of these in this forum!
Here's my code:
Code:
//keypress
var keyListener: Object = new Object()
keyListener.onKeyDown = function(){
//trace(Key.getCode())
if(Key.getCode(38)){
trace("UP btn pressed")
}
if(Key.getCode(40)){
trace("DOWN btn pressed")
}
}
keyListener.onKeyUp = function(){
if(Key.getCode(38)){
trace("UP btn released")
}
if(Key.getCode(40)){
trace("DOWN btn released")
}
}
Key.addListener(keyListener);
My problem here is that if two buttons (in this example, UP and DOWN arrow keys) are pressed and held down, then one is let go, BOTH of them register as KeyUp. I really need them to be separately set. Any ideas?
*Note: my ultimate goal is to read when multiple keys are individually pressed and when they are independently released. I noticed that a keyboard press will register once, pause, then repeatedly register presses. I'm trying to get rid of that pause. I was eventually going to have this code set variables to true/false, then have an interval loop tell the MC where to go based off of those variables. If there is a better solution than what I have, I'd be grateful, as this issue has been plaguing my projects for LONG time!
Thanks in advance for any/all feedback!
View Replies !
View Related
Key Press Thru Multiple Frames Problem
My apologies if this has been addressed previously. I didn't find an answer initially via a search.
I have a slideshow where the user has the option of either pressing a key or clicking a button to advance screens. On each slide MC, I have the following script:
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.nextFrame();
}
}
The problem is that if the RIGHT ARROW key is held down too long (ie, half a second vs. .1 seconds) the slideshow skips through multiple slides so quickly that a user might not even be aware that s/he's skipping slides.
Is there a way to specify key release instead of key down? Or do I need to implement the 'on (release, keyPress"<RIGHT>")' button script? I'm not exactly sure if that code for the button is correct either.
Any help would be appreciated.
Thanks,
-app
View Replies !
View Related
[AS] Key Press How To Avoid Multiple Presses
hi guys,
i'm trying for the first time to use the left and right arrow keys to navigate from one icon to the next on stage.
i used this code:
ActionScript Code:
this.onEnterFrame = function() {
if (Key.isDown(Key.RIGHT)) {
if (p<9){
p++;
displayPic(p);
} else {
p=1;
displayPic(p);
}
} else if (Key.isDown(Key.LEFT)) {
if (p>1){
p--;
displayPic(p);
} else {
p=9;
displayPic(p);
}
} else {
// do nothing
}
}
the problem is, that when i press the arrow key, i have to be real quick or the p var starts counting up really rapidly...
is there a way i can make p go up ONE increment at a time, no matter how long the key is being held down? you know, kinda like, "p goes up or down one notch per press"
thanks for any help!
twan
View Replies !
View Related
Press/Release Multiple Keys - Problem
I'm working on a game in which the character moves forward and backward with the UP and DOWN arrow keys and turns by rotation using the LEFT and RIGHT arrow keys. Basically you control him the way you would normally control your vehicle in a flash driving game.
When you press UP, it plays a frame in the character movie clip labeled "forward" that shows the animation of the character walking forward. When you press DOWN, it plays a frame in the character movie clip labeled "back" that shows the animation of the character walking backwards. When you press LEFT or RIGHT, it goes to a frame in the character movie clip in which the character is idle (just standing still). I did this so that the character isn't "walking in place" while turning. I also tried to include some code at the end so that when none of the keys are being pressed it goes to that same "idle" frame, to keep the character from "walking in place" when he should be standing still.
SO...when you walk forward then let off the UP key, works fine. Character goes to the idle frame. When you walk backward then let off the DOWN key, works fine. Character goes to the idle frame. The problem lies when two keys are pressed at once then let go of, but only sometimes. Hopefully I can explain this without sounding too confusing/out of my mind.
When you're holding UP and LEFT simultaneously (for example, you're walking forward then you decide to turn left while still holding forward) and then let off both keys at once, depending on which key was let go of first (a matter of milliseconds) the character will sometimes be left "walking in place" instead of going to the idle frame like it should. I came to the conclusion that this happens if the LEFT key is let off first, then the UP key. If the UP key is let off first, then the LEFT key, it goes idle like I want it to.
Now...
Is there ANY way to fix this? Here is my current character script...
----------------------------------------
onClipEvent (load)
{
speed = 3;
}
onClipEvent (enterFrame)
{
// movement
if (Key.isDown(Key.UP))
{
this.gotoAndStop("forward");
this._y -= Math.cos(_rotation*(Math.PI/180))*speed;
this._x += Math.sin(_rotation*(Math.PI/180))*speed;
}
else if (Key.isDown(Key.DOWN))
{
this.gotoAndStop("back");
this._y += Math.cos(_rotation*(Math.PI/180))*(speed/1);
this._x -= Math.sin(_rotation*(Math.PI/180))*(speed/1);
}
// rotation
if (Key.isDown(Key.LEFT))
{
this._rotation -= 10;
this.gotoAndStop("idle");
}
if (Key.isDown(Key.RIGHT))
{
this._rotation += 10;
this.gotoAndStop("idle");
}
}
onClipEvent (keyUp)
{
if (Key.getCode() == Key.RIGHT)
{
this.gotoAndStop("idle");
}
if (Key.getCode() == Key.LEFT)
{
this.gotoAndStop("idle");
}
if (Key.getCode() == Key.DOWN)
{
this.gotoAndStop("idle");
}
if (Key.getCode() == Key.UP)
{
this.gotoAndStop("idle");
}
}
----------------------------------------
I would really appreciate the help, it's little issues like these that can really discourage me and often mean the end of a project when I can't find a solution. Thanks in advance!
View Replies !
View Related
Multiple Key Press Detection In Flash 8. Fixed?
I've been searching everywhere and there seems to be no answer to this bug.
Scenario:
Using Key Listener, onKeyDown, onKeyUp...
"A" is pressed. onKeyDown detects "A" pressed. *OK
Then, "B" is pressed. onKeyDown detects "B" pressed *OK
"B" is released. onKeyUp detects "B" being released *OK
"A" is released. onKeyUp doesn't catch anything. *BUG!!!!
This scenario works fine pre-F8.
If you know the answer, work around, for this bug. PLEASE HELP!!!!!!
BTW, the movie HAS to be in Flash 8 because of the new stuff I used in it.
Thank you in advanced!
View Replies !
View Related
Key Class Problem With OnKeyUp, Multiple Key Press
Hi there,
I have been playing around with the key class in flash as I want to use the keyboard to control a game. I noticed however that it seems to have problems with pressing of multiple keys. Using the code below do the following.
1. Press and hold the space bar(the onKeyPress event is continulously triggered)
2. Whilst that key is still held down press another key(triggers onKeyPress and onkeyUp)
3. Now release the original key(Spacebar) and you will see that the onKeyUp event is not triggered.
Basically I want the user to be able to hold down a key to control movement whilst pressing other keys to shoot etc...
Any help would be appreciated
here is the code...
Code:
var globalPressListener=new Object();
Key.addListener(globalPressListener);
globalPressListener.onKeyDown=handleKeyPress;
var globalReleaseListener=new Object();
Key.addListener(globalReleaseListener);
globalReleaseListener.onKeyUp=handleKeyUp;
//=====================================================
//=====================================================
function handleKeyPress(){
var keyPressed:String=getKeyPressed();
trace('keyPressed = '+keyPressed);
}
//=====================================================
function handleKeyUp(){
var keyReleased:String=getKeyPressed();
trace('keyReleased = '+keyReleased);
}
//=====================================================
function getKeyPressed():String {
var theKey:String;
switch (Key.getCode()) {
case Key.BACKSPACE :
theKey = "BACKSPACE";
break;
case Key.SPACE :
theKey = "SPACE";
break;
case Key.LEFT :
theKey = "LEFT";
break;
case Key.RIGHT :
theKey = "RIGHT";
break;
case Key.UP :
theKey = "UP";
break;
case Key.DOWN :
theKey = "DOWN";
break;
default :
theKey = String.fromCharCode(Key.getAscii());
}
return theKey;
}
View Replies !
View Related
Multiple Key Press Detection In Flash 8. Fixed?
I've been searching everywhere and there seems to be no answer to this bug.
Scenario:
Using Key Listener, onKeyDown, onKeyUp...
"A" is pressed. onKeyDown detects "A" pressed. *OK
Then, "B" is pressed. onKeyDown detects "B" pressed *OK
"B" is released. onKeyUp detects "B" being released *OK
"A" is released. onKeyUp doesn't catch anything. *BUG!!!!
This scenario works fine pre-F8.
If you know the answer, work around, for this bug. PLEASE HELP!!!!!!
BTW, the movie HAS to be in Flash 8 because of the new stuff I used in it.
Thank you in advanced!
View Replies !
View Related
Button Press + Key Press Together In Perfect Harmony?
Well, i have been trying now for a while to get my buttons to display the corresponding number in a text box. I have achieved it so that if you click on the button with the mouse cursor it will happen. I can also do this for a keypress, but sadly they will not work as an either/or option. What actually happens is that the keypress is disabled until the mouse has activated the on release.
Here is the code:
on (release){
if (password == "") {
password = "1";
} else {
password += "1";
}
}
on(keyPress "1"){
if (password == "") {
password = "1";
} else {
password += "1";
}
}
Any suggestions will be greatly welcomed.
Thanks
Yoda
View Replies !
View Related
Combo Key Press, Double Key Press Ect
HELLO, this is common code for action "when u press key go to "frame""
Code:
if (Key.isDown(Key.UP)) {
_parent.gotoAndPlay("frame");}
i want to ask if any1 know code for actions:
1. when u press combo key UP and then key DOWN(down after up in like 0,5 sec or smth) goto "frame"
2. when u press 2 keys AT once (f.e. up+down arrows)
3. when u press key very fast twice - goto "frame"
GREETINGS !
View Replies !
View Related
[F8] Key Press To Mouse Press
The code below is a sample i want to change to onMousePress from keyPress. my attempts have not worked. come someone give me some pointers?
rat
PHP Code:
fscommand ("fullscreen", "true");
fscommand ("allowscale", "false");
Stage.scaleMode = "noscale";
stop();
// use spacebar to re-draw screen
var canvasArray = new Array();
for (var p in this) {
var curCanvas = this[p];
if (curCanvas instanceof MovieClip) {
canvasArray.push(curCanvas);
}
}
pressSpacebar = new Object();
pressSpacebar.onKeyDown = function() {
if (Key.isDown(Key.SPACE)) {
for (var i=0; i<canvasArray.length; i++) {
var curCanvas = canvasArray[i];
curCanvas.drawCanvas();
}
}
}
Key.addListener(pressSpacebar);
View Replies !
View Related
On Press Start Drag, On Press Stop Drag. How?
Hello i have an object that i want to drag and drop with the same event.
Something like on press start drag and on press again stop drag.
Anyone can help me?
I'm sure it's pretty simple with and if and else statment but i can't find how to do that...
The best i have done so far was this:
ActionScript Code:
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
}
But i want to on press start drag then on press again stop drag.
anyone can help?
thanks
View Replies !
View Related
On Press Start Drag, On Press Stop Drag. How?
Hello i have an object that i want to drag and drop with the same event.
Something like on press start drag and on press again stop drag.
Anyone can help me?
I'm sure it's pretty simple with and if and else statment but i can't find how to do that...
The best i have done so far was this:
Code:
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
}
But i want to on press start drag then on press again stop drag.
anyone can help?
thanks
View Replies !
View Related
Add A Movieclip On Button Press, Remove On Another Button Press...
Sounds a little confusing maybe, but the idea is rather simple... I'm trying to figure out a way to have a + and a - button. When a user hits the + button, a movieclip appears. If they hit it again, another duplicate movieclip appears next to the first, etc... basically adding movieclips along the x-plane. Now, when the user hits the - button, the movieclip on the furthest right-hand side is removed, when hit again the next movieclip furthest on the right-hand side is removed, etc until there are no more movieclips.
It's basically an add and subtract movieclip function but I have no idea how to set this up. Any tips or advice would be greatly appreciated! thanks in advance!
View Replies !
View Related
Fs Commands On Mac?
Do fs commands work on macs? I seem to remember reading where they DON'T but in order for my flash banners to be tracked via the "engage system" teh "how-to" instructions from the engage people used fs commands. I need to track these ads, and it's not up to me whether or not we use engage or not... so that is a must. Do fs commands do something that cannot be accomplished through javascript calls, etc.... and am I correct in thinking the issue I am having with macs IS the use of fs commands?????
Thanks in advance.
Elias
View Replies !
View Related
Fs Commands Plus
i made myself a flash file that exec's progs for me, as a shortcut tool bar thing. i want to have a text area to add extra commands to original FS in the flash eg c:/windows/something.exe. then add after in text box in tool bar made from flash - + other varialbles. like adding a mapname to executing Half-life.
HELP
NETDEVEL
View Replies !
View Related
FS COMMANDS
in the stand alone player, how do i get the FS Command "allow scale" to work? I want it to be false, but when i try it, it still allows it to be scaled.....anybody knows whats wrong??
View Replies !
View Related
FS Commands
I want to have a button that exits the flashplayer. I'm publishing an exe file and running that. I want the button to exit the player.
Please Help
View Replies !
View Related
Fwd And Rwd Commands
I am having a bit of trouble figuring out how I can make the movie go back x amount of frames, or forward an x amount of frames, at the on (release) action command of a button. CAN ANYONE please give me a tip?
Thanks in advance.
View Replies !
View Related
FS Commands
Can anybody give the entire range of arguments possible with FS Command.
Also when I use the FSCommand with the save argument, it saves some other information alongwith the variable contents.
Please help.
View Replies !
View Related
FS Commands
I am creating a projector that will be resized to fill a large plasma screen. The problem is that when subsequent movies are loaded into the parent the movie reverts to its original dimensions. I have heard of FS commands. Will they help me and were can I learn about them in a hurry. (Flash 5)
Thanks
View Replies !
View Related
FS Commands
I am using an FS Command to call a javascript function on the page from within my SWF file. When I have the button within the main timeline of the movie the command works (on release it calls the command). But when I try to nest the movie within a movie clip on the main timeline the FS Command quits working. Do I need to reference it differently from within the movie clip? I haven't seen any documentation on it.
View Replies !
View Related
Key Commands
I am trying to set up a program that recognizes key presses.
I want the program to stop on the frame until there is a valid key press.
How would I do that?
I'm using Flash MX 2004.
View Replies !
View Related
FS Commands?
Hello,
Is the anyway of specifying a movie to be 80% of the users monitor size? I presume it will be with an FS command. I know this - fscommand("fullscreen", "true"); - makes a movie fit to a monitors size, but what if I want it to be 80% of the monitors size with a border all around to block out the users desktop?
any ideas?
Thanx in advance
View Replies !
View Related
|