Prev | Current Page 952 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

current.attachMovie( UI.className, ???ui???, 0 );
}
public function new()
{
drawRect( this, 20, 20, 0xFF0000 );
this.onEnterFrame = function()
{
if ( dir[0] == true )
{
if ( ++scale[0] > = 10 ) dir[0] = false;
}
else
{
if ( --scale[0] < = -10 ) dir[0] = true;
}
count[0] = 100 + scale[0];
if ( dir[1] == true )
{
if ( ++scale[1] > = 20 ) dir[1] = false;
}
else
{
if ( --scale[1] < = -20 ) dir[1] = true;
}
Chapter 18: Desktop Flash with SWHX
519
count[1] = 100 + scale[1];
Lib.fscommand( ???moveUpDown???, Std.string( count[1] ) );
Lib.fscommand( ???moveLeftRight???, Std.string( count[0] ) );
}
}
public static function drawRect( m : flash.MovieClip, w : Int, h : Int, c : Int )
{
m.beginFill( c );
m.moveTo( 0, 0 );
m.lineTo( w, 0 );
m.lineTo( w, h );
m.lineTo( 0, h );
m.lineTo( 0, 0 );
m.endFill();
}
}
Compile this for Flash as ui.swf . Next, create a new document and enter the following:
class NekoLayer
{
public static function main()
{
var inst = new NekoLayer();
}
public function new()
{
swhx.


Pages:
940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964