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()
{
var cnx = swhx.Connection.desktopConnect();
cnx.App.writeData.call( [ ???test.txt???, send_tf.text ] );
send_tf.text = ???The test.txt file has been created!???;
}
}
(continued)
Part III: Extending the Possibilities
522
public static function showData( val : String )
{
receive_tf.text = val;
}
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 class into a Flash file called ui.swf .
Now, if you run app.n from the command line, you should be presented with a window displaying two
text fields and a square green button. By entering text into the top text field, then pressing the green
button, you cause the Flash layer to send the content of the text field to the Neko layer, which then gets
written to a file test.
Pages:
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969