Help with the code of a game of complete sentences
- dcg76_uamazc
- Born


- Joined: Apr 10, 2010
- Posts: 1
- Status: Offline
Hi, I `ma bit stuck, I` m making a game Where You Have to complete the sentences by dragging the words Which are dinamically generated over right place to STIs Some boxes, everything works fine But if you pull the words out of the pits Placed it all are one crashes.
Unfortunately this is someone elses code (another programmer WHO dance on us in the middle of the proyect) Although I Manage to make it work with new words, making the draggable items you undraggable one place all 4 of them in the boxes is totally right Unclear to me. I `ll appreciate any help I can get.
Here `s all the code That this part of the movie is using, I` m using cs4 with actionscript 2:
Unfortunately this is someone elses code (another programmer WHO dance on us in the middle of the proyect) Although I Manage to make it work with new words, making the draggable items you undraggable one place all 4 of them in the boxes is totally right Unclear to me. I `ll appreciate any help I can get.
Here `s all the code That this part of the movie is using, I` m using cs4 with actionscript 2:
ACTIONSCRIPT Code: [ Select ]
function random (min, max)
(
var _loc2 = true;
if (usados. length <= max - min)
(
while (_loc2! = false)
(
var _loc1 = Math.floor (Math.random () * (max - min + 1));
_loc2 = repeat (_loc1)
) / / End while
used. push (_loc1)
return (_loc1)
)
else
(
return (0);
) / / End else if
) / / End of the function
function repeat (num)
(
_loc1 var = false;
for (i = 0; i <used. length; i + +)
(
if (num == Used [i])
(
_loc1 = true;
) / / End if
) / / End of for
return (_loc1)
) / / End of the function
stop ();
var used = new Array ();
_root. palabras_colocadas = 0;
palabras_correctas = 0;
listado_x = 700;
listado_y = 400;
origenx = 0;
origeny = 0;
estaba_en = -1;
off = false;
_root. sentence = 2;
var words = new Array ("huts", "made", "mud", "straw");
var correct = new Array (false, false, false, false);
var busy = new Array (-1, -1, -1, -1);
my_font var = new TextFormat ();
my_font.font = "Arial";
my_font.color = 0;
my_font. size = 30;
words [i]. embedFonts = true;
my_font.bold = true;
var i = 0;
while (i <4)
(
this ["box" + i]. gotoAndStop (1);
this. createEmptyMovieClip (myClip "+ i, this.getNextHighestDepth ());
length = words [i]. length * 22;
this ["myClip" + i]. createTextField ("label", 1, 0, 0, length, 40);
this ["myClip" + i]. label.text = words [i];
this ["myClip" + i]. label. setTextFormat (my_font)
this ["myClip" + i]. onPress = function ()
(
temp = this. _name;
temp = Number (temp charAt (6));
if (Occupied [0] == temp)
(
off = true;
estaba_en = 0;
) / / End if
if (Occupied [1] == temp)
(
off = true;
estaba_en = 1;
) / / End if
if (Occupied [2] == temp)
(
off = true;
estaba_en = 2;
) / / End if
if (Occupied [3] == temp)
(
off = true;
estaba_en = 3;
) / / End if
if (! off)
(
estaba_en = -1;
) / / End if
origenx = this._x;
origeny = this. _y;
trace ("was" + estaba_en)
this.startDrag ();
);
this ["myClip" + i]. onRelease = this ["myClip" + i]. onReleaseOutside = function ()
(
this.stopDrag ();
which = this._name;
which = Number (cual. charAt (6));
drop = eval (this._droptarget)
trace (drop);
WHERE = String (drop);
frame = donde.substr (8, 6);
WHERE = Number (donde. charAt (14));
trace (Which + "in" + WHERE + "" + table);
if (table == "table")
(
if (Occupied [WHERE]> = 0 & & Occupied [WHERE] <= 3 | | WHERE == estaba_en)
(
off = false;
this._x = origenx;
this._y = origeny;
)
else
(
if (! off)
(
+ + _root.palabras_colocadas;
) / / End if
section = eval ("tranche" + (where + 1) + "_mc");
tramo.gotoAndPlay (2);
if (_root. palabras_colocadas> = 4)
(
startbtn.start ();
start_mc. gotoAndPlay (2);
)
else
(
palabra_ok.start ();
) / / End else if
length = words [Which]. length * 8.500000E +000;
drop.gotoAndStop (2);
this._y = drop._y - 22;
this._x = drop. _x - long;
Occupied [WHERE] = is;
if (off)
(
off = eval ("Table" + estaba_en)
apaga.gotoAndStop (1);
= Eval section ("section" + (estaba_en +1) + "_mc");
tranche. gotoAndPlay (6);
Occupied [estaba_en] = -1;
correct [estaba_en] = false;
off = false;
trace ("is" + _root.palabras_colocadas + "words");
if (_root.palabras_colocadas == 3)
(
trace ("Without noise off");
start_mc. gotoAndStop (1);
) / / End if
) / / End if
trace (Occupied [0] + "" + Occupied [1] + "" + Occupied [2] + "" + Occupied [3]);
if (Which == where)
(
+ + Palabras_correctas;
correct [WHERE] = true;
) / / End if
) / / End if
) / / End else if
if (table == "myClip" | | Table == "start_)
(
palabra_error.start ();
this._x = origenx;
this. _y = origeny;
) / / End if
if (table == "bottom")
(
if (off)
(
off = eval ("Table" + estaba_en)
off. gotoAndStop (1);
= Eval section ("section" + (estaba_en +1) + "_mc");
tramo.gotoAndPlay (6);
Occupied [estaba_en] = -1;
correct [estaba_en] = false;
- _root. Palabras_colocadas;
off = false;
trace ("is" + _root.palabras_colocadas + "words");
if (_root. palabras_colocadas == 3)
(
startbtn.start ();
start_mc.gotoAndStop (1);
) / / End if
) / / End if
) / / End if
);
+ + I;
) / / End while
var ii = 0;
while (ii <4)
(
var numeroNuevo = random (1, 4);
trace (numeroNuevo)
this ["myClip" + numeroNuevo]. _x = listado_x;
this [myClip "+ numeroNuevo]. listado_y + y = 40 * i;
+ + Ii;
) / / End while
(
var _loc2 = true;
if (usados. length <= max - min)
(
while (_loc2! = false)
(
var _loc1 = Math.floor (Math.random () * (max - min + 1));
_loc2 = repeat (_loc1)
) / / End while
used. push (_loc1)
return (_loc1)
)
else
(
return (0);
) / / End else if
) / / End of the function
function repeat (num)
(
_loc1 var = false;
for (i = 0; i <used. length; i + +)
(
if (num == Used [i])
(
_loc1 = true;
) / / End if
) / / End of for
return (_loc1)
) / / End of the function
stop ();
var used = new Array ();
_root. palabras_colocadas = 0;
palabras_correctas = 0;
listado_x = 700;
listado_y = 400;
origenx = 0;
origeny = 0;
estaba_en = -1;
off = false;
_root. sentence = 2;
var words = new Array ("huts", "made", "mud", "straw");
var correct = new Array (false, false, false, false);
var busy = new Array (-1, -1, -1, -1);
my_font var = new TextFormat ();
my_font.font = "Arial";
my_font.color = 0;
my_font. size = 30;
words [i]. embedFonts = true;
my_font.bold = true;
var i = 0;
while (i <4)
(
this ["box" + i]. gotoAndStop (1);
this. createEmptyMovieClip (myClip "+ i, this.getNextHighestDepth ());
length = words [i]. length * 22;
this ["myClip" + i]. createTextField ("label", 1, 0, 0, length, 40);
this ["myClip" + i]. label.text = words [i];
this ["myClip" + i]. label. setTextFormat (my_font)
this ["myClip" + i]. onPress = function ()
(
temp = this. _name;
temp = Number (temp charAt (6));
if (Occupied [0] == temp)
(
off = true;
estaba_en = 0;
) / / End if
if (Occupied [1] == temp)
(
off = true;
estaba_en = 1;
) / / End if
if (Occupied [2] == temp)
(
off = true;
estaba_en = 2;
) / / End if
if (Occupied [3] == temp)
(
off = true;
estaba_en = 3;
) / / End if
if (! off)
(
estaba_en = -1;
) / / End if
origenx = this._x;
origeny = this. _y;
trace ("was" + estaba_en)
this.startDrag ();
);
this ["myClip" + i]. onRelease = this ["myClip" + i]. onReleaseOutside = function ()
(
this.stopDrag ();
which = this._name;
which = Number (cual. charAt (6));
drop = eval (this._droptarget)
trace (drop);
WHERE = String (drop);
frame = donde.substr (8, 6);
WHERE = Number (donde. charAt (14));
trace (Which + "in" + WHERE + "" + table);
if (table == "table")
(
if (Occupied [WHERE]> = 0 & & Occupied [WHERE] <= 3 | | WHERE == estaba_en)
(
off = false;
this._x = origenx;
this._y = origeny;
)
else
(
if (! off)
(
+ + _root.palabras_colocadas;
) / / End if
section = eval ("tranche" + (where + 1) + "_mc");
tramo.gotoAndPlay (2);
if (_root. palabras_colocadas> = 4)
(
startbtn.start ();
start_mc. gotoAndPlay (2);
)
else
(
palabra_ok.start ();
) / / End else if
length = words [Which]. length * 8.500000E +000;
drop.gotoAndStop (2);
this._y = drop._y - 22;
this._x = drop. _x - long;
Occupied [WHERE] = is;
if (off)
(
off = eval ("Table" + estaba_en)
apaga.gotoAndStop (1);
= Eval section ("section" + (estaba_en +1) + "_mc");
tranche. gotoAndPlay (6);
Occupied [estaba_en] = -1;
correct [estaba_en] = false;
off = false;
trace ("is" + _root.palabras_colocadas + "words");
if (_root.palabras_colocadas == 3)
(
trace ("Without noise off");
start_mc. gotoAndStop (1);
) / / End if
) / / End if
trace (Occupied [0] + "" + Occupied [1] + "" + Occupied [2] + "" + Occupied [3]);
if (Which == where)
(
+ + Palabras_correctas;
correct [WHERE] = true;
) / / End if
) / / End if
) / / End else if
if (table == "myClip" | | Table == "start_)
(
palabra_error.start ();
this._x = origenx;
this. _y = origeny;
) / / End if
if (table == "bottom")
(
if (off)
(
off = eval ("Table" + estaba_en)
off. gotoAndStop (1);
= Eval section ("section" + (estaba_en +1) + "_mc");
tramo.gotoAndPlay (6);
Occupied [estaba_en] = -1;
correct [estaba_en] = false;
- _root. Palabras_colocadas;
off = false;
trace ("is" + _root.palabras_colocadas + "words");
if (_root. palabras_colocadas == 3)
(
startbtn.start ();
start_mc.gotoAndStop (1);
) / / End if
) / / End if
) / / End if
);
+ + I;
) / / End while
var ii = 0;
while (ii <4)
(
var numeroNuevo = random (1, 4);
trace (numeroNuevo)
this ["myClip" + numeroNuevo]. _x = listado_x;
this [myClip "+ numeroNuevo]. listado_y + y = 40 * i;
+ + Ii;
) / / End while
- function random (min, max)
- (
- var _loc2 = true;
- if (usados. length <= max - min)
- (
- while (_loc2! = false)
- (
- var _loc1 = Math.floor (Math.random () * (max - min + 1));
- _loc2 = repeat (_loc1)
- ) / / End while
- used. push (_loc1)
- return (_loc1)
- )
- else
- (
- return (0);
- ) / / End else if
- ) / / End of the function
- function repeat (num)
- (
- _loc1 var = false;
- for (i = 0; i <used. length; i + +)
- (
- if (num == Used [i])
- (
- _loc1 = true;
- ) / / End if
- ) / / End of for
- return (_loc1)
- ) / / End of the function
- stop ();
- var used = new Array ();
- _root. palabras_colocadas = 0;
- palabras_correctas = 0;
- listado_x = 700;
- listado_y = 400;
- origenx = 0;
- origeny = 0;
- estaba_en = -1;
- off = false;
- _root. sentence = 2;
- var words = new Array ("huts", "made", "mud", "straw");
- var correct = new Array (false, false, false, false);
- var busy = new Array (-1, -1, -1, -1);
- my_font var = new TextFormat ();
- my_font.font = "Arial";
- my_font.color = 0;
- my_font. size = 30;
- words [i]. embedFonts = true;
- my_font.bold = true;
- var i = 0;
- while (i <4)
- (
- this ["box" + i]. gotoAndStop (1);
- this. createEmptyMovieClip (myClip "+ i, this.getNextHighestDepth ());
- length = words [i]. length * 22;
- this ["myClip" + i]. createTextField ("label", 1, 0, 0, length, 40);
- this ["myClip" + i]. label.text = words [i];
- this ["myClip" + i]. label. setTextFormat (my_font)
- this ["myClip" + i]. onPress = function ()
- (
- temp = this. _name;
- temp = Number (temp charAt (6));
- if (Occupied [0] == temp)
- (
- off = true;
- estaba_en = 0;
- ) / / End if
- if (Occupied [1] == temp)
- (
- off = true;
- estaba_en = 1;
- ) / / End if
- if (Occupied [2] == temp)
- (
- off = true;
- estaba_en = 2;
- ) / / End if
- if (Occupied [3] == temp)
- (
- off = true;
- estaba_en = 3;
- ) / / End if
- if (! off)
- (
- estaba_en = -1;
- ) / / End if
- origenx = this._x;
- origeny = this. _y;
- trace ("was" + estaba_en)
- this.startDrag ();
- );
- this ["myClip" + i]. onRelease = this ["myClip" + i]. onReleaseOutside = function ()
- (
- this.stopDrag ();
- which = this._name;
- which = Number (cual. charAt (6));
- drop = eval (this._droptarget)
- trace (drop);
- WHERE = String (drop);
- frame = donde.substr (8, 6);
- WHERE = Number (donde. charAt (14));
- trace (Which + "in" + WHERE + "" + table);
- if (table == "table")
- (
- if (Occupied [WHERE]> = 0 & & Occupied [WHERE] <= 3 | | WHERE == estaba_en)
- (
- off = false;
- this._x = origenx;
- this._y = origeny;
- )
- else
- (
- if (! off)
- (
- + + _root.palabras_colocadas;
- ) / / End if
- section = eval ("tranche" + (where + 1) + "_mc");
- tramo.gotoAndPlay (2);
- if (_root. palabras_colocadas> = 4)
- (
- startbtn.start ();
- start_mc. gotoAndPlay (2);
- )
- else
- (
- palabra_ok.start ();
- ) / / End else if
- length = words [Which]. length * 8.500000E +000;
- drop.gotoAndStop (2);
- this._y = drop._y - 22;
- this._x = drop. _x - long;
- Occupied [WHERE] = is;
- if (off)
- (
- off = eval ("Table" + estaba_en)
- apaga.gotoAndStop (1);
- = Eval section ("section" + (estaba_en +1) + "_mc");
- tranche. gotoAndPlay (6);
- Occupied [estaba_en] = -1;
- correct [estaba_en] = false;
- off = false;
- trace ("is" + _root.palabras_colocadas + "words");
- if (_root.palabras_colocadas == 3)
- (
- trace ("Without noise off");
- start_mc. gotoAndStop (1);
- ) / / End if
- ) / / End if
- trace (Occupied [0] + "" + Occupied [1] + "" + Occupied [2] + "" + Occupied [3]);
- if (Which == where)
- (
- + + Palabras_correctas;
- correct [WHERE] = true;
- ) / / End if
- ) / / End if
- ) / / End else if
- if (table == "myClip" | | Table == "start_)
- (
- palabra_error.start ();
- this._x = origenx;
- this. _y = origeny;
- ) / / End if
- if (table == "bottom")
- (
- if (off)
- (
- off = eval ("Table" + estaba_en)
- off. gotoAndStop (1);
- = Eval section ("section" + (estaba_en +1) + "_mc");
- tramo.gotoAndPlay (6);
- Occupied [estaba_en] = -1;
- correct [estaba_en] = false;
- - _root. Palabras_colocadas;
- off = false;
- trace ("is" + _root.palabras_colocadas + "words");
- if (_root. palabras_colocadas == 3)
- (
- startbtn.start ();
- start_mc.gotoAndStop (1);
- ) / / End if
- ) / / End if
- ) / / End if
- );
- + + I;
- ) / / End while
- var ii = 0;
- while (ii <4)
- (
- var numeroNuevo = random (1, 4);
- trace (numeroNuevo)
- this ["myClip" + numeroNuevo]. _x = listado_x;
- this [myClip "+ numeroNuevo]. listado_y + y = 40 * i;
- + + Ii;
- ) / / End while
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
April 10th, 2010, 9:56 pm
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 1 post
- Users browsing this forum: No registered users and 44 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
