^ Boot Camp 01
what is actionscript?
// mxmlc Main.as -output=foo.swf -default-size=800,600 -default-frame-rate=30 -default-background-color=0x00ff00
package
{
import flash.display.MovieClip;
import flash.system.Capabilities;
public class Main extends MovieClip
{
public function Main()
{
trace("hello tracelog, i am version " +Capabilities.version);
}
}
}
Main.as
what is flash?
- the flash player: a lightweight runtime built for interactive media
- the flash IDE: an application for drawing, composing, and scripting timeline animation
- a core set of classes: flash.*
what is flex?
- actionscript
- a declarative markup language: mxml
- extensions to the core classes: mx.*
- an SDK
the editor
- flash develop (Start > Programs > Development > Flash Develop)
- Flash IDE (Start > Programs > Graphics 2D > Adobe Flash CS3)
- FlexBuilder for Eclipse
- FDT for Eclipse
- notepad++, textpad, textmate, sepy, scite, notepad, etc.
the compiler
- C:\flex_sdk_3\bin (Start > settings > Control Panel > System | Advanced : Environment Variables, add to path)
- mxmlc
- fcsh
- more...
the trace log
- mm.cfg (save to C:\Documents and Settings\<you>)
- debug player (C:\flex_sdk_3\runtimes\player\10\win)
- baretail (start > Programs > Development > BareTail 3.5), open Z:\Profile\Application Data\Macromedia\Flash Player\Logs\flashlog.txt
hello tracelog
figures
##
# mm.cfg
#
# see: http://www.adobe.com/go/kb403009
# http://livedocs.adobe.com/flex/3/html/help.html?content=logging_04.html
# http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security_05.html#_Using_Logging
#
# save to (XP) : C:\Documents and Settings\<you>\mm.cfg
# (OSX): /Library/Application Support/Macromedia
# (Nix): /home/username
#
# logs at (XP) : C:\Documents and Settings\<you>\Application Data\Macromedia\Flash Player\Logs\flashlog.txt
# (OSX): /Users/username/Library/Preferences/Macromedia/Flash Player/Logs/
# (Nix): /home/username/.macromedia/Flash_Player/Logs/
#
# log viewers:
# Firefox plugin: https://addons.mozilla.org/en-US/firefox/addon/3469
# Tail: tail -f Profile/Application\ Data/Macromedia/Flash\ Player/Logs/flashlog.txt
# BareTail: http://www.baremetalsoft.com/baretail/
##
## error and trace logging (logged to 'flashlog.txt')
ErrorReportingEnable=1 # 1 for yes, enable error logging; 0 for no error logging
TraceOutputFileEnable=1 # 1 for yes, enable trace logging; 0 for no trace logging
# other options
MaxWarnings=0 # number of warnings to top out at, 0 is unlimited, 100 is default
## policy activity logging (logged to 'policyfiles.txt' in same folder as 'flashlog.txt')
PolicyFileLog=1 # 1 for yes, enable policy activity logging; 0 for no policy activity logging
PolicyFileLogAppend=0 # 1 for yes, append (do not clear log at startup); 0 for no append (clear file at start)
# ignored, flash player always writes to predefined locations as of player 9
#TraceOutPutFileName=<path-to-log-file>
mm.cfg
/*
Mini logger
*/
package
{
import flash.utils.getQualifiedClassName;
import flash.utils.getTimer;
final public class C
{
private static var _enabled:Boolean;
public static function out(origin:*, s:String, force:Boolean=false, fullPath:Boolean=false):void {
if (_enabled || force) {
var packages:Array = getQualifiedClassName(origin).split("::");
var originClass:String = fullPath ? packages.join(".") : String(packages[packages.length-1]);
var prefix:String = force ? "*" : " ";
var msg:String = pad(getTimer().toString()) +prefix +"[" +originClass +"] " +s;
trace(msg);
}
}
public static function get enabled():Boolean { return (_enabled == true); }
public static function set enabled(b:Boolean):void {
var wasEnabled:Boolean = _enabled;
_enabled = b;
if (wasEnabled==false && _enabled==true) {
out(C, "---{ [ Trace Log Activated ] }---");
}
else if (wasEnabled==true && _enabled==false) {
out(C, "---{ [Trace Log Deactivated] }---", true);
}
}
private static function pad(s:String, p:uint = 8):String {
while(s.length < p) { s = "0" +s; }
return s;
}
}
}
C.as