Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

Tutorial: making an Flash Lite SWF animation with objects responding when user press Enter key on his mobile device

SWF Scout -is capable of generating Flash Lite and i-mode compatible flash animations. This includes ActionScript support.

This example will show how to generate Flash Lite compatible flash animation file where sprite object responds to <Enter> key press on a mobile device (or when user press joystik).

Another supported keys in SWF Scout Actionscript compiler are: <Enter>, <Up>, <Down>, <Left>, <Right>, <PageUp>,
<PageDown> and other.

Download source code of this example: swfscout_flash_lite_move_button_on_key_press.zip (2KB)

A screenshot of the resulted SWF movie (in i-mode simulator):

Produced flash lite compatible movie in i-mode simulator

Resulted flash movie (Btn_KeyPress_AS_SCRIPT_Compile.swf)

 

Source code:

' ////////////////////////////////////////////////
' converting AVI video into FLV using FFMPEG Scout
' ////////////////////////////////////////////////

W = 320
H = 240
Set Movie = CreateObject("SWFScout.FlashMovie")
Movie.InitLibrary "demo","demo"

Movie.BeginMovie 0,0,W,H,1,12,101 ' 101 - is a Flash Lite compatible file format

Font = Movie.AddFont( "Arial",12,true,false,false,false,0)
FontBig = Movie.AddFont("Arial",40,true,false,false,false,0)

'///////////////////
' Create a text and a button
'//////////////////////

Text = Movie.AddText("Press Enter key to move a ball",0,0,0,255,Font, 0, 80, 170, 160)
Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text

Shape = Movie.AddShape
Movie.SHAPE_Circle 0, 0, 40
Movie.SHAPE_BeginRadialGradient
Movie.SHAPE_AddRadialGradientColor 255,255,255,255
Movie.SHAPE_AddRadialGradientColor 0,0,255,255
Movie.SHAPE_EndRadialGradient 35,35

Shape2= Movie.AddShape
Movie.SHAPE_Circle 0,0,40
Movie.SHAPE_BeginRadialGradient
Movie.SHAPE_AddRadialGradientColor 255,255,255,255
Movie.SHAPE_AddRadialGradientColor 0,0,128,255
Movie.SHAPE_EndRadialGradient 40,40

Button = Movie.AddButton(false,true)
Movie.BUTTON_AddShape Shape, 0 ' sbstUp = 0
Movie.BUTTON_AddShape Shape, 3 ' sbstHitTest = 3
Movie.BUTTON_AddShape2 Shape,2,1.1,1.1,0,0,0,0,0,scttNone,0,0,0,0,false ' sbstOver = 2, scttNone = 2
Movie.BUTTON_AddShape2 Shape2,1,1.1,1.1,0,0,0,0,0,scttNone,0,0,0,0,false

sCode = "on(keyPress '<Enter>'){if(_root._x>200){_root._x -= 1;}else{_root._x+=1;}}"

Movie.BUTTON_CompileEvent sCode

Movie.PlaceButton Button,Movie.CurrentMaxDepth
Movie.PLACE_SetTranslate 100,150
Movie.PLACE_Name = "btn"

Movie.ShowFrame 1
Movie.EndMovie

Movie.SaveToFile "Btn_KeyPress_AS_SCRIPT_Compile.swf"

Download source code of this example: swfscout_flash_lite_move_button_on_key_press.zip (2KB)


Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials  |  News |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement