1 Reply Latest reply on Nov 13, 2007 8:20 AM by Newsgroup_User

    Right click and Key.isDown - AS3?

    rc3rdmd
      I'm finding out that this function is probably not supported in AS 3. Am i right ? Are there any other solutions ?

      onEnterFrame = function() {
      if (Key.isDown(2)){
      this._parent.gotoAndStop(3);
      }
      }

      Thanks.

      Rob Childress
        • 1. Re: Right click and Key.isDown - AS3?
          Level 7
          rc3rdmd,

          > I'm finding out that this function is probably not supported in AS 3.
          > Am i right ?

          Handling events in AS3 is significantly different from AS2. Here's a
          terrific intro:

          http://www.adobe.com/devnet/actionscript/articles/event_handling_as3.html

          The same approach applies to keyboard presses, to, though there is no
          Key class in AS3. It has changed to Keyboard. Search the phrase "Capturing
          keyboard input" in the Help docs, filtered for ActionScript 3.0, and you'll
          see some sample code that follows right on the heels of the syntax shown in
          that article.

          Finally, there is no _parent property in AS3. A general rule of thumb
          is that, whenever you're looking for a property that begins with underscore
          in AS2, just drop the underscore in AS3. Movie clips and buttons inherit
          from a class called DisplayObject in AS3, and the DisplayObject class
          feature a parent property.

          It may help you to consider everything in ActionScript -- I really mean
          everything -- as an object, as something you can, in an abastract sense,
          manipulate like an object in real life. Objects are defined by classes, and
          classes tend to specify one or more of the following three categories:
          properties (characteristics of the object, such as parent), methods (things
          the object can do), and events (things the object can react to). Objects
          that share things in common -- such as movie clips and buttons -- often
          share a common ancestor in the vast collection of classes that make up AS3.
          You'll see references to "inheritance," and similar terms, that show the
          family tree of the object in question. If you're looking up the MovieClip
          class, for example, and don't immediately see the parent property you're
          expecting to see, click the "Show inherited public properties:" hyperlink to
          find it.


          David Stiller
          Co-author, Foundation Flash CS3 for Designers
          http://tinyurl.com/2k29mj
          "Luck is the residue of good design."




          Are there any other solutions ?
          >
          > onEnterFrame = function() {
          > if (Key.isDown(2)){
          > this._parent.gotoAndStop(3);
          > }
          > }
          >
          > Thanks.
          >
          > Rob Childress
          >