Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

My program shakes

New Here ,
Apr 11, 2014 Apr 11, 2014

hi there,

someone to help me. What did i do wrong ? My program shakes when i want to test it. I even couldn't touch the screen. Tks.

package {

          import flash.display.*;

          import flash.events.*;

          import flash.text.*;

 

          public class U2A3_JeuJumelage extends MovieClip {

 

 

                    private static const RANGS:int = 5;

                    private static const COLONNES:int = 6;

                    private static const RANG_HAUTEUR:Number = 130;

                    private static const COLONNE_LARGEUR:Number = 130;

                    private static const RANG_DECALAGE:Number = 60;

                    private static const COLONNE_DECALAGE:Number = -110;

 

                    private var carteUn:Cartes;

                    private var carteDeux:Cartes;

                    private var cartesRestantes:int = RANGS*COLONNES;

 

                    public function U2A3_JeuJumelage():void

                    {

                              var totalCartes:int = RANGS*COLONNES/2;

                              var paquetCartes:Array = new Array;

 

                              var intPointage:int;

 

                              for (var i: int=0; i < totalCartes; i++)

                              {

                                        paquetCartes.push(i);

                                        paquetCartes.push(i);

                              }

 

 

                              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.rectoCarte = paquetCartes[noRang];

                                                  paquetCartes.splice(noRang, 1);

                                                  affichageCartes.addEventListener(MouseEvent.CLICK, clicSouris);

                                                  addChild(affichageCartes);

                                        }

                              }

                    }

 

                    public function clicSouris(event:MouseEvent)

                    {

                              var carteChoisie:Cartes = (event.currentTarget as Cartes);

 

                              if (carteUn == null)

                                        {

                                        carteUn = carteChoisie;

                                        carteUn.gotoAndStop(carteChoisie.rectoCarte + 2);

                                        }

 

                                        else if (carteUn == carteChoisie)

                                        {

                                                  carteUn.gotoAndStop(1);

                                                  carteUn = null;

                                        }

 

                                        else if (carteDeux == null)

                                        {

                                                  carteDeux = carteChoisie;

                                                  carteDeux.gotoAndStop(carteChoisie.rectoCarte + 2);

                                        }

 

                                        if (carteUn.rectoCarte == carteDeux.rectoCarte)

                                        {

                                                  removeChild(carteUn);

                                                  removeChild(carteDeux);

 

                                                  carteUn = null;

                                                  carteDeux = null;

 

                                                  cartesRestantes = cartesRestantes - 2;

 

                                                  if (cartesRestantes == 0)

                                                  {

                                                            MovieClip(root).gotoAndStop("finPartie");

                                                  }

                                        }

 

                                        else

                                        {

                                                  carteUn.gotoAndStop(1);

                                                  carteDeux.gotoAndStop(1);

                                                  carteDeux = null;

 

                                                  carteUn = carteChoisie;

                                                  carteUn.gotoAndStop(carteChoisie.rectoCarte + 2);

                                        }

                    }

          }

}

TOPICS
ActionScript
419
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 11, 2014 Apr 11, 2014

What do you mean when you say your program shakes?  Do you get any compiler error messages?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 14, 2014 Apr 14, 2014

No, i can't even touch the screen, because it shakes.

Tks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 14, 2014 Apr 14, 2014

You aren't doing a very good job of explaining what you mean.  Based on your last response I'd tell you to run for cover as there appears to be an earthquake, a rather persistent one.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 14, 2014 Apr 14, 2014

Exactly, it's like an earthquake. so i can't touch any button to run the program.

tks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 16, 2014 Apr 16, 2014
LATEST

Taking a WAG, I would suspect what he's seeing is the way it flips through the timeline when you have a compile error.

ORDIYOH, do you have Strict mode on in the AS 3 settings, and if so are you seeing any compile errors?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines