Drain pineapple, reserving juice.
Dissolve gelatin in boiling water; add pineapple.
Pour into a 13x9x2 inch dish; chill until almost set, about 45 minutes.
In a mixing bowl, beat cream cheese and whipped topping until smooth.
Carefully spread over gelatin; chill for 30 minutes.
Meanwhile, in a saucepan over medium heat, combine sugar, lemon juice, water, flour, egg yolks and reserved pineapple juice; bring to a boil, stirring constantly. Cook 1 minute or until thickened, Cool.
Carefully spread over cream cheese layer; chill for at least 1 hour.