Copy link to clipboard
Copied
Hi there,
I need help pls. I can't find my error. Could you pls help me.
Tks.
package {
import flash.display.*;
import flash.text.*;
import flash.events.MouseEvent;
public class DivetMod extends MovieClip {
private monMessage:TextField=new TextField;
private maMiseEnForme:TextFormat=new TextFormat;
public function DivetMod(){
btnGo.addEventListener(MouseEvent.CLICK, Go);
}
private function Go(event:MouseEvent):void {
var entier1:int;
var entier2:int;
var rep1:int;
var rep2:int;
var rep3:int;
var rep4:int;
entier1=int(txtbox1.text);
entier2=int(txtbox2.text);
rep1 = entier1/entier2;
rep2 = entier1%entier2;
rep3 = entier2/entier1;
rep4 = entier2%entier1;
trace(entier1)
trace(txtbox1.text)
trace(rep1)
trace(rep2)
trace(rep3)
trace(rep4)
ans1.text = rep1
ans2.text = rep2
ans3.text = rep3
ans4.text = rep4
}
}
}
click file>publish settings>swf and tick 'permit debugging'.
retest.
the problematic line number will be in the error message allowing you to pinpoint your error.
p.s. with the 'new constructor', use parantheses.
Copy link to clipboard
Copied
click file>publish settings>swf and tick 'permit debugging'.
retest.
the problematic line number will be in the error message allowing you to pinpoint your error.
p.s. with the 'new constructor', use parantheses.
Copy link to clipboard
Copied
Hey Kglad,
I don't know why i can't access to the forum.
​I need some help for the Function Trace(). I want to know how to use it properly.
​Tks.
​
Copy link to clipboard
Copied
1. it's lower case, trace(), not Trace().
2. it will work when testing actionscript in the ide as long as 'omit trace statements' is not ticked in the publish settings.
Copy link to clipboard
Copied
Hi kglad,
Could you pls tell me what i did wrong, i can play the first time, but when i want to play again, nothing happens. My button doesn't play twice.
Tks for your help.
package {
import flash.display.*;
import flash.events.*;
public class JeuJumelage extends MovieClip {
//Declarer des constantes pour regler les dimensions
// de la planche de jeu.
private static const RANGS:int = 4;
private static const COLONNES:int = 5;
private static const RANG_HAUTEUR:Number = 85;
private static const COLONNE_LARGEUR:Number = 85;
private static const RANG_DECALAGE:Number = 60;
private static const COLONNE_DECALAGE:Number = 10;
private var carteUn:cartes;
private var carteDeux:cartes;
private var cartesRestantes:int = RANGS*COLONNES;
public function JeuJumelage():void
{
var totalcartes:int = RANGS*COLONNES/2;
var paquetcartes:Array = new Array();
for (var i:int=0; i<totalcartes; i++)
{
paquetcartes.push(i);
paquetcartes.push(i);
}
//Creer et afficher une planche de jeu
//de 4 rangees par 4 colonnes
for(var c:int=0; c< COLONNES; c++)
{
for(var r:int=0; r< RANGS; r++)
{
var affichagecartes:cartes = new cartes();
affichagecartes.stop();
affichagecartes.x = c*COLONNE_LARGEUR+COLONNE_DECALAGE;
affichagecartes.y = r*RANG_HAUTEUR+RANG_DECALAGE;
var noRang = Math.floor(Math.random()*paquetcartes.length);
affichagecartes.rectocartes = paquetcartes[noRang];
paquetcartes.splice(noRang,1);
affichagecartes.addEventListener(MouseEvent.CLICK, clicSouris);
addChild(affichagecartes);
} // Fin boucle for interieure.
}//Fin boucle for exterieure
}//Fin function
public function clicSouris(event:MouseEvent)
{
var cartechoisie:cartes = (event.currentTarget as cartes);
//condition un (premiere carte selectionner).
if (carteUn == null)
{ //se servir de carteUn pour se rappeler la premiere carte choisie.
carteUn = cartechoisie;
//Afficher la premiere carte
carteUn.gotoAndStop(cartechoisie.rectocartes+2)
} //verifier si la premiere carte a ete cliquee a nouveau.
else if (carteUn == cartechoisie)
{ //afficher le verso de la premiere carte et reinitialiser la variable carteUn.
carteUn.gotoAndStop(1);
carteUn = null;
}
//condition deux(Deuxieme carte selectionnees)
else if (carteDeux == null)
{
//se servir de carteDeux pour se rappeler de la deuxieme carte choisie.
carteDeux = cartechoisie;
//afficher la deuxieme carte.
carteDeux.gotoAndStop(cartechoisie.rectocartes+2);
if (carteUn.rectocartes == carteDeux.rectocartes)
{
//jumelage - supprimer ces deux cartes identiques
removeChild(carteUn);
removeChild(carteDeux);
//reinitialiser les variables pour se rappeler les cartes choisies.
carteUn = null;
carteDeux = null;
//Decrimenter le compteur du nombre de cartes supprimees
cartesRestantes = cartesRestantes - 2;
//Verifier si la partie est terminee
if (cartesRestantes == 0)
{
//Partie terminee)
MovieClip(root).gotoAndStop("finPartie");
}// Fin if
}
}
else
{
//reinitialiser les cartes de la paire precedente
carteUn.gotoAndStop(1);
carteDeux.gotoAndStop(1);
carteDeux = null;
//selectioner et afficher la premiere carte de la nouvelle paire
carteUn = cartechoisie;
carteUn.gotoAndStop(cartechoisie.rectocartes+2);
}
}//Fin fonction clicSouris.
}//Fin class.
}//Fin package
Copy link to clipboard
Copied
please don't post duplicates.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now