Member 68
24 entries

Contributor to project:
Design Media Arts at UCLA
Joe Chunzu Liao (M, 35)
Hong Kong, HK
Immortal since Mar 29, 2007
Uplinks: 0, Generation 1
  • Affiliated
  •  /  
  • Invited
  •  /  
  • Descended
  • Recently commented on
    From adam
    Who gets to go? part 2
    czliao’s project
    Design Media Arts at UCLA
    In the 1970s space colonies were considered to be a viable alternative to a life restricted to planet Earth. The design of cylindrical space...
    Now playing SpaceCollective
    Where forward thinking terrestrials share ideas and information about the state of the species, their planet and the universe, living the lives of science fiction. Introduction
    Featuring Powers of Ten by Charles and Ray Eames, based on an idea by Kees Boeke.
    From czliao's personal cargo

    I | O - interaction
    Project: Design Media Arts at UCLA
    The Arduino–Flash communication tutorial can be found here.

    While the code for the flash side (action scripts) is as follow:
    fscommand("fullscreen", "true");

    //———————————————————————————————————— Basic Arduino

    import Arduino;

    var port:Number = 5331; // What socket port are we configured to use?
    // See the net_port entries from serproxy.cfg

    // Create a custom object from Flash's XMLSocket
    var a:Arduino = new Arduino(port);

    //———————————————————————————————————— Listeners

    // You can trigger custom actions by adding listners to the Arduino object. For example, you can setup your
    // ActionScript code to run a setup function when Flash successfully connects to the socket listener

    aListener = new Object();

    aListener.onConnect = function() {
    trace("hello world");

    aListener.onReceiveData = function(evtObj:Object){
    //Store the received data in a string
    var str =
    trace("Arduino says — " + str);

    if (vid1._currentframe != 1)
    trace("key pressed1");
    vid1._alpha = 0;
    } else {
    trace("key pressed2");
    vid1._alpha = 100;;
    //Tests for a particular message from Arduino, and acts accordingly
    /*if (str == "switchOff") {;
    else if (str == "switchOn") {;

    // Binds your custom listeners to the Arduino object (a)

    //———————————————————————————————————— That's all!

    //keyboard control

    var keyListener:Object = new Object();
    keyListener.onKeyDown = function() {
    if (Key.isDown(Key.SPACE)) {
    if (vid1._currentframe != 1) {
    trace("key pressed1");
    vid1._alpha = 0;
    } else {
    trace("key pressed2");
    vid1._alpha = 100;;

    There're 2 major problems that I faced:

    1,) using netstream functions, you cannot loop video's seamlessly, because they'll always have to reload the video when it ended before it could be played again, so there'll be about half a second of a lag, even when the file is stored locally.

    2.) The arduino communication is based on a .as file stored outside of this code (that's why this is not long at all), however, when I started programming, I chose to try out Action Script 3 — the result is that it wouldn't work because the external .as file is written in AS2 and many syntax were changed only slightly — much enough for me to not be able to translate that whole page into AS3 at that time. Thus, I translated my AS3 code back into AS2, saved it as a AS2 file, it works.

    Sun, Jun 24, 2007  Permanent link

    Sent to project: Design Media Arts at UCLA
      RSS for this post
    Add comment
      Add to favorites
    Create synapse