public static void main(String[] args) {
   try {
     String out = args.length == 0 ? "ChangeColour.swf" : args[0];
     ChangeColour example = new ChangeColour();
     Movie movie = new Movie();
     example.createMovie(movie);
     movie.encodeToFile(new File(out));
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  void createMovie(Movie movie) {

    int uid = 1;
    int xLower = 0;
    int yLower = 0;
    int xUpper = 8000;
    int yUpper = 8000;

    DefineShape rectangle = defineRectangle(uid++, WebPalette.RED.color());

    float framesPerSecond = 1.0f;

    MovieHeader header = new MovieHeader();
    header.setFrameRate(framesPerSecond);
    header.setFrameSize(new Bounds(xLower, yLower, xUpper, yUpper));
    movie.add(header);

    movie.add(new Background(WebPalette.LIGHT_BLUE.color()));

    movie.add(rectangle);
    movie.add(Place2.show(rectangle.getIdentifier(), 1, 4000, 4000));
    movie.add(ShowFrame.getInstance());

    /*
     * Change the colour of the rectangle. Here the terms are added to the
     * colour defined for the solid fill style of the rectangle.
     */
    movie.add(
        new Place2()
            .setType(PlaceType.MODIFY)
            .setLayer(1)
            .setColorTransform(new ColorTransform(-255, 255, 0, 0)));
    movie.add(ShowFrame.getInstance());

    /*
     * Change the colour of the rectangle by changing the saturation of the
     * colours by specifying a multiplier for each channel. The alpha
     * channel is omitted so the transparency is not changed.
     */
    movie.add(
        new Place2()
            .setType(PlaceType.MODIFY)
            .setLayer(1)
            .setColorTransform(new ColorTransform(0.7f, 1.0f, 1.0f, 1.0f)));
    movie.add(ShowFrame.getInstance());

    /*
     * Both the add and multiply transforms can be performed in a single
     * step.
     */
    movie.add(
        new Place2()
            .setType(PlaceType.MODIFY)
            .setLayer(1)
            .setColorTransform(new ColorTransform(0, 128, 128, 0, 0.9f, 1.0f, 1.0f, 1.0f)));
    movie.add(ShowFrame.getInstance());
  }