Einzelnen Beitrag anzeigen

newmusicslamer

Registriert seit: 27. Feb 2012
29 Beiträge
 
Delphi 7 Personal
 
#1

Image5 wird als undefiniert bezeichnet obwohl definiert!

  Alt 9. Mär 2012, 20:29
Delphi-Version: 7
Hallo!

Ich bins schon wieder in meinem Programm zeigt er an Image5 sei undefiniert, obwohl es eindeutig als TImage definiert wurde!
Hier der Quellcode:
Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Gauges, MPlayer, XPMan;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Image2: TImage;
    Image4: TImage;
    Gauge1: TGauge;
    Label1: TLabel;
    MediaPlayer1: TMediaPlayer;
    Image5: TImage;
    XPManifest1: TXPManifest;
    Gauge2: TGauge;
    Label2: TLabel;
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormCreate(Sender: TObject);
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image2MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image5MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  p: TPoint ;
  Form1: TForm1;
  backz, haus, level: Integer ;


implementation

{$R *.dfm}

procedure TApplication ;
begin
repeat
 image5.left := image5.left +10 ;
 sleep(3000) ;
 image5.left := image5.left +10 ;
 sleep(3000) ;
 image5.left := image5.left +10 ;
 sleep(3000) ;
 image5.left := image5.left -10 ;
 sleep(3000) ;
 image5.left := image5.left -10 ;
 sleep(3000) ;
 image5.left := image5.left -10 ;
 sleep(3000) ;
until backz = 1 ;
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: word;
  Shift: TShiftState);
begin
  if key = Ord('W') then Image1.Top := Image1.Top - 10 ;
  if key = Ord('S') then Image1.Top := Image1.Top + 10 ;
  if key = Ord('A') then Image1.Left := Image1.Left - 10 ;
  if key = Ord('D') then Image1.Left := Image1.Left + 10 ;
  if image1.Left = 14 then
  begin
    image1.Left := Image1.Left + 820 ;
    backz := backz + 1 ;
    haus := haus + 1 ;
    case backz of
         1 : image2.Picture.LoadFromFile('.\data\back2.bmp');
         2 : image2.Picture.LoadFromFile('.\data\back3.bmp');

    end;
if (image1.Left = image5.Left) and (image1.Top = image5.Top) then gauge1.Progress :=
gauge1.Progress -10 ;
if gauge2.Progress = 100 then
//begin
//level := level +1 ;
//gauge2.Progress := 0 ;
//label2.Caption := 'Level' + level ;
//end;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
image1.Picture.LoadFromFile('.\data\jo.bmp') ;
image2.Picture.LoadFromFile('.\data\back.bmp') ;
image4.Picture.LoadFromFile('.\data\shot.bmp');
image4.Visible := false ;
gauge1.Progress := 100 ;
image5.Picture.LoadFromFile('.\data\monster.bmp');
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin;
end;

procedure TForm1.Image2MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);

begin
 image4.Visible := true ;
 p := Mouse.CursorPos ;
 image4.left := ScreenToClient(p).X;
 image4.top := ScreenToClient(p).Y ;
end;

procedure TForm1.Image5MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 image5.Visible := false ;
 gauge2.Progress := gauge2.Progress +10 ;
 image4.Visible := true ;
 p := Mouse.CursorPos ;
 image4.left := ScreenToClient(p).X;
 image4.top := ScreenToClient(p).Y ;
end;


end.
So nun zeigt er mir im ersten Prozess (TApplication) an image5 sei undefiniert bzw. unbekannt.

Ich hoffe ihr könnt mir helfen!
newmusicslamer
Delphi for the win!
  Mit Zitat antworten Zitat