Je suis un pur débutant et j'ai besoin de votre aide pour convertir un morceau de code AS2 en AS3. J'en ai fait la plus grosse partie, je bugge sur une ou deux choses (à partir de SELECTED_FAMILY) et surtout, j'ai besoin de savoir si mon approche est la bonne.
La particularité du code ci-dessous est qu'on utilise l'objet prototype...
Pouvez-vou jeter un coup d'oeil ci-dessous puis m'aider? MERCI pour votre temps!
AS2 Original:
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 Family = function(){ this.init(); } Family.prototype = new MovieClip(); Family.prototype.init = function(){ this.startx = 200 //x starter position this.starty = 250 //y starter position this.selectedFamily = 0 //current selected family this.selectedHolder = 0 //current MC holder of selectedFamily this.cant = 0 //quantity of familys this.dataset = null //here we will copy the recordset of products //when some family is selected, the icon travel at this position this.SELECTED_FAMILY = {x:130, y:80, speed:20} //The not selected family items make a colum starting at this position this.REST_FAMILY = {x:20, y:80, speed:10} this.SHOW_DETAIL = {x:600, y:80} this.lock = false //flag used to enable/disable onPress event this.selectedColor = 0 //number of color to bradcast to UI }
Ma transcription AS3 (non terminée):
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 package { import flash.display.MovieClip; public dynamic class Family extends MovieClip {; public function Family() { this.init(); prototype.newValue = 1; trace(addChild);// output: function Function() { } prototype.init(); } public function init() { var startX:Number; var startY:Number; var selectedFamily:int; var selectedHolder:int; var cant:int; var dataSet:Object;// or String this.startX = 200;//x starter position this.startY = 250;//y starter position this.selectedFamily = 0;//current selected family this.selectedHolder = 0;//current MC holder of selectedFamily this.cant = 0;//quantity of familys this.dataSet = null;//here we will copy the recordset of products //when some family is selected, the icon travel at this position this.SELECTED_FAMILY = {x:130, y:80, speed:20}; //The not selected family items make a colum starting at this position this.REST_FAMILY = {x:20, y:80, speed:10} ; this.SHOW_DETAIL = {x:600, y:80} ; this.lock = false;//flag used to enable/disable onPress event this.selectedColor = 0;//number of color to bradcast to UI } }// eof class }// eof package
Partager