<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-33559539</id><updated>2009-10-02T10:06:33.988-07:00</updated><title type='text'>Harouny's Blog!</title><subtitle type='html'>Web and Multimedia Developing Posts</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oldharouny.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33559539/posts/default'/><link rel='alternate' type='text/html' href='http://oldharouny.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>harouny</name><uri>http://www.blogger.com/profile/03811126267470380629</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-33559539.post-542348710959872128</id><published>2007-04-24T02:27:00.000-07:00</published><updated>2007-04-24T04:17:00.830-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='action script'/><category scheme='http://www.blogger.com/atom/ns#' term='Key Class'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Key Class In Flash - Part1</title><content type='html'>&lt;span style="color: rgb(51, 51, 0);"&gt;In this tutorial I will show you how to interact with the keyboard in Flash using the Key Class:&lt;br /&gt;&lt;br /&gt;1- craete a new flash movie and select the first frame&lt;br /&gt;2- open Actions window and type this code&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;blockquote style="font-style: italic;"&gt;&lt;span style="color: rgb(51, 51, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;var listener:Object = new Object;&lt;br /&gt;Key.addListener(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;listener);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;listener.onKeyDown = function():Void{&lt;br /&gt;trace(Key.getCode());&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="color: rgb(51, 51, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(51, 51, 0);"&gt;Now, click on Control&amp;Enter to test the movie and press on keyboard keys,  you should see some numbers in the output panel every time you click a keyboard button&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Explanation:&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0); font-style: italic;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;    &lt;span style="font-size:85%;"&gt;var listener:Object = new Object;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;This line just creates an object named "listener".&lt;br /&gt;------------&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0); font-style: italic;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;    &lt;span style="font-size:85%;"&gt;Key.addListener(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0); font-style: italic;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-size:85%;"&gt;listener);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Here we are telling &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"listener" to start listening to the Key class.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;----------------&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0); font-style: italic;font-size:85%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;    listener.onKeyDown = function():Void{&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0);font-size:85%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-size:100%;"&gt;Now we are declaring an event the belongs to the Key class which is onKeyDown and what it does that it runs the function that it is attached to every time a keyboard button is clicked.&lt;br /&gt;-----------&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0); font-style: italic;font-size:85%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;    trace(Key.getCode());&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0);font-size:85%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-size:100%;"&gt;Trace outputs text to the output panel while testing movie in runtime and here I told it to output the &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0); font-style: italic;font-size:85%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;getCode() &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 0);font-size:85%;" &gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-size:100%;"&gt;Property which is associated with the key class and all it does is returning the code of the clicked putton.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33559539-542348710959872128?l=oldharouny.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oldharouny.blogspot.com/feeds/542348710959872128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=33559539&amp;postID=542348710959872128' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33559539/posts/default/542348710959872128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33559539/posts/default/542348710959872128'/><link rel='alternate' type='text/html' href='http://oldharouny.blogspot.com/2007/04/in-this-tutorial-i-will-show-you-how-to.html' title='Key Class In Flash - Part1'/><author><name>harouny</name><uri>http://www.blogger.com/profile/03811126267470380629</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03393264812639035078'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry></feed>