ActionScript 3.0 :: Tracing Keyboad Events But It Does Not Pick Up All Keys
Oct 29, 2009I find this to be pretty weird. This code works it traces most of the keys on the keyboard but not all. I cannot figure out why.
[Code]....
I find this to be pretty weird. This code works it traces most of the keys on the keyboard but not all. I cannot figure out why.
[Code]....
In Chrome OSX last distro I'm seeing no hand cursor over any button or useHandCursor sprites that normally show the hand cursor in other browsers. Also, the nightly distro seems to fail to pick up the shift parameter of mouse events.
View 1 RepliesHere is my code:
[Code]...
The code for KEY_UP and KEY_DOWN seems to work fine. But, the rest of it returns the error "1119: Access of possibly undefined property Key through a reference with static type Class." How do you call a function for Right, Left, Enter, and Escape Keys?
how to catch events from the multimedia keys on a keyboard in the Flex Framework? I tried using keyboardevent but, no luck ::- (. I'm developing a media player.
View 9 RepliesI got this code
[Code]....
and it works but now I need to use two simultaneous keys for example Ctrl + S, is there a way to do that using actionscript 3?
Ive been working on creating a 3d earth using papervision, I got it working however I want to add the ability to zoom in and out using the + and - keys, however I cant seem to get it to work. below is what im using. in the main function:
[Code]...
whether using a String as the key in a Dictionary results in slower lookups than using an Object, Class or Custom Object (an instance of developer defined Type)?
When using a String as a key, does the literal String have to be parsed, or does the Dictionary key point to the String Object?
How do I get the AWSD keys to work as smoothly as the arrow keys. I can put the arrow keys inside an enterFrame
[AS]onClipEvent (enterFrame) {
//move the tank
if (Key.isDown(Key.RIGHT)) {
[Code]....
If I put the AWD keys inside an enterFrame they run until I push another button
I have a button in _level15 setting a variable (panel). I have a button loading a jpg,through loadmove, into a target. The variable is the name of that target.If I don't use the variable, here is the code I use:
on (release) {
loadMovie("../dodge/aarp1.jpg", _root._level40.panel1);
}
[code].....
I've got a movieclip(we'll call this "A") on my stage, which attaches another movieclip("B") into itself. So it's nested.Now, once this movieclip("A") has attached the other movieclip("B") into itself,It uses a "gotoAndStop()" to send the frame of movieClip("B") to the right frame, eg. frame 2. Then it runs a loop which checks for all movieclips in "B" and populates an Array.The script I'm using for this is :
Code:
for (var i=0; i<h.numChildren; i++) {// This loop is suppose to populate my "bitArray" Array with all of the attached clip's childclips
if (h.getChildAt(i) is MovieClip) {[code]....
if there were 22 MovieClips on frame 2 in movieClip"B" , this code would still be able to populate my array with all 22 clips right?It doesn't. For some reason, if there were 22 clips, then out of the 22, the loop would only pick up 9. However, doing a trace with numChildren() in movieClip"B", it would still show 22. But my array would only show 9.I've attached a sample fla, I think it would explain my problem a lot better.Once you run it, it should spit out an output telling you how many movieclips in the attached movieclip, and it'll tell you how many clips it pushed onto the array.I can't seem to get the number of movieclips in my array to equal the number of clips in total inside my attached movieclip.
but I've spent the last few days trying to find an answer to this seemingly simple question, and no luck. Well, partial luck, but not quite what I wanted.My problem is this - I want to play a random sound when an event happens. In AS2, I used to do this:Actionscript Code:s1 = new Sound();_root.s1.attachSound("sound"+(random(10)+1));s1.start();...where there would in this example be 10 sounds in the library, with names from sound1 to sound10.Now, I want to be able to do the same in AS3. As a temp solution, I've been forced to do a lot of if statements, but that's ugly, timeconsuming and inefficient.I also tried this (AS3):
Actionscript Code:
var soundArray:Array = new Array(new sound1(),new sound2(),new sound3(),new sound4(),new sound5()) var randomInteger:int var selectedSound:Sound function
[code].....
How can I pick random frame from movie clip, so that mc doesn't loop. Movie clip is a symbol. I made symbol defined it as mc, mc contains 4 frames, each frame contains some object.
View 11 RepliesI have a script that when the use types in their name, it is to pick a random name from the list. Problem is, it isn't picking random exactly I get a lot of repeats and sometimes it just comes up undefined.
Here is the script
if (combobox.getSelectedIndex() == 0)
{
txt2.text = "Female Name";
female.play();
[Code].....
I've spent the last few days trying to find an answer to this seemingly simple question, and no luck. Well, partial luck, but not quite what I wanted.
My problem is this - I want to play a random sound when an event happens. In AS2, I used to do this[code]...
i got an XML File with a set of variables which should be chosen randomly. Of course, if one data set has been selected, it should not come up again. to solve this, i created an array called blacklist, which keeps track of all the xml indexes which have allready been selected. so, what i'm doing in f_newtarget is randomize a number between 0-42 and check if it on the blacklist. if it is, i trace "double" and want to restart, and if it is not, write the randomized index to the blacklist and move my target to the coordinate given in the XML.
whats not working is when i get a double event. it traces the "double" but does not start to randomize again. i think i know why, cuz the action is only triggered by pushing the button. but in the case taht the randomized number is allready in the array, i want it to automatically re-randomize r until it finds a value which has not part of the array. what do i have to write in order for the code to jump back to where it randomizes the variable r?
or should i write like a whitelist array from which i randomely deduct the indexes? i have a button which holds the code for selecting a new question. it looks like this:
[Code]....
I need a color pick component.....where i can download it?
View 3 RepliesI need a color pick component.....where i can download it?
View 1 RepliesI've just started learning Flash and i'm looking for some help.I'm trying to create a program to allow you to pick out of 3 movies, select a day and time, how many people will be watching the movie and then show all the information.
I'm looking at having around 7 frames.My problem is that one of my buttons isn't working, I can't understand why as it is the same code (with the correct parts changed) as my other buttons which are working perfectly.
[Code]...
I am making a platformer game, and I have money I pickup. How do I have the money make a sound when I pick it up? I am using flash 8
View 1 RepliesI'm trying to make a website where you can navigate by keyboard. I'm having difficulties getting the flash file to pick up the listener when upon first logging in. Here's my website: [URL] If you click on the screen you can then press the right arrow to expand the menu. when you log onto the website I want to make it right off the bat where you press the right arrow key and the menu near the top will expand.
ActionScript Code:
stop();
listen = new Object();
listen.onKeyDown = function() {
switch (Key.getCode()) {
case Key.RIGHT :
gotoAndPlay(2)
break;
}}
Key.addListener(listen)
Again, the only way to get that keylistener to pick up pressed keys is to initially click on the screen. Is there any way to get around that?
Just wanted to aovid reinventing wheels, I want the date and time picker, I know there is already a date only picker inside flash builder.
BTW: i am using flash builder 4
I have an array of movieclips and i want to put them on stage. so they have to be unique and randomly chosen.
View 1 RepliesOK, I have a flash file which has a download button. This is in a php page. We have a php session in the header named sourceID= etc....
We tried putting the following url into the flash download button same as the php links on our page - [URL] echo (int)$_GET['sourceID'] ?> but it doesnt pick up the sourceID information.
i.e what to put in the php page and what to use for the getURL link in flash.
Needed to place objects on the stage in random order, but only place each object twice. [code]...
View 0 Repliesis it possible to pick the color of a uni filled shape? If not, is it possible to retrieve the color at pixel x:0 y:0?Otherwise how do I pick that pixelcolor using bitmapdata.
View 2 RepliesMy problem is that I'm trying to pick numbers out of an array to a cardgame.
Code:
stop();
//var kort = new Array (0,1,2,3,4,5,6,7,8,9,10);
button_1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
[code]....
I have built a small flash file that has the mouse move the salt shaker on a angle, but I don't know how to make salt animate out on the plate
View 0 RepliesI load a picture file by Loader and add Bitmap into sprite,like follows:sprite1.addChild(myBitmap);Now I want to get the myBitmap from sprite1,how can I get myBitmap from sprite1,what code can I use?
View 1 Repliespick 1 element in array randomly ONCE
View 1 RepliesI have a list:randomPage(["0", "6", "12", "14", "22", "28"]);
and I was wondering does anyone know the code to pick a random value out of the list. At first I just used a random(28) but I need it to go to a specific page and I dont know what to do!