----------------
Using a listener:
A listener is exactly what it sounds like: an object in memory that listens for events broadcast by other objects. In Flash MX, many objects have an addListener method which can be used to inform the object that a specific event has occurred.

The Key object contains an addListener method. When a key is pressed or released, regardless of the input focus, all listening objects registered with addListener have either their onKeyDown method or onKeyUp method invoked. Multiple objects can listen for keyboard notifications.

To create a generic Key listener object:
1 A generic listener catches all Key events and acts on them, no matter what has focus on the stage. Unlike the previous methods, it is not required that a MovieClip Object exists on stage and specific instance names are not targeted. For example, this entire script can be a frame script:

//Create a new variable and assign a new object to that variable
myListener = new Object

//Tell the object to perform a function when the onKeyDown event fires
myListener.onKeyDown = function(){

//What the function does goes here. In this case it sets a dynamic text field with the variable name resultField to a string value.
resultField = "please press another key"
}

//Registers the listener object to receive events from the Key object so that it knows when onKeyDown and onKeyUp occur
Key.addListener(myListener)

this is another way..partly using henry's approach..but
it only activates when the escape button is pressed.
it's not actually disabling the button..but is effective if
you want other key press' in your movie to work.
on the movieclip off the stage..

hello Zeffer,
I made the 1fr movie clip place on the stage(for tasting) & attached the code:
onClipEvent (load) {
fscommand("trapallkeys", true);
}

Esc key is still functional & I got :

Scene=Scene 1, Layer=EscapeKeyMC, Frame=1: Line 1: Clip events are permitted only for movie clip instances
onClipEvent (load) {
---------------------------
I tried this code with the same results as above

wonder, why doesn't it work ??
===========
In F5 I found in the Object Action (Normal Mode) Basic Actions
fscommand("trapallkeys", true);

& is working , it's disabling all keys, right (total overkill),
however; I provide the all needed buttons for my frame-by-frame animation.
Also, the disappearing Full screen button would not work
with >>onClipEvent (enterFrame)<< nor >>onClipEvent (load)<<
because the all anim. movie would go to the full screen just from the start , right?

That was not my intention here, I wanted to disable the escape button so
viewer can't stop watching on the full screen my anim.......hahahaha..
by switching it of :)

I think you are putting the code on the frame ..not selecting the movieclip and putting it on the clip.
as long as the frames are extended out the length of the
timeline..(on the layer where you put the movieclip with the actions)..the second one will work.
if a user presses esc..the code forces it to fullscreen again.
a slight delay..with a slow processor..but it will carry
out your evil plan..:)
Z

45, you need to put the code Z provided on the clip as mentioned above.

I think you can combine the fullscreen solutions from the last question with this one...

you would just make the movieclip with the button in it have two frames with stop(); actions in both of them. then in the second frame put a movieclip in it and put the code mentioned above on that movieclip.

in the code that is attached to the button, just put this code in it to go to the next frame:

gotoAndPlay(2);

I have not tested whether or not this works, but I should in theory...

here is an example using Z's fullscreen solution that combines the solution that I am talking about...

Zeffer,
yes, you're right ..haha.., now action is on movie clip (extended out the length of the
time line) & is working,
but there's one problem with:

onClipEvent (enterFrame) {
if(Key.isDown(Key.ESCAPE)) {
fscommand("fullScreen", true);
}
}
after I hit Esc key animation comes back to full screen
BUT
movie stops on the frame where the Esc was pressed,
so I need another play button , that's no good.
Can this be fixed ?
The main anim. movie should play even after Esc is pressed.
--------------------
This one, plays all right & no need to extend movie clip with action,
similar with Object Action (Normal Mode) Basic Actions
fscommand("trapallkeys", true); that I discover after looking at yours :

rascalpants,
Hahaha...It isn't so evil, if ones knows a couple things or two (haha..) :
Esc + Shift + Ctrl > Win NT4 task manager - still works to end chosen task
Alt + Ctrl + Del - knocks all wind. & apps. down
& there's always the Main switch or
just puling the plug ( the worst nightmare of any machine!)...hah aha...
rascal pants,
Today, I will not have time to look in to your idea. (perhaps tomorrow)

Your: flash_fullscreen_button. Did you read in my previous question :
>>I've just noticed , your solution is not a button at all, wherever someone clicks on the
>>screen the swf goes full screen , we don't need the designated area "go full screen".
>>So, a viewer can click unintentionally anywhere & movie goes to full screen that's no good
>>& PRECISE for the flash ....hmmmm...Try your test to see what I mean.<<
& I stress: CLICK UNINTENTIONALLY (if it is still there I'm not buying ...haha....)

As I said to Zeffer
>>>>>>>ya get this new software (MX) and it's so clever<<
well...Did you know that for frame-by-frame animation I use actually
Flash 4 selection style ( is more efficient); a couple people who
animate they prefer it too.
So tell me why I need (MX) ; for a few buttons ,....neeee...<<<<<<<

Personally , I do not mind to combine the solution. I do that all the time, as long as
goal is reached. Actually that's very good approach to everything.
------------------------
Ps. Even if I kill all the keys that's all right this is just an anim. movie
NOT anything INTERACTIVE.

as I said in my last post, I used Z's solution to the fullscreen problem(flash 5) and I combined it with the code that was supplied in this thread...

take a look at it when you get a chance...

also...

">>>>>>>ya get this new software (MX) and it's so clever<<
well...Did you know that for frame-by-frame animation I use actually
Flash 4 selection style ( is more efficient); a couple people who
animate they prefer it too.
So tell me why I need (MX) ; for a few buttons ,....neeee...<<<<<<<"

There is absolutely no reason to use Flash 4 to do frame by frame animation. they all work the exact same way for that... I bet the same people who are still using Flash 4 are the same people who code everything by hand in a txt file, because they think Dreamweaver(or any other WYSIWYG) is the devil.

I never said you should go BUY mx, I just said you should use MX... :)

And unless you will never again use flash, then you should upgrade to MX, because it simplies everything, and is much more dynamically compatible.

or just keep spending countless hours asking questions about "previous version solutions" on boards like these, so us experts have something to do :)

Zeffer, you did not write >> _root. <<
Perhaps, that's obvious for you but not me & any computer
(computers are not so smart , after all ; despite that some people like to think so)
...hahaha....
Have a look , now I'm sure, esckTestZ4.fla is the one & I'll lock the question.
Thanks :)

here's the thing..in your question you said it was for
flash projector .exe

both of those samples you sent work if you test by clicking
the exported swf or exe..testing in Flash authoring ..
both of them stop the animation.

#4 is a little smoother (works quicker)..as there is the reference to _root..
the player will reference root by default..if you just use
play();..but obvoiusly it takes a fraction longer to think
about it.

but BOTH of them work..in standalone player.
but #4 is best..for the reason described above.
Z

Zeffer,
yes you're right about flash projector .exe
well... hate to argue Zeffer, I sent swf, because they are smaller but there you have
both exe (esckTestZ2.exe & esckTestZ4.exe), try mine....hahaha...
Z2.exe stops when Esc key pressed; on my Macromedia Flash Player 5.0 . I was curious
This is strictly an academic discussion...haha... esckTestZ4.exe works !

I got my answer when you killed all keys, I kept going so I can use
your last solution for something interactive , but by then we will have
a Flash 7 or whatever its name will be & I'd like to upgrade.
Flash5 speeds things up a bit , but frame-by-frame anim. is still long process.
(too long for me :) :) :)

the .swf's work fine..I can't see that there would be a
difference to an exe..they both use the standalone player..
and i'll take your word on it for the exe's.
I looked at 4..but 2 is not showing the projector icon..so
I am not going to open it..you understand of course:)

ok Zeffer,
yes, I looked at them both when zipped & they do not have projector icons.
I've never done (zipped) exe file just sent it in its original state,
didn't hear about any problems so far.
ok. thanks for your trouble.

0

Featured Post

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Introduction
This article is primarily concerned with ActionScript 3 and generally specific to AVM2. Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3.
With the advent of ActionS…

While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…

In this tutorial viewers will learn how to create a basic motion tween animation in Flash
Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …

In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation
Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…