/**
   * Update the Flash animation. This generates the flash code and writes it to the temporary file.
   */
  public void update(View view) {

    // Create a new network.
    Network network = null;
    Module module = null;
    if (view.getElement() instanceof Connector) {
      Connector connector = (Connector) view.getElement();
      network = new Network(connector);
      module = connector.getModule();
    }
    if (view.getElement() instanceof Component) {
      Component component = (Component) view.getElement();
      network = new Network(component);
      module = component.getModule();
    }

    if (module == null || network == null) {
      return; // Abort.
    }

    // Module scope?
    if (ReoPreferences.useModuleScope()) {
      network = new Network(module);
    }

    // Check if all component ends are connected.
    for (Component component : network.getAllComponents()) {
      for (PrimitiveEnd end : component.getAllEnds()) {
        if (end.getNode() == null) return; // Abort.
      }
    }

    // Do the actual job.
    update(network, null);
  }