Dancing Game Key.addListener
This game is finish and ready to play but when I add this game to main movie and run the game. problem is if I click exit game in main movie it will not get to Key.removeListener(); code in dancing game.
When I choose this game to play again old Key.addListener still runing it will call function twice
Code: _lockroot = true; keyboardListener = new Object(); keyboardListener.onKeyDown = function() { if (Key.getCode() == 37 || Key.getCode() == 100) { Call function... } else if (Key.getCode() == 39 || Key.getCode() == 102) { Call function... } else if (Key.getCode() == 38 || Key.getCode() == 104) { Call function... } else if (Key.getCode() == 40 || Key.getCode() == 98) { Call function... } }; Key.addListener(keyboardListener); how to break this? I got link from here http://actionscript.org/forums/showt...ey.addListener It seem like my case he said he use clearInterval(); but how my customer will kill me on friday if I can't fix this problem. HELP!
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 12-04-2006, 03:26 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dancing Game
I've seen a game online and I cannot find it again. It is where you are able to select different dance moves and then drag them into a timeline and select play and have the character dance the moves in sequence.
Anyone know where this is, or better yet, does anyone know how to go about creating it?
Thanks!
P
Dancing Game
Hey,
I'm working on a dance mat game, and I need help on the actionscripting to use.
I've basically got that when keyisdown(keyUP) then it goes to a frame where the foot is on the top tile, but I can't do that with the arrows at the top. Its annoying... HELP!
Strange Problem In Programming A Flash Game/Key.addlistener Anyone Have Any Ideas,?
I am programming a game in flash and I have a piece which responds to keys.
The piece is supposed to move one space at a time, and it does the first time you open the swf, but unless you close and open it again and just recreate the board the piece responds twice and moves 2 spaces instead of 1 and so on 3 to 4 each time you load it again without closing the program.
I think Key.addlistener registers the listener each time the
board is recreated therefore incrementing the movement of the piece.
How do i get around this?
A Dancing Man
could anyone possible help!!! currently doing a website for a club event, and they would like a dancing charcter for three different music genres. Hip-Hop, Drum &Bass and Techno. They need a different dance move to all three. I would like to have just a siloete of the guy which would be looped. How would I go about this?
Any help would be much thanked.
Cheers,
Nick
Dancing Flash
I'm creating a flash movie and am just tweening the opacity of an image in the movie and there is a slight jump in the movie. Is anyone familiar with this and is there a way to fix it?
Dancing People
how can i create sam1 that is dancing do i need to draw every frame bye frame cause else its a huge work
any1 have sugetstions
Dancing Silhouettes
Hi, I've seen a couple of movies on this site where they have dancing Silhouette's of people, which have obviously been converted from video footage. Can anyone give me a link or tell me how you would recreate something like this, as im looking to make something very similar but want to use my own material.
Thanks
Richard
I'm A Dancing Newbielol Well I'm Here Asking If Someone Can Help Me In A Site
I'm A Dancing Newbie!lol Well I'm Here Asking If Someone Can Help Me In A Site I'm Making For A Game...I Can't Do Flash (I'm Really Bad Tried So Many Times)I'm Frustrated At Flash But I Shall Try And Help The Person Who's Helping By The Way The Game Is Online.I Won't Say The Game Name Yet Until I Get Someone And Yes I Always Type Like This My AIM Is-M98944602 And My MSN Is-maskedmurdererguildleader@hotmail.com
Thanks If Someone Can Help Me Make The Site I Would Be A Pleased Dancing Newbie!
Naked Dancing People...
Hello!
...thanx you for reading, the only way to get an answer here for the one and only sound problem:
My problem with swish:
In preview mode and when I safe and test my work in a browser, no sound is playing, but in edit mode it works.
I read at macromadia that swf files do not support sound?
Why does swish can insert sounds?
I think I some big wrong?!
How can i make it working? (for html)
thanx a lot, dan from germoney ;-)
Realistic Dancing Flames
how do i achieve this.
ive done it before and it turned out great but im having trouble replicating the same again.
any help appreciated.
thanks
Animate Dancing W/ Vector Person
Hello everyone! I'd like to start off by saying thanks to everyone who posts and submits tutorials to this website...I've been silently learning from all of you since I discovered this site. Go you!
So here's my problem:
I am building a completely Flash website that will house my portfolio and contact information, among other things. I've got a pretty solid idea of how I'm going to set the whole thing up, but I'm having trouble coming up with a good way to create the animations I want to make for it. Stripped down to its essence, I want to have a vector drawing, fairly detailed, of a human figure dancing around, doing little hand flourishes, etc etc etc (depending on what part of the site you are at). For example, if you click a button to go to another part of the page, this vectorized human will animate as a transition to the next section.
What I can't figure out is what the best way to achieve this would be. I thought about vectorizing the whole shebang frame by frame, but based on the amount of animation I want, I'd be working on it until I go blind, and then I wouldn't be able to enjoy the site anyway. Would it help if I videotaped someone dancing around and then took it into Flash frame by frame? It would still be tedious, but then at least I'd have something to work from. It just seems to me that there has got to be an easier way to achieve the results I'm looking for.
Any help anyone can offer is greatly appreciated!
Thanks for your time.
-Colin
Sound Equaliser In Flash (NOT Dancing Lights)
I need to be able to adjust the amound of sound at different frequencies (100hz, 1K and 10K), like a graphic equaliser (most people incorrectly talk about equalisers as the bars that jump up and down to the sound!)or: like the tone controls on your hifi, or parametric (or simpler) on a proper desk.
I've heard it can be done by pre-filtering the sound then playing them all together in separate files and adjusting the volume, but this is a bit risky. Anyone got any much appreciated better ideas?
Cheers.
AddListener Help.
Ive never used addListener before but now ive found a reason. Thing is im not 100% sure how to use it.
I wanna add a listener that checks if a flash movie has changed size. Example below but I need some input on how to achieve this correctly.
Code:
var sizeListener:Object = new Object();
sizeListener.complete = function():Void {
trace("sized");
}
checkSize.addEventListener("complete", sizeListener);
checkSize.somethingNeedsToHappenHere;
//can i use
checkSize.Stage.height;
//or something like this?
NM, found the answer:
Code:
var sizeListener:Object = new Object();
sizeListener.onResize = function () {
trace("sized");
}
Stage.addListener(sizeListener);
Addlistener :D
simple thing, but i dont know how to do it
i need to check if the CTRL button is bieng pressed in the main timeline.... i know i will probably need to use listeners but i dont know
Key AddListener
how can i found active Key event on a movie.
when i press up move goes to UP
when i press right move goes to right
but when i press up + right both movie can't goed to UP RIGHT Corner WHY?
AddListener
I am loading an external SWF that's created by captivate (so you can't add any actionscript inside of it) and need to trigger events in the parent movie based on the frame that external SWF is on. How can I detect what frame that SWF is on by using listeners or something else?
The following code does not work.
var mylistener1:MovieClip = new MovieClip();
mylistener1.onLoad = function(blankmc) {
trace(_root.current);
};
var myListener2:Object = new Object();
mylistener2.onFrameEnter = function(framesloaded) {
trace("Frame:"+_root.blankmc._currentframe);
};
blankmc.addListener(mylistener1);
blankmc.addListener(mylistener2);
AddListener
I have a form which has input text fields as well as combobox components. In an effort to pass the form result to a php script I've made dynamic text boxes in the ammount of the comboboxes. I've made it so that the values of the comboboxes are displayed in the dynamic text fields (which are displayed off the stage) but it will not update when the combobox value is changed.
If i have a combobox for the users gender with options of (Please Select..., Male, Female, Undefined) when I test the movie, in the dynamic text field "Please Select..." is displayed. But if I choose and option let's say "Male" the dynamic text box is not updated accordingly.
Can someone please tell me what to add to my actionscript to have the addListener repeat the listening process so that it will be constantly updated?
My script is as follows:
this.form.comboboxgender.addEventListener()
this.form.genderholderbox.text = this.form.comboboxgender.value
The only way I can get it to update is to make the form 3frames and have the first 2 frames loop. But this approach causes the submit button on the form to not function properly. I've used the flash & PHP form tutorial. So when the submit button is released flash posts the data, and executes the script:
onCLipEvent(data){
_root.nextFrame();
}
With the first 2 frames looping, it doesn't function correctly. I've tried changing the "_root.nextFrame()" to "gotoAndStop("thankyoumsg"); but that doesn't work.
Here's a link to the tutorial
~~> http://www.kirupa.com/developer/acti..._php_email.htm
Thanx in advance.
AddListener
Hello,
I would like to invoke a Listener, when I click and hold upon a movieClip, I want it to follow the _ymouse, but not using onEnterFrame for it to move up and down.
Code:
var Ear:Object = new Object();
Ear.onMouseDown = function(){
box._y = _ymouse;
updateAfterEvent();
}
Mouse.addListener(Ear);
Although it 'clicks' to position - how can I make the 'box' follow the mouse at updateAfterEvent Speed?
Thanks!!!
Key.addlistener()
i have this code by not works..
Code:
createTextField("txt", 1, 10, 10, 400, 320);
txt.text += "Your Keys enabled : "+"
"
txt.bold= true
txt.size = 11;
s = {};
Key.addListener(s);
s.onKeyDown = function() {
for (var i in Key.isDown) {
txt.text += " * "+i+" - "+Key.isDown[i]+"
";
}
};
excuse me english
Help On AddListener
Hi Guys!
Need help with this line,
Code:
o.addListener = mx.transitions.BroadcasterMX.prototype.addMyListener;
where "addMyListener" is a function.
Just cant figure out what it does.
I can understand things like that:
Code:
myMCL.addListener(myListener);
but that first line make me confused. Why "=" sign is being used? Why is it assigned to a function?
Thank you.
TextField.addListener
I cannot seem to find good documentation on this function. I plan to keep a series of textfields off screen and have various movies updated themselves when values change in these textfields. I thought TextField.addListener would be the way to go, but I cannot find a good enough example to figure out how to use it.
Any help?
Thanks
Christopher
Addlistener Woes
Hi
I am adding a key listener to allow the user to stop start animation sequences in a movie like a pause button.
The problem is that every time the user enters the page my actionscript creates a new version of my listener object and applies it to the key, so when the hits the space bar after reentering the page the first listener pauses the animation, then the second listener restarts it again. If the page is accessed a third time everything works fine because the third listener turns the animation off again!.
The macromedia docs say that attaching a new listener should overwrite the old one - which doesnt seem to be happening, and deleting the listener doesnt seem to work either.
Any ideas anyone - or even some way of asking what listeners are attached to an event would be useful so that I could at least apply a switch statement if the object already exists
cheers
Key.addlistener Query...please Help
hi...can anyone help...i have a movieclip of a walking character which has its direction and movement controlled by actionscript via the direction tabs on the keyboard ...my problem is this ...i want my character to revert to frame 1 (a still image) when the keypresses are released...im trying to get my head around the add.listener action but i fear im doing it wrong can anyone help or suggest the right way!!much appreciated
AddListener To My Class
Hi,
I've created a class called Box that extends the movieclip class. I did this because i want to have access to all of its methods for latter use (if I ever get there).
I'd like to know how to register if the mouse has clicked on the movieClip instance of Box? Do i add a listener to the class description?
Here is my code:
class Box extends MovieClip{
public static var BLACK: Number = 0;
public static var GREEN: Number = 1;
public var labelText: String;
public static function createBox(name:String,
target:MovieClip,
depth:Number,
x:Number, y:Number,
labelText:String):Box{
var b:Box = Box(target.attachMovie("box_MC",name,depth));
b.labelText = labelText;
b.init(x,y);
return b;
}
public function init (x:Number, y:Number):Void{
setState(Box.GREEN);
Mouse.addListener(this);
this._x = x;
this._y = y;
}
public function setState(newState:Number):Void{
switch (newState){
case Box.BLACK:
this.gotoAndStop(0);
break;
case Box.GREEN:
this.gotoAndStop(6);
break;
}
}
}
Thanks
Jay
Mouse.addListener()
I have created a movie with multiple sound objects created like:
var soundObjectOne:Sound=new Sound();
soundObjectOne.attachSound();
soundObjectOne.start()
///
var soundObjectTwo:Sound=new Sound()
///
etc...
I have a listener to detect a collision with a movie clip and upon collision using hitTest() to setVolume() to a specified soundObject created above. Problem is that when the collision occurs the volume to ALL sound objects is affected. Is there a way to target only the one sound object and not effect the others?
Currently my script reads something like:
var myObject:Object=new Object();
myObject.onMouseMove=function() {
if(myMovie_mc.hitTest(_root._xmouse,_root._ymouse) ) {
soundObjectOne.setVolume(10);
};
Mouse.addListener(myObject);
This sets the volume to soundObjectOne to 10, but also soundObjectTwo, soundObjectThree, etc.
Thanks in advance for suggestions.
sleepydad
Key.addListener Question
Hi,
ive got this code to give the enter button a function when an input textfield is onFocus.. but i want this enter function to be disabled when the textfield is NOT onFocus.. how can I accomplish this?
this is my code so far:
Code:
this.inputText.onSetFocus = function(){
inputText.onKeyDown = function() {
mnFunctie();
};
mnFunctie = function () {
if (Key.isDown(Key.ENTER)) {
trace('clicked');
}
};
Key.addListener(inputText);}
is it something with onKillFocus?
Thanx in advance
AddListener & RemoveListener
Hi there,
I am actually doing a tutorial and i can never seem to understand one question or rather one concept.
The question is:
Why do we have to remove Key Listener before we add new listener?
I am really confused as, if there is a current listener, why do we need to delete it ? Are we able to reuse it by adding a new function ?
From my lab sheets, it something like,
1 Key.removeListener(xx);
2 var xx:Object = new Object();
3 xx.onKeyDown = function(){
.... }
4 Key.addListener(xx);
... = lines of unimportant coding.
From what i see, it is quite irredunant to remove and re-add. I am very confused as in why this is done.
My own confusion comes from: If there is an onkeydown function, aren't we able to remodify it as in readd it instead of removing and re-adding it?
I believe that I still have not understood the theory of adding and removing listeners. I have tried googling and read the api on these two topics. HOwever, there doesn't seem to be any help pertaining to my queries.
I do hope that some kind soul will help me. Thank you very much =)
Addlistener And Loadvars
Hello all
Here is my problem, maybe is so simple but i need learn a litle bit about addlistener
See the code ... bla bla bla, i only need in "my_next_month" button a function to change the load file for
event.php?month=2
event.php?month=3 ... etc etc
Quote:
getEvents = new LoadVars();
// when the data has been loaded
getEvents.onLoad = function() {
// bla bla bla
};
getEvents.load("event.php?month=1");
My question is, can i do that with listener? how?
Thanks
Using Addlistener On A Variable?
I need to have my flash movie execute a function from javascript. So, in looking at what methods are exposed to javascript, there isn't really anything that I see that allows me to call the function directly. I figured the next easiest thing would be to create a global variable and use the setVariable in javascript. Then use the addListener on the variable so that when it changes, it calls my function. Does anyone know if this is possible? Thanks.
Age Old - AddListener MovieClip
Hi,
Thank you to anyone who can help or offer any advice.
I am having trouble adding a simple listener to a MovieClip.
Here is my code:
ActionScript Code:
var p:MovieClip = this.gallary_mc;
var thumbListener:Object = new Object();
thumbListener.onPress = function( Void ):Void
{
getBigPic();
}
and assigning to the MovieClip:
ActionScript Code:
function assignEvents( Void ):Void
{
for( var k:Number = 1; k <= NUM_COLS; k++ )
{
for( var i:Number = 1; i <= NUM_CLIPS; i++ )
{
p[ "col" + k ][ i + "small" + k + "_mc" ].addListener( thumbListener );
}
}
}
Any help would be greatly apprciated.
Regards, snapple
Key.addListener(KeyListener) ... Is This A BUG?
I had something strange.. i was trying to make a mini flash game.. but when i tested it,
strange things happend. Some functions where initialized multiple times.
I finaly found the peace of code that is causing this.
When you test a movie (CRTL+ENTER) in Flash.. and you press in this example the space button.
You see in the output ("run").
But when you want to test this again with (CRTL+ENTER) ..you see ("run") 2 times..
And if you continue to test it.. for example 6 times.. then with one press on the space button, you will
see 6 times the trace output ("run');
Is there a fix for this? This way you can't really test your movie..
There should be when you press CRTL+ENTER a automatic removeListeners of all objects.
Attach Code
var keyListener:Object = new Object();
Key.addListener(keyListener);
keyListener.onKeyDown = function() {
if (Key.isDown(Key.SPACE)) {
trace("run");
}
};
Edited: 10/18/2007 at 01:02:23 AM by Michealnl
[FMX04] Key.addlistener?
I'm having trouble getting this part of Sen's code to function! I attached his tutorial fla! I've searched in the AS help in Flash and tried modifying the Key.addlistener object but it still won't respond to the arrow keys!
Sen's code
PHP Code:
// set the ball to recognize key presses and move based on them
Key.addListener(ball);
ball.onKeyDown = function(){
var xmove, ymove;
if (Key.isDown(Key.UP)){
ymove = 1;
}else if (Key.isDown(Key.DOWN)){
ymove = -1;
}else if (Key.isDown(Key.LEFT)){
xmove = -1;
}else if (Key.isDown(Key.RIGHT)){
xmove = 1;
}
// update new position based on ball's current
xmove += this.x;
ymove += this.y;
if (IsValidTile(xmove, ymove)){
moveToGridSpace(xmove, ymove);
}
}
My attempt
PHP Code:
// set the ball to recognize key presses and move based on them
ball = new Object ();
ball.onKeyDown = function(){
var xmove, ymove;
if (Key.isDown(Key.UP)){
ymove = 1;
}else if (Key.isDown(Key.DOWN)){
ymove = -1;
}else if (Key.isDown(Key.LEFT)){
xmove = -1;
}else if (Key.isDown(Key.RIGHT)){
xmove = 1;
}
Key.addListener(ball);
// update new position based on ball's current
xmove += this.x;
ymove += this.y;
if (IsValidTile(xmove, ymove)){
moveToGridSpace(xmove, ymove);
}
}
What is wrong?
No Method With The Name 'addListener'
Ok,
I have one script which is working a treat ( using ASBroadcasters )
and then today, I copied and pasted the same script into a new site and whenever I try to register a listener, I get the dreaded "There is no method with the name addListener"...
Any ideas as to why this is happening.
oh, and a few things.
the broadcasting object is a class extending the XML class, and i have used the same script before with no issues
the listening object extends the object class, and whilst this class has been freshly developed, the last time I used the ASBroadcaster methods I didn't have to extend anything for it to work...
please help, i've wasted two days on this, and really can't afford to spend any more...
Key.addlistener Problem
im using key.addlisteners to check for key presses. but if a person presses all 3 keys at once (RIGHT, LEFT, UP) then releases one at a time, only the first release is noted by flash. see a demo at:
http://www.starvingeyes.com/temp/listener.swf
is there any way to solve this?
NOTE: I do not want to use if(Key.isDown...etc) to get this to work. if you are interested in why see below.
here is the code:
myListener = new Object();
myListener.onKeyDown = function() {
if (Key.getCode()==39) {
rb=true;
}
if (Key.getCode()==38) {
ub=true;
}
if (Key.getCode()==37) {
lb=true;
}
if (Key.getCode()==32) {
sb=true;
}
}
myListener.onKeyUp = function() {
code= Key.getCode()
if (code==39) {
rb=false;
}
if (code==38) {
ub=false;
}
if (code==37) {
lb=false;
}
if (code==32) {
sb=false;
}
}
Key.addListener(myListener);
i want to publish my movie with WMODE set to transparent windowless. there is a glitch in flash that makes it so if(key.isDown(key.right)) sort of codes dont work in anything but IE when WMODE is set this way. therefore i am looking for any alternative to this. let me know if you have any others.
Problem With AddListener
this is my code...
var myListener:Object = new Object();
Key.addListener(myListener);
myListener.onKeyDown = myOnKeyDown;
Accessibility.updateProperties();
function myOnKeyDown()
{
if (Key.isDown(Key.CONTROL) && Key.getCode() == 55)
{
trace("right");
}
}
here i used the key 7 along with the control key to check a specified action.
wen i am trying to use some other keys instead of key 7, it's not working...
like when i am using key A or something like that, the function is not working in a proper way......
can anybody help me.....
plz..
Key.addListener Question
I'm trying to get a key (in this case the Enter key) to run a function already assigned to a button. What I'm trying to achieve here is to get both methods to do the same task either you press the button in the movieclip with the mouse or you press Enter.
Here is the code for the button:
Code:
search_fields.search_btn.onRelease = function(){
if (search_fields.query_txt.text.length < 3){
results_txt.text = "Please use a search term with 3 or more characters.";
return (0);
}
var searchElements = ElementsToSearch();
var nodesWithQuery = SearchXML(
posts_xml.firstChild.childNodes,
search_fields.query_txt.text,
searchElements
);
if (nodesWithQuery.length){
DisplayNodes(
nodesWithQuery,
results_txt
);
}else{
results_txt.text = "No results for "+search_fields.query_txt.text+".";
return (0);
}
HighlightOccurences(
search_fields.query_txt.text,
results_txt,
search_highlight
);
scrollbar.setScroll(0);
}
´
Now, how do I get the Enter key to do the same when pressed?
Help? Anyone? Pretty pleeeeeeeeeeeeeeeeeeeeeeease!!!
Thanks!!!!
[FMX04] Key.addlistener?
I'm having trouble getting this part of Sen's code to function! I attached his tutorial fla! I've searched in the AS help in Flash and tried modifying the Key.addlistener object but it still won't respond to the arrow keys!
Sen's code
PHP Code:
// set the ball to recognize key presses and move based on them
Key.addListener(ball);
ball.onKeyDown = function(){
var xmove, ymove;
if (Key.isDown(Key.UP)){
ymove = 1;
}else if (Key.isDown(Key.DOWN)){
ymove = -1;
}else if (Key.isDown(Key.LEFT)){
xmove = -1;
}else if (Key.isDown(Key.RIGHT)){
xmove = 1;
}
// update new position based on ball's current
xmove += this.x;
ymove += this.y;
if (IsValidTile(xmove, ymove)){
moveToGridSpace(xmove, ymove);
}
}
My attempt
PHP Code:
// set the ball to recognize key presses and move based on them
ball = new Object ();
ball.onKeyDown = function(){
var xmove, ymove;
if (Key.isDown(Key.UP)){
ymove = 1;
}else if (Key.isDown(Key.DOWN)){
ymove = -1;
}else if (Key.isDown(Key.LEFT)){
xmove = -1;
}else if (Key.isDown(Key.RIGHT)){
xmove = 1;
}
Key.addListener(ball);
// update new position based on ball's current
xmove += this.x;
ymove += this.y;
if (IsValidTile(xmove, ymove)){
moveToGridSpace(xmove, ymove);
}
}
What is wrong?
No Method With The Name 'addListener'
Ok,
I have one script which is working a treat ( using ASBroadcasters )
and then today, I copied and pasted the same script into a new site and whenever I try to register a listener, I get the dreaded "There is no method with the name addListener"...
Any ideas as to why this is happening.
oh, and a few things.
the broadcasting object is a class extending the XML class, and i have used the same script before with no issues
the listening object extends the object class, and whilst this class has been freshly developed, the last time I used the ASBroadcaster methods I didn't have to extend anything for it to work...
please help, i've wasted two days on this, and really can't afford to spend any more...
TextField.addListener()
When you click inside the 'type your message here' textfield the text writes itself out of the field (removing one letter at a time) I am having some trouble setting this effect up myself. I am using a listener attached to a text field, which when someone clicks inside the text field, triggers a movie clip (writing the text out of the field as seen on the other site. Not the best solution, but effective) The problem I am having is that I can not remove the listener, which causes this problem:
Someone starts typing. if they move out of the text field (and click somewhere else, then back inside) the movie clip is called again to write the text out of view, but you can see it behind what the user has typed, looking a bit messy.
Here is the code I am using if anyone can see a problem in it. The input textfield holds the variable name 'msg' and the instance name 'messageText', and the movie clip that holds the animation of the words disapearing "enter your message here" is a movie clip called 'typo'
****************************
messageListener = new Object();
messageText.addListener(messageListener);
messageText.onSetFocus = function(){
typo.gotoAndPlay(2);
messageText.removeListener(messageListener);
}
****************************
also, if anyone knows a more effective way to make the text disapear, give me a heads up. I tried using textField.length -1 on a looping action, but that did not work.
AddListener Troubles
I'm somehwat new to actionscripting in flash. I am having troubles getting my listener to trigger events: here is the scenario:
Object1 (textarea) on text change broadcasts the trace,
my listener (object 2-movie clip place holder) recieves the trace
NOW,
I got that much to work, but my loadMovie event isnt getting triggered when the trace is recieved, I keep seeing a blank spot where the movie should be. What am i doing wrong, HELP!!!
Using AddListener For Key Presses?
Hi all,
I'm trying to control animation by a keypress. What I want is to be able to sense whether an arrow key is hit which would play one animation cycle and then play a second animation cycle when the key is let go (via frame labels). I thought this would be easy enough with addListener but I can't seem to figure out how to sense when the key is let go to trigger the second animation. Any help would be greatly appreciated.
Breakdown:
Hit (Right Arrow) --> Play (frameLabel01)
Release (Right Arrow) --> Play (frameLabel02)
Thanks!
AddListener Method
Is there a way to apply a listener to a variable in the _root? I want to execute a function automatically if a variable changes.
Variables And AddListener
Is it possible to assign a listener for when a variable changes? Something like:
var MyVar;
MyListener = new Object();
MyListener.onChange = function() {
trace("MyVar Changed");
};
MyVar.addListener(MyListener);
AddListener & Variables
/take 2
I'm making a dynamic menu in MX where I want to monitor a certain variable(for lots of goods reasons) permanently. I used to do this by an infinite looping movieclip, but it seems this is very bad for the overall performance(slllllow). Is it an option to use AddListener? I played around with it in combination with a TextField & onMouseMove. This seems to work fine, but it is of course a bit dirty, because I'm not actually using the TextField and the onMouseMove event is also not the ultimate solution. Is there a functionality to use AddListenere & variables? Or someone with a brilliant solution?
AddListener Browser Problem
Hi,
i was checking some things with my stageMode...set it to NoScale and made and objectListener so when the browser resize a clip always stays on the left of my browserwindow...now...it works fine...in IE
but not with Netscape 7.1, not with Mozilla..but then again it works fine with Netscape 4.8 and OPera...hmmmm ...Any Ideas?
Greetz
Tim
TextInput/Key.addListener Mystery
Hi
I'm having bother with the TextInput component. It works fine in preview, but when I publish to HTML I get two problems. The first is that the action for the escape key I've set isn't working. Here's the script for the listener ....
code:
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {
case Key.ESCAPE :
MagicwordClose();
break;
case Key.ENTER :
MenuCompare();
break;
}
};
Key.addListener(keyListener);
Both Enter and Escape trace and work fine in preview. But when I publish and view in HTML only Enter works. Escape does nothing no matter where the focus is.
The second problem is the green focus box around the TextInput field in HTML. How do I get rid of it?
thanks
mark
flash8
[F8] No Listener, AddListener And AddEventListener
I have a few doubts about event handling:
why there are some cases you don't need a listener to handle an event, some other cases that you need addListener, and some others you need addEventListener?
In other words. Why a case like this wouldn't work?
PHP Code:
_root.onKeyDown = function() {
trace("Key pressed");
};
and on the other hand this one would?:
PHP Code:
myButton.onPress = function {
trace("Button pressed");
};
-----------------------
Second doubt:
to fix the first example, which didn't work, I should do this:
PHP Code:
this.onKeyDown = function() {
trace("Key pressed");
};
Key.addListener(this);
I've seen many times you need to add a listener but you use addEventListener
what's the difference?
------------------------
Third doubt:
I have seen many times two ways to handle an event (with or without listener):
PHP Code:
myButton.onPress = function() {
trace("Button pressed");
}
and this other:
PHP Code:
myListener:Object = new Object();
myListener.click = function(evt:Object) {
trace("Button pressed");
}
myButton.addEventListener("click", myListener); // or is it "press"??
The first one is much more familiar to me, but which one is preferable? is the first one deprecated?
|