ActionScript 2.0 :: Assigning Actions To Keypresses

May 24, 2010

I've tried googling this simple action but cannot find anything that doesnt relate to something general - only specific issues.

I want to assign an action to a keypress - simple, but i cant do it with any keys other than:

pageup
pagedown
enter
space

[Code]....

id like these functions to assign ed to a standard key

View 3 Replies


Similar Posts:


ActionScript 2.0 :: HitTest - Assigning Two Actions To One Key?

Oct 1, 2007

http:[url]....

WASD and Space. This is going to be a rhythm-type game, where you have to hit space (fire) when the dots are aligned with the middle dot.Hitting space not only fires a small bullet (AS placed on the grey/white outlined button on the bottom right as an on(keyPress "<Space">)) but runs a series of hitTests to see where the dot was on the bar when you hit space (placed on the dot itself), giving you points and a ranking for how close you were to the dot. If your dot is not even on the colored bar (close to the middle dot), no points are taken.

However, a couple of odd problems have arisen. The first one is that when you start playing, the hitTests seem not to take any effect. You can hit space anywhere and the dot disappears, no ranking, no score, nothing. Even if it's on the colored bar. Here's the weird part. Hold space, firing off a torrent of bullets, and now you can play the game as it's supposed to be played. I have no idea why this is happening, and this is a major issue.

Another issue is that the hitTests on the dots are a little tough to deal with... They're working as they should, more or less, but if two of them get on the colored bar (get two on the very edges of the red), and you hit space, both of them get processed. Now, this isn't really a flaw, it's following the actionScript just fine-- I'm just not sure how to make it so that flash only processes the first one until it hits a certain point (past the colored bar), where it would then move on to process the next one the next time you hit space.

The code for the bullets and firing is an ever-so-slightly modified version of this tutorial, just using spacebar instead of a mouse click.The code for the dot hitTests:

Code:
if (Key.isDown(Key.SPACE)) {
if (this.hitTest(_root.syncBar.poorLeft) or hitTest(_root.syncBar.poorRight)) {
_root.score += 1;[code]....

The poorLeft and poorRight objects are invisible movie clips placed over the red section of the colored bar, and this code pretty much just repeats with different instance names and variable defs.

View 1 Replies

ActionScript 2.0 :: Assigning Actions To Buttons In A Loop?

Sep 17, 2004

I have is a movie with a button in it called button.i've duplicated the movie (manually) several times on the stage.the movies have been given instance names of movie1, movie2 etc.i've then used actionscript to assign actions to the buttons.i have the following code:

Code:
for (i = 1; i < 6; i++)
{

[code].....

View 2 Replies

ActionScript 2.0 :: Assigning Actions To Dynamic MovieClip?

Mar 31, 2005

Assign actions for a mc created dynamically?

View 3 Replies

ActionScript 2.0 :: Assigning Button Actions Within A Loop?

Jun 30, 2005

This function all works correctly, except where i am assigning an action to the onRelease event of a given button. Every button is assigned to the same value (appears to be the first value pulled from the array).

function createSubItems() {
vspacer = 6;
i = 0;

[Code]....

View 2 Replies

ActionScript 2.0 :: Dynamic Button | Assigning Actions?

Jul 13, 2006

I have a script; what it does is is read a numeric variable (projects) from "text.txt" and dynamically attaches a relevant number of movie clips in a row. Each one of these movie clips serves as a simple two frame "button"; frame one is the unselected state, and frame two is the selected state...


// load external data

loadData = new LoadVars();
loadData.onLoad = function() {[code]....

anyway, this script works just fine, as is. the variable reads in perfectly, the movie clips attach etc. my problem is this: I want the button that I click to go to its active state. this is no problem as all I have to do is add an onRelease/gotoAndStop() command which is attributed to each button as it is created, as above. my problem is that, say I had a bunch of dynamically generated buttons, when I click one of these buttons I don't know how to tell the other buttons to revert to their inactive states i.e: return to their first frames.

View 2 Replies

ActionScript 2.0 :: Assigning Actions To Dynamic Movieclips

May 12, 2009

[code]When I run the file the image appears but isn't clickable.The full code is below.[code]

View 3 Replies

ActionScript 2.0 :: Assigning Actions To Buttons In A Loop

Sep 17, 2004

i'm pulling my hair out over this one. I have is a movie with a button in it called button. i've duplicated the movie (manually) several times on the stage. the movies have been given instance names of movie1, movie2 etc. i've then used actionscript to assign actions to the buttons. i have the following code:

[Code]...

View 2 Replies

ActionScript 3.0 :: Assigning Actions / Animations To MovieClip Buttons?

Mar 18, 2011

I am following along this tutorial: [URL]. And I get to the part where I need to add code to get my buttons to work, and I copy and paste the code and then change the frame labels to match mine, but then I get a syntax error:
"About_Project_mc, Layer 'hit area', Frame 1, Line 1
1086: Syntax error: expecting semicolon before leftbrace."

View 4 Replies

ActionScript 2.0 :: Code For Assigning Actions For Buttons Trough Out Xml?

Sep 22, 2011

Code for assigning actions for buttons trough out xml

View 2 Replies

ActionScript 2.0 :: Some Keypresses Not Being Recognized In CS4?

May 24, 2010

I'm using Flash CS4, and using ANY method for capturing keypresses, only some keypresses are recognized. Backspace, Enter, and all of the letters on the keyboard do not trigger anything for me. Even using code as simple as...

on(keyPress "<Enter>"){
trace("pressed enter");
}

...doesn't work at all, while code like....

on(keyPress "<Space>"){
trace("pressed space");
}

...works perfectly. And no, caps lock isn't on.

View 4 Replies

ActionScript 2.0 :: Multiple Keypresses On Same Timeline?

Sep 27, 2009

I have file that on frame 2 i have this code:

[Code]...

The second keypress does not seem to work? Only if i change the keyCode to 71 as frame 2-- it works. I even changed the var name as something else and it does not work but triggers the else statement "bong".Any ideas of what I am doing wrong? I have a timeline with various keycodes that needs to be detected?

View 0 Replies

ActionScript 2.0 :: How To Get Event On Multiple Keypresses

Aug 16, 2004

How to have an event on multiple keypresses rather than just one. For example I have:

on (keyPress "<Left>") {
loadText=new loadVars();
loadText.load("audiophile.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
MainBox.html = true;
MainBox.htmlText = this.audiophileText;
}}}

But rather than just on the "Left" key, I want it to be Left + 1 (holding them down at the same time). How can I do that?

View 14 Replies

ActionScript 3.0 :: KeyPress Listeners - How To Capture The Keypresses

Apr 6, 2011

I am starting a new project where the user must interact with a UI in a simulated environment and within that I am capturing combination and single keypresses like "CTRL + O" or "ENTER" key.One of the requirements of the project is that down the line the product can be localised easily to different languages, one of the key languages being arabic.How should I approach to capture the keypresses?Is the actionscript going to recognise keyEvent.ctrlKey in different keyboard setups? eg:

Code:
if (keyEvent.ctrlKey == true)
{
keyBoardPart1 = "CTRL";

[code]....

View 0 Replies

ActionScript 3.0 :: Timeline Actions Ovverriding Actions In New Frame?

Jun 19, 2011

I have a series of frames one the timeline. Each frame has a graphic and a mouse click leads to the next frame. Think Myst.

[Code]...

When the middle frame is returned to, clicks no longer change anything. I believe that the actions of the 'left' frame are replacing the one's in the middle frame so then it is told to gotoAndStop to itself.

I'd like to know if that is indeed what is happening and how I can make it stop.

View 1 Replies

ActionScript 1/2 :: Put Another Set Of Actions In Frame 2 Of The Actions Layer?

Sep 29, 2010

1. Can i put another set of actions in frame 2 of the actions layer?i tested but it doesn't seem to work..it has 836 rows of code and it's getting annoying when tryin to search for a function..
 
2. I am not that familiar with classes, i usually put all the code into movieclips or in actions layer.. i am not sure if i can call a function from a actionscript class..
 
3.I am curios if there is any way i could specify an alternative for the if statement like in this pseudocode:
 
if ( apple is not clean BUT is tasty)
{
eat(apple)
}

View 5 Replies

ActionScript 3.0 :: Assigning URL To MCs Via XML?

Feb 23, 2009

I'm trying to get better at AS3, and am working on a file that uses XML. I've got some of it to work, but can't wrap my head around this. My XML looks kinda like this:

Code:
<portfolio>
<piece>

[code].....

View 13 Replies

Professional :: Assigning Web URL To Button?

Feb 17, 2010

I have a decompiled swf which I've heavily modified consisting of two large buttons with identical behaviors. When I assign a url to the button layer after double clicking on the left button, then the right, the behavior are both applied to the same sprite which, when viewed in the library, only represents the left button ("url one"), while the second url is missing. There are two separate layers for each button on the scene, yet I can't get separate urls applied to them because of this.I could just create two separate files, but that would add to the amount of code...

View 7 Replies

Actionscript 3 :: Assigning Number To Int?

Dec 13, 2010

I'm currently translating an application from actionscript-3 to Java code and got stuck with a variable assignment problem.

There is such block in as3 application: var num:*=0; num = 5.5;

As far as I understand AS3, variable is declared of an unknown type, which is resolved during the first assignment =0 meaning it will become int. Am I right?

So does that mean that by assigning 5.5 to it, the Number will be converted to int, and I will have num==5 in the result? Or will it become Number after assigning Number to it?

Added:but I don't have any Flash environment to test it myself. I'm converting one of the utility methods from actionscript to Java and got stuck with this problem.

Added 2: The question is, if num will contain 5 or 5.5 at the end of this block?

View 2 Replies

ActionScript 2.0 :: Assigning A Value From A Combobox?

Oct 6, 2009

If I have a combo box with code:

Code:
var listenerObject:Object = new Object();
listenerObject.change = function(evtObj:Object){
years = combo2.selectedItem.data;

[Code]....

and the 2010 is chosen from the list, can I assign the label value to a variable as a string? (I need the data value to stay as is)

View 0 Replies

IDE :: Assigning Different Class Paths?

Feb 9, 2009

i have a main page that loads a swf of an xml photogallery onto the main stage. I used the classpath in actionscript settings to target the actionscript files and xml data. So far, everything works well. Now, a button on the stage unloads this swf and then loads a second photogallery. The problem is that when it appears, it contains the same data (images) as the first photogallery. This is because it is using the same classpath as the first gallery. My question is how can i assign each gallery its own class path. It seems that only one can be selected at a time.

View 3 Replies

ActionScript 2.0 :: [MX] Assigning Different MCs Same Instance Name?

Oct 7, 2003

I was wondering if it's possible to assign seperate MC's the same instance name. Say, like, 'boundary' so I can have various boundaries and not have to worry about it.I could use a for loop and name each boundary something like bounds1, bounds2, bounds3 etc. but I'm wondering if there is an even easier way.

View 7 Replies

ActionScript 3.0 :: Assigning Different Class Paths?

Feb 9, 2009

i have a main page that loads a swf of an xml photogallery onto the main stage. I used the classpath in actionscript settings to target the actionscript files and xml data. So far, everything works well.Now, a button on the stage unloads this swf and then loads a second photogallery. The problem is that when it appears, it contains the same data (images) as the first photogallery. This is because it is using the same classpath as the first gallery. My question is how can i assign each gallery its own class path. It seems that only one can be selected at a time.

View 1 Replies

ActionScript 3.0 :: Variable Losing/not Assigning Value?

Jul 26, 2010

I followed a dynamic gallery scrolling thumbs tutorial and then changed it quite a bit to fit my needs.

I basically added a previous and next button and image title box.

It all works great apart from one thing.

e.g. I click on thumb 5. I then use the next button and go to say... image15. I then click on thumb 9. When I use the prev or next button again it will resume from image15, but it should then carry on from thumb 9 as that was the last change I made.

I thought this would be as simple as assigning the thumb variable value to the image number variable. i.e myID = id; but it doesn't work. my variable myID actually loses its value when I click the thumb image (I used the trace to clarify).

Here is the code.

PHP Code:

function bttnClick(event:MouseEvent):void{
bttn.gotoAndStop(1);
root.logo.visible = false;
myID = id;

[Code].....

View 4 Replies

Shortcut To Assigning Instance Names?

Oct 22, 2010

I have a 4x4 set of square buttons that I need to give instance names to. They will be named 'btn_1' thru 'btn_16'. Is there any shortcut to assigning the names or do I have to go through 16 times clicking on the button and clicking down to the 'instance name' text box?

View 2 Replies

ActionScript 3.0 :: Assigning Functions To The Keyboard

Aug 9, 2011

I'm trying to get the arrow keys on the keyboard to control timeline navigation. The AS3 code i'm using works the first time, but then goes a bit crazy and stops working for some reason. Please see my attached fla. In the example you're supposed to be able to navigate along the timeline using the arrow keys (going back and forth) I'm sure there's a really easy solution to this problem but I'm new to AS3 and can't figure it out.

View 1 Replies

ActionScript 3.0 :: Assigning Same Name To Multiple Targets?

Feb 3, 2009

I tried the drag and drop demo at [URL]. It works well allowing me to drag an item and have it register when it is dropped on the correct target. I want to modify it so that I can drag an item to multiple locations... not just one. My desired application is the ability to drag pendents or charms onto a bracelet or chain and have them "snap" to the chain. With the above demo, I can see how 90% of it would work, but I cannot figure out how to have multiple targets named the same. The bulk of the code is attached.

The line I believe needs to changed is this one:
if (event.target.dropTarget != null &&
event.target.dropTarget.parent == myTarget){
I need this part :event.target.dropTarget.parent == myTarget
to read something to the affect of:
if item being dropped is over object A OR object B OR object
C OR object D than ... rest of my code

View 7 Replies

ActionScript 3.0 :: Matrix3D Bug When Assigning RawData?

Jan 2, 2009

I'm assigning raw matrix values through Matrix3D.rawData.When assigning certain matrices it yields the following error:

ArgumentError: Error #2188: Invalid raw matrix. Matrix must be invertible.

However, I believe the matrix data I'm passing represent an invertible matrix!Is this a (known) bug? Or is the matrix not invertible and is my math failing me?

View 15 Replies

ActionScript 3.0 :: Calling Flashvar And Assigning It To A Xml?

May 29, 2009

I'm trying to call my flashvar and load it in my xml.
 
but i'm getting an error:
TypeError: Error #2007: Parameter url must be non-null.    at flash.net::URLStream/load()    at flash.net::URLLoader/load()    at test_3d_fla::MainTimeline/frame1()

[Code]....

View 16 Replies

ActionScript 3.0 :: Assigning StartDrag XY Coordinates?

Feb 26, 2010

I'd like to figure out how to get these four skulls to move on a constrained X axis on enter frame, and on CLICK, I'd like them to reset to their original positions.Example:On frame 1 is an mc I created named holder. Inside there's an mc named box. Inside box are four mcs, circles1-4, inside the circles I have four skulls.I've also created an mc called rectangle and dragged it over the first skull to get the coordinates I want using the following trace:

trace(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
Resulting in these coordinates: 143.95,119.05,131.15,61
So, this works MOUSE_OVER the circles

[code].....

View 19 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved