×
Namespaces

Variants
Actions
Revision as of 21:35, 2 October 2007 by hartti (Talk | contribs)

Archived:How to make a signal indicator

From Nokia Developer Wiki
Jump to: navigation, search


Compatibility: Flash Lite: 1.1, 2.x

Creating the signal indicator

  • Create a new movie clip
  • In this movie clip create at least 2 layers:
    • ActionScript: In this layer create as many keyframes as levels you want to display plus one. (we will choose 8 levels in this example, so 9 frames to create)
    • Level:
      • In the first frame, create a level bar corresponding to the lowest level.
      • In the last but one frame create a keyframe and stretch your level bar to the highest level. Then add a motion tween.
      • In the last frame draw an indicator corresponding to the "no network" state.
    • Background: You can add a layer to put all your static components.
    • Your timeline will be like this: Timeline signal.jpg
  • In the first keyframe of the ActionScript layer add this code:
levelsNumber=8;
signalMax = fscommand2("GetMaxSignalLevel");
signalLevel = Math.ceil(fscommand2("GetSignalLevel")*levelsNumber/signalMax);
networkstatus = fscommand2("GetNetworkStatus");
 
if (networkstatus == 0) { //If there is no network
signalLevel = levelsNumber + 1;
}
 
gotoAndPlay(signalLevel);
  • In all other keyframes add this code:
call(1);
  • Put this movie clip into your scene.

Flash Lite 2.x recommended improvements

  • call(1): This action was deprecated in favor of the function statement.


Download

You can download an example with source code here:
Signal Indicator 240*320 (swf + fla)
Example signal.jpg

91 page views in the last 30 days.