all groups > flash actionscript > april 2005 >
You're in the

flash actionscript

group:

Creating actionscript buttons


Re: Creating actionscript buttons GaryCCY
4/11/2005 12:00:00 AM
flash actionscript:
Which movie you want to play? case 1: THE movie Assume its the swf file
itself. In the first frame, put a _root.stop() in order to stop the swf from
playing. Then you have a 'Play Me' button called play_btn with actionscript
play_btn.onRelease = function(){ _root.play(); } case 2: another movie clip
Just modify the function play_btn.onRelease = function(){
to_whatever_movie_clip_U_want_2.play(); } Or you actually looking for
something else?
Creating actionscript buttons MarkDDIM
4/11/2005 4:13:22 PM
Re: Creating actionscript buttons MarkDDIM
4/13/2005 3:48:43 PM
Ahh, thats it, case 1, thank you very much for helping me


Re: Creating actionscript buttons kelogssss
4/15/2005 12:00:00 AM
I use the following method for all my buttons...

play_btn.onRelease = function(){
_root.play();
}

but is there a way I can get it to respond to the 'keyPress <Enter>' as well
without having to type out a separate function?
Re: Creating actionscript buttons GaryCCY
4/15/2005 12:00:00 AM
in stead of saying play_btn.onRelease = function(){...} you should
play_btn.onRelease = myFunction; and somewhere define this function function
myFunction(){ _root.play(); } and when key press <ENTER>, also refer to the
same function as the button did
Re: Creating actionscript buttons kelogssss
4/15/2005 4:45:28 PM
Originally posted by: GaryCCY
in stead of saying play_btn.onRelease = function(){...} you should
play_btn.onRelease = myFunction; and somewhere define this function function
myFunction(){ _root.play(); } and when key press <ENTER>, also refer to the
same function as the button did

Thank you! I've defined a separate function and a mouse-click works but not
the ENTER button ; is this the right code :



keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.getCode() == Key.ENTER) {
_root.play;
}
}
Key.addListener(keyListener);
Re: Creating actionscript buttons GaryCCY
4/18/2005 12:00:00 AM
Following code works fine. If yours look the same but not working when you
choose <Test movie>, thats because ENTER key is not working as what you
expected when in testing mode. Compile and run the swf file instead and things
should work well. //Define a function function playNow(){ _root.play() };
//Define button on release event _root.play_btn.onRelease = playNow; //Define
key listener keyListerner = new Object(); keyListerner.onKeyDown = function() {
if(Key.getCode()==Key.ENTER){ playNow(); } };//End
keyListerner.onKeyDown Key.addListener(keyListerner); //stop movie until user
click or press ENTER stop();
AddThis Social Bookmark Button