Probleme d'affichage de certains cararcteres speciaux

simojava Messages postés 5 Date d'inscription jeudi 4 mai 2006 Statut Membre Dernière intervention 9 août 2006 - 5 août 2006 à 01:39
simojava Messages postés 5 Date d'inscription jeudi 4 mai 2006 Statut Membre Dernière intervention 9 août 2006 - 9 août 2006 à 19:09
http://www.vbfrance.com/auteurdetail.aspx?ID=765601
bonjour tout le monde,

J'ai codé une classe en AS qui charge tous les caracteres speciaux et les affiche dans un MovieClip.
Le probleme est que certains caracteres ne s'affichent pas mais plutot un carre s'affiche a la place.
C peut etre un prob d'encodage, mais je ne sais pas commenet m'y prendre.
j'ai essaye avec la methode embedFonts mais tjrs rien
Kelkun aurait une idee?

Voici ma classe, pour la tester creez un MovieClip vide et appeler la methode drawTable(x:Number, y:Number).

Si vous avez une solution veuillez svp me la communiquer.
Merci d'avance

class SpecialChar extends MovieClip {

    private static var box_size = 25;
    private var symbol:Array;
    private var table:MovieClip;
    private var xt, yt:Number;
    private var xpos, ypos:Number = 0;
    public var ourformat:TextFormat;

    /*
    /Constructor
    */
    public function SpecialChar() {
    }

    /*
    / Drawing small boxes wich will contain the characters
    */

    private function box(clip:MovieClip, x:Number, y:Number, s:String):Void {
        clip.lineStyle(1, 0x8000ff, 100);
        clip.moveTo(x, y);
        clip.lineTo(x+SpecialChar.box_size, y);
        clip.lineTo(x+SpecialChar.box_size, y+box_size);
        clip.lineTo(x, y+SpecialChar.box_size);
        clip.lineTo(x, y);
        var tf:TextField = clip.createTextField("txtfld", clip.getNextHighestDepth(), x, y, 25, 25);
        tf.text = s;
        //tf.embedFonts = true;
        ourformat=tf.getTextFormat();
        ourformat.font = "Times New Roman";
        ourformat.size = 12;
        ourformat.bold = true;
        ourformat.align = "center";
        ourformat.color = 0x000000;
        tf.setTextFormat(ourformat);
    }
    /*
    / Get the symbol corresponding to the given codes
    */
    private function getSymbol():Void {
        this.symbol = new Array();
        for (var i = 0; i<255; i++) {
            this.symbol.push(String.fromCharCode(i));
        }
    }
    private function drawTable(x:Number, y:Number):Void {
        this.getSymbol();
        this.table = this.createEmptyMovieClip("tableChar", 10);
        this.table._x = x;
        this.table._y = y;
        var xpos:Number = 0;
        var ypos:Number = 0;
        var ctr:Number = 0;
        while (ctr<this.symbol.length) {
            this.box(this.table, xpos, ypos, this.symbol[ctr]);
            if ((xpos%(16*SpecialChar.box_size)) == 0 && (xpos != 0)) {
                ypos += 25;
                xpos = 0;
            } else {
                xpos += SpecialChar.box_size;
            }
            ctr++;
        }
    }
   
}

1 réponse

simojava Messages postés 5 Date d'inscription jeudi 4 mai 2006 Statut Membre Dernière intervention 9 août 2006
9 août 2006 à 19:09
Bonjour,
C'est encore moi.
Y a -t-il kelkun ki aurait une idee comment faire? je suis tjrs bloqué la dessus et je n'ai aucune piste pour l'instant.
Merci
0
Rejoignez-nous