Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 05-21-2012, 02:02 PM   #1
camelshit
Registered User
 
Join Date: May 2012
Posts: 7
Default Button Help

on actionscript AS2

first, i made a button, what is the code it instead of clicking it 100times i should click it once and it depends on how long i wanted it to be released.

second, is there a code for if a button is pressed a letter on the keyboard will be affected. like when i pressed the circle button it means that im pressing letter "J" on the keyboard which is "74"

any have ideas?
camelshit is offline   Reply With Quote
Old 05-22-2012, 06:58 AM   #2
Prid
Prid - Outing
 
Prid's Avatar
 
Join Date: Oct 2009
Location: Halden, Norway
Posts: 1,157
Send a message via MSN to Prid Send a message via Skype™ to Prid
Default

Hi,

didn't understand your first question...

"Pressing" a key on your keyboard in Flash is impossible, because when you check if a key on your keyboard has been pressed, for instance, "J", then you do something accordingly, but Flash never presses those buttons, YOU do. Flash only listens for those key strokes, hence it's not possible to do this solely with Flash.
__________________
17 Years old boy, who loves the Computer Technology
Prid is offline   Reply With Quote
Old 05-25-2012, 05:42 AM   #3
camelshit
Registered User
 
Join Date: May 2012
Posts: 7
Default

Quote:
Originally Posted by Prid View Post
Hi,

didn't understand your first question...
first of all thanks man

it is holding a button, like holding it down to move my character to the left/right
like in in the keyboard im holding "j" to move my character to the left and releasing "j" to stop
camelshit is offline   Reply With Quote
Old 05-25-2012, 11:27 AM   #4
Prid
Prid - Outing
 
Prid's Avatar
 
Join Date: Oct 2009
Location: Halden, Norway
Posts: 1,157
Send a message via MSN to Prid Send a message via Skype™ to Prid
Default

ActionScript Code:
yourBtn.onPress = function(){     this.onEnterFrame = function(){         // move character here     } } yourBtn.onRelease = yourBtn.onReleaseOutside = function(){     delete this.onEnterFrame; }
__________________
17 Years old boy, who loves the Computer Technology
Prid is offline   Reply With Quote
Old 05-25-2012, 01:38 PM   #5
neilmmm
Senior Member
 
neilmmm's Avatar
 
Join Date: Oct 2005
Location: dorset
Posts: 1,636
Default

if you write a function to move your character

call it when you click the button
and
when you press the key

is this what you are after
neilmmm is offline   Reply With Quote
Old 05-26-2012, 05:16 PM   #6
camelshit
Registered User
 
Join Date: May 2012
Posts: 7
Default

Quote:
Originally Posted by neilmmm View Post
if you write a function to move your character

call it when you click the button
and
when you press the key

is this what you are after
Quote:
Originally Posted by Prid
yourBtn.onPress = function(){
this.onEnterFrame = function(){
// move character here
}
}

yourBtn.onRelease = yourBtn.onReleaseOutside = function(){
delete this.onEnterFrame;
}
neilmm no its just holding and releasing a button. exactly what prid wrote above thanks. thanks both for replies just solved it, now im getting an abnormal headache over this SDK stuff mannn!! ever heard of this? this is totally an eyebug creator

Last edited by camelshit; 05-26-2012 at 05:27 PM.
camelshit is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:01 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.