Prev | Current Page 962 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

createTextField( ???receive_tf???, 2, 10, 40, 150, 100 );
receive_tf.border = true;
send_mc = this.createEmptyMovieClip( ???send_mc???, 3 );
send_mc._x = 170;
send_mc._y = 10;
drawRect( send_mc, 20, 20, 0x00FF00 );
send_mc.onRelease = function()
{
swhx.Api.call( ???App.writeData???, ???test.txt???, UI.send_tf.text );
UI.send_tf.text = ???The test.txt file has been created!???;
}
}
public static function showData( val : String )
{
receive_tf.text = val;
}
public static function drawRect( m : MovieClip, w, h, c : Number )
{
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();
}
}
This should compile with no problems for Flash versions 6 to 8, provided you set a class path to the
SWHX ActionScript 2 extension files.
As you can see from the aforementioned class, little was changed from the haXe version. Obviously,
there were necessary syntax changes required from converting the script from one language to the other,
but with regard to converting the class for use with the new SWHX ActionScript 2 classes, all you were
required to do was to initialize the API with a call to swhx.


Pages:
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974