Bonjour
http://s.w.o.free.fr/index.html
J'ai réalisé ceci en ajoutant deux images sur la page principale.
Avec les touches de directions le décore bouge.

avec le code : (fonctionne)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var Speed_ciel=10;
this.ciel1.onEnterFrame = function()
{
  if(Key.isDown(Key.LEFT))  this._x += Speed_ciel;
  if(Key.isDown(Key.RIGHT)) this._x -= Speed_ciel;
  if(this._x<=-320)         this._x = 320;
  if(this._x>320)           this._x = -320+Speed_ciel;
} 
 
this.ciel2.onEnterFrame = function()
{
  if(Key.isDown(Key.LEFT))  this._x += Speed_ciel;
  if(Key.isDown(Key.RIGHT)) this._x -= Speed_ciel;
  if(this._x<=-320)         this._x=320;
  if(this._x>320)           this._x=-320+Speed_ciel;
}
Je désire réaliser la même chose avec les fichiers.
Car plus tard, il y aura plusieurs images différentes.

Le problème, ça ne fonctionne pas.
Il y a surement des erreurs.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var Speed_ciel=10;
import flash.display.BitmapData;
 
this.createEmptyMovieClip("holder0_mc", this.getNextHighestDepth());
loader0 = new MovieClipLoader();
loader0.addListener(this);
loader0.loadClip("image310.jpg", holder0_mc);
function onLoadInit() 
{
 myBitmap0 = new BitmapData(320, 240, true, 0x00FFFFFF);
 myBitmap0.draw(holder0_mc);
 holder0_mc.removeMovieClip();
 beginBitmapFill(myBitmap0);
 lineTo(-320, 0);
 lineTo(-320, 240);
 lineTo(0, 240);
 endFill();
 this.onEnterFrame = function()
 {
   if(Key.isDown(Key.LEFT))  this._x += Speed_ciel;
   if(Key.isDown(Key.RIGHT)) this._x -= Speed_ciel;
   if(this._x<=-320)         this._x = 320;
   if(this._x>320)           this._x = -320+Speed_ciel;
 }
}
////////////////////
this.createEmptyMovieClip("holder1_mc", this.getNextHighestDepth());
loader1 = new MovieClipLoader();
loader1.addListener(this);
loader1.loadClip("image311.jpg", holder1_mc);
function onLoadInit() 
{
 myBitmap1 = new BitmapData(320, 240, true, 0x00FFFFFF);
 myBitmap1.draw(holder1_mc);
 holder1_mc.removeMovieClip();
 beginBitmapFill(myBitmap1);
 lineTo(320+320, 0);
 lineTo(320+320, 240);
 lineTo(0, 240);
 endFill();
 this.onEnterFrame = function()
 {
   if(Key.isDown(Key.LEFT))  this._x += Speed_ciel;
   if(Key.isDown(Key.RIGHT)) this._x -= Speed_ciel;
   if(this._x<=-320)         this._x = 320;
   if(this._x>320)           this._x = -320+Speed_ciel;
 }
}
Merci beaucoup

Pour simplifier, je souhaite faire la même chose que :
http://s.w.o.free.fr/index.html
en utilisant les fichiers « image310.jpg » et « image311.jpg » avec BitmapData
Au secours, je n'y arrive pas