Servo control

My servo's working fine(ran the "sweep" example with success). Also I tried to read the data coming to the 2nd arduino in the serial monitor (for my case COM-4) as I applied on the slider in applet running by processing, sending serial data to the first arduino(COM-14). I was communicating successfully.
Here are the codes :
------------Processing applet code--------------

import processing.serial.*;
import controlP5.*;

Serial port;
ControlP5 cp5;

int tilt = 0;

void setup() 
{
size(200, 200);

port = new Serial(this, "COM4", 9600);
//port.bufferUntil('\n');

cp5 = new ControlP5(this);

cp5.addSlider("tilt")
     .setPosition(88,7)
     .setSize(20,180)
     .setRange(0,180)
     .setValue(90)
     ;
}

void draw() 
  {
    background(0);
    println(tilt);
    port.write(tilt);
  }

Arduino code which will receive serial data from the Processing & communicate with other arduino through I2C.

------------Arduino One Code-------------------

#include <Wire.h>

void setup()
{
  Wire.begin();
  Serial.begin(9600);
}

int x = 0;

void loop()
{
  while(Serial.available())
  {
    x = Serial.read();
    
    Wire.beginTransmission(4);
    Wire.write(x);
    Wire.endTransmission();
    
    Serial.flush();
    
    delay(20);
  }
}

the code for Arduino which will receive data fro the 1st arduino & print the results in the serial monitor.

----------------Arduino Two Code--------------------

#include <Wire.h>
#include <Servo.h>

Servo myservo;

void setup()
{
  Serial.begin(9600);
  myservo.attach(9);
  Wire.begin(4);                
  Wire.onReceive(receiveEvent); 
}

void loop()
{ 
   delay(5);
}

void receiveEvent(int howMany)
{
   int x = Wire.read();
   myservo.write(x);
   Serial.println(x);
   Serial.flush();  
  }

I guess the servo is getting same value multiple times & thus is freaking out(As it is coming serially all the time). I need to use something that will let the servo pick up a changed values once (as they change) only to make it move & not the same value continuously coming over serially to first arduino & to it through I2C finaly.
Something to flush the excess data.

Can any body test anything on this & help with a modified code please?