IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ActionScript 3 Discussion :

Texte sur bouton


Sujet :

ActionScript 3

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Debutant AS3
    Inscrit en
    Juillet 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Debutant AS3

    Informations forums :
    Inscription : Juillet 2014
    Messages : 11
    Points : 6
    Points
    6
    Par défaut Texte sur bouton
    Bonjours j'ai un probleme avec 2 boutons composent que j'ai ajouter. J'aimerai leur ajouter du texte mais lorsque je le fait le texte est mal placé j'ai donc pensé a le centrer mais alors le bouton ne fait plus la taille ou l'emplacement exact ou je veux. J'utilise Flash CC et il ne détecte aucune erreur. Voici mon code :
    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
    var ForCommand:TextField = new TextField();
    var ForCode:TextField = new TextField();
    ForCommand.autoSize = TextFieldAutoSize.CENTER;
    ForCommand.border = true;
    ForCommand.background = true;
    ForCommand.backgroundColor = 0x00F93A;
    ForCommand.text = ForCommand.text = ForCommand.text = "EXECUTER";
    ForCode.autoSize = TextFieldAutoSize.CENTER;
    ForCode.border = true;
    ForCode.background = true;
    ForCode.backgroundColor = 0xF90800;
    ForCode.text = ForCode.text = ForCode.text = "EXECUTER";
    var Command:SimpleButton = new SimpleButton(ForCommand, ForCommand, ForCommand, ForCommand);
    Command.upState = ForCommand;
    Command.overState = ForCommand;
    Command.downState = ForCommand;
    Command.hitTestState = ForCommand;
    Command.alpha = 1;
    Command.width = 99;
    Command.height = 20;
    Command.y = zoneTexte.y + 20;
    Command.x = zoneTexte2.x;
    var Code:SimpleButton = new SimpleButton(ForCode, ForCode, ForCode, ForCode);
    Code.upState = ForCode;
    Code.overState = ForCode;
    Code.downState = ForCode;
    Code.hitTestState = ForCode;
    Code.alpha = 1;
    Code.width = 99;
    Code.height = 20;
    Code.y = zoneTexte.y + 20;
    Code.x = 850;

  2. #2
    Membre actif Avatar de gustave02
    Homme Profil pro
    aucune
    Inscrit en
    Février 2013
    Messages
    162
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : aucune

    Informations forums :
    Inscription : Février 2013
    Messages : 162
    Points : 225
    Points
    225
    Par défaut
    bonjour
    peux tu joindre ton fla ou un fla simplifié ?

    @+ gustave02.

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Debutant AS3
    Inscrit en
    Juillet 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Debutant AS3

    Informations forums :
    Inscription : Juillet 2014
    Messages : 11
    Points : 6
    Points
    6
    Par défaut
    Non je ne peut pas joindre mon FLA pour des raisons privée.
    Mais j'ai bien ajouté les bons imports je crois :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
        import flash.display.*;
        import flash.events.*;
        import flash.media.*;
        import flash.net.*;
        import flash.utils.*;
    	import flash.text.*;
        import flash.events.*;
    	import com.actionscriptfacile.ui.button.Button;

  4. #4
    Membre actif Avatar de gustave02
    Homme Profil pro
    aucune
    Inscrit en
    Février 2013
    Messages
    162
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : aucune

    Informations forums :
    Inscription : Février 2013
    Messages : 162
    Points : 225
    Points
    225
    Par défaut
    re
    donc si je comprend bien tu veux que ton texte ne fasse pas varier la position x et y de ton bouton ; repère sur le bouton haut gauche.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    var ForCommand:TextField = new TextField();
     
        ForCommand.autoSize = TextFieldAutoSize.LEFT;
        ForCommand.border = true;
        ForCommand.background = true;
        ForCommand.backgroundColor = 0x00F93A;
        ForCommand.text = "EXECUTER dde ff dddddddd";
     
    	var Command:SimpleButton = new SimpleButton(ForCommand, ForCommand, ForCommand, ForCommand);
     
        Command.alpha = 1;
        Command.height = 20;
        Command.x = 50;
        addChild (Command);
    voila ma solution si j'ai bien compris le problème.
    @+ gustave02

  5. #5
    Futur Membre du Club
    Homme Profil pro
    Debutant AS3
    Inscrit en
    Juillet 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Debutant AS3

    Informations forums :
    Inscription : Juillet 2014
    Messages : 11
    Points : 6
    Points
    6
    Par défaut
    Merci de ton aide tu as presque réussis a résoudre mon problème.
    Ce que je veut c'est que le text "EXECUTER" soit placer au milieu du bouton sans pour autant modifier ces position ou sa taille.
    Merci de ton aide.

    EDIT :
    je crois qu'il n'y a pas vraiment de code pour corriger mon problème donc je me suis servis des espaces :

    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
     
    			var ForCommand:TextField = new TextField();
    			var ForCode:TextField = new TextField();
    			ForCommand.width = 99;
    			ForCommand.height = 20;
    			ForCommand.border = true;
    			ForCommand.background = true;
    			ForCommand.backgroundColor = 0x00F93A;
    			ForCommand.text = "     EXECUTER";
    			ForCode.width = 99;
    			ForCode.height = 20;
    			ForCode.border = true;
    			ForCode.background = true;
    			ForCode.backgroundColor = 0xF90800;
    			ForCode.text = "     EXECUTER";
    			var Command:SimpleButton = new SimpleButton(ForCommand, ForCommand, ForCommand, ForCommand);
    			Command.alpha = 1;
    			Command.width = 99;
    			Command.height = 20;
    			Command.y = zoneTexte.y + 20;
    			Command.x = zoneTexte2.x;
    			var Code:SimpleButton = new SimpleButton(ForCode, ForCode, ForCode, ForCode);
    			Code.alpha = 1;
    			Code.width = 99;
    			Code.height = 20;
    			Code.y = zoneTexte.y + 20;
    			Code.x = 850;
    Encore merci de ton aide Gustave

  6. #6
    Membre actif Avatar de gustave02
    Homme Profil pro
    aucune
    Inscrit en
    Février 2013
    Messages
    162
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : aucune

    Informations forums :
    Inscription : Février 2013
    Messages : 162
    Points : 225
    Points
    225
    Par défaut re
    alors c'est simple avec format texte

    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
      var ForCommand:TextField = new TextField();
                              var format:TextFormat = new TextFormat();
                              format.align = TextFormatAlign.CENTER;
     
     
    			ForCommand.width = 99;
    			ForCommand.height = 20;
    			ForCommand.border = true;
    			ForCommand.background = true;
    			ForCommand.backgroundColor = 0x00F93A;
    			ForCommand.defaultTextFormat = format ;
    			ForCommand.text = "EXECUTER";
     
    			var Command:SimpleButton = new SimpleButton(ForCommand, ForCommand, ForCommand, ForCommand);
    			Command.alpha = 1;
    			Command.width = 99;
    			Command.height = 20;
     
                             addChild(Command);
    j'avais pas compris ton bléme

    pour connaitre toute les caractéristique textformat http://www.citroen-france-tours-nord...ipt3/index.htm.
    si ça répond pas totalement a ta question dis le.
    @+ gustave02 ;

  7. #7
    Futur Membre du Club
    Homme Profil pro
    Debutant AS3
    Inscrit en
    Juillet 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Debutant AS3

    Informations forums :
    Inscription : Juillet 2014
    Messages : 11
    Points : 6
    Points
    6
    Par défaut
    Merci j'ai déjà essayer le texte format et le bouton n'est plus a la bonne place.
    Merci encore de ton aide mais tu peux laissé tes recherches mes espaces suffiront

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [AC-2000] Texte sur bouton
    Par berthold67 dans le forum Access
    Réponses: 1
    Dernier message: 02/04/2015, 10h47
  2. texte sur bouton
    Par sunwind dans le forum IHM
    Réponses: 5
    Dernier message: 12/05/2008, 17h44
  3. Réponses: 4
    Dernier message: 07/11/2006, 23h00
  4. [SWT]image ET text sur un bouton SWT
    Par piwai dans le forum SWT/JFace
    Réponses: 14
    Dernier message: 04/10/2006, 15h41
  5. [FLASH 8] Pb sur bouton avec texte dynamique
    Par iceman2001 dans le forum Flash
    Réponses: 11
    Dernier message: 27/06/2006, 12h58

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo