FlashDevelop/Example

From Chumby Wiki
Jump to: navigation, search

This is an example How-To for creating a "Hello World" widget to run on your Chumby.

The intent is to show a start to end process for getting your own program to run on your Chumby.

Currently being authored by Kayakpete

Prerequisites

  • FlashDevelop Installed on your computer
  • A Chumby, with SSH enabled
  • A Thumbdrive

Create a New Project

Create a new Project in FlashDevelop:

  • Start FlashDevelop.
  • Click Project -> New Project
  • Select ActionScript 2 - Default Project.
  • Give this project a name "Hello World", and check the "create directory for project" check box.

This will give you a Project pane on the right side, with a classes and library folder.

Write your program

  • Open the Main.as file, located in the classes folder, on in the right pane.
  • Write the Hello world program as follows:


class Main
{
	public static function main():Void
	{       
		_root.createTextField("t",2,20,20,100,30);
		_root.t.text = "Hello, world!";     
	}
}

Test your program in FlashDevelop

Click on Project->Test Movie (or F5)

A new page will open with your Hello World program running. Note the "Hello World.swf" tab. You have just created your first swf file!

Move your program to your Chumby

  • Copy the Hello World.swf file from your project directory to your flash drive, root directory
  • Plug your thumb drive into your chumby
  • Open a SSH session to your chumby
  • Confirm your program is visible:
chumby:~# ls /mnt/usb
Hello World.swf
chumby:~#

Test your program on your Chumby

  • Stop the current Chumby flash player
chumby:~# stop_control_panel
*** stoping services
*** stopping control panel
*** killing registered flashplayer pid: 2237
chumby:~#
  • Run your program
chumby:~# chumbyflashplayer.x -i /mnt/usb/Hello\ World.swf
Adobe FlashLite 3.0.2 Release (Version 8,1,52,0)- Chumby Industries (version 6 build 45-396 [GCC 4.1.2   Microcross GNU  X-Tools(tm)])
Features:  Video ALSA
Build time: Tue 30Oct2007 1658


  • Confirm your program is running on your chumby!
  • Use ctrl-C to exit the player.
  • Restart your Chumby to restore to normal operations OR to restart Chumby flashplayer:-
 chumby:~# start_control_panel


Congratulations, you have successfully run your own Chumby Widget.

Alternative Testing on your Chumby

You may find using the profile.xml file easier than the above method.

See: Chumby_tricks#Mixing_local_widgets_into_a_channel