Difference between revisions of "FlashDevelop/Example"
From Chumby Wiki
(New page: 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. Curr...) |
|||
Line 4: | Line 4: | ||
Currently being authored by Kayakpete | 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 == | ||
+ | |||
+ | 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:~# | ||
+ | |||
+ | * 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 | ||
+ | |||
+ | |||
+ | Congratulations, you have successfully run your own Chumby Widget. |
Revision as of 19:44, 3 December 2007
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
Contents
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
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:~#
- 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
Congratulations, you have successfully run your own Chumby Widget.