Flash Lite Key Broadcaster

Flash Lite Key Broadcaster  

Description: Simplify complex applications by using a key broadcaster to manage all user inputs. Drop the source movie clip into your application, set a couple of variables and you are ready to go. If you need to change what a button does, just change the string value of a variable and the button performs differently.

Download: KeyBroadcaster.zip (23K)

Documentation:
Unzip the files, and open KeyBroadcaster.fla. Offstage to the left you will see a movie clip shaped like the dial pad of a cell phone with the number keys, soft keys, enter button and 4-way nav buttons. Copy this movie clip into your application FLA (any timeline will do, but it should exist at all times to avoid losing the assigned controls.

At the point where you instantiate the movie clip, you need to assign the callPath variable. This is a string containing the path to the timeline where your custom key actions will be written. For example, if you are going to put your actions on the root, the class path would be "/".

For any key that you want to listen to, you need to set a specific variable within the dialpad movie clip with the string of the frame label you want to call in the callPath timeline. You also need to create the keyframe with a label in the timeline specified by callPath and place any code you want. Feel free to assign more than one key to the same frame action or reassign a key variable at any time. Below is a list of available key variables that can be set.

  • key1
  • key2
  • key3
  • key4
  • key5
  • key6
  • key7
  • key8
  • key9
  • key0
  • keyUp
  • keyDown
  • keyRight
  • keyLeft
  • keyEnter
  • keySoftLeft
  • keySoftRight
  • keyStar
  • keyPound

Troubleshooting

What if my keys reset randomly?
Are you sure that the dialpad movie exists at all times? It you aren’t sure, try this. go into the dialpad movie and add trace("dialpad initialized") to frame 1. Test the flash file in the IDE (trace won’t do anything meaningful on your phone). Play with your application until the keys reset. When the reset happened check the output panel to see if the trace happened. If it did, check to see if it is possible that the layer of the timeline that the dialpad is on is shorter than any other layer or if there are any other keyframes in that layer. If that still doesn’t take care of it, check any parent timelines for similar issues.

Does the classPath have to be static path?
no, the classPath can also be relative, but it must be relative from the dialpad to the target timeline.

3 thoughts on “Flash Lite Key Broadcaster

  1. ei, can u help me how to place a flash media player in my blog? i have a problem putting it there because only links are allowed.. though i saw one whom had placed a flash video in her blog… pls… tnx

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>