Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 20
  1. #1

    formattazione create text field !!!( flash 8 )

    Salve a tutti, questo problema mi sta tormentando!!qualcuno mi aiuti!
    Devo formattare(..font, size, ecc ecc) un campo di testo, ma non ci riesco, ne ho provate tante!
    Ho questo codice:

    n_bot = 14;

    function abilita(BTT) {
    for (i=1; i<=n_bot; i++) {
    _root<"bt"+i>.enabled = 1;
    _root<"bt"+i>._alpha = 50;
    BTT.enabled = 0;
    BTT._alpha = 0;
    }
    }
    //*********************
    for (i=1; i<=n_bot; i++) {
    _root.createEmptyMovieClip("bt"+i,i)


    with(_root<"bt"+i>){
    createTextField("testo"+i,i,this._x,this._y,20,20)
    _x=537+i*20
    _y=550
    eval("testo"+i).textColor=0x666666
    eval("testo"+i).textColor=0x666666
    eval("testo"+i).text=i}
    }


    Non vi sto a dire neanche le prove che ho fatto, perchè non mi ricordo più nulla!
    Conto su di voi..
    Grazie mille anticipatamente..
    Filippo

  2. #2
    devi utilizzare l'oggetto textformat

    qualcosa tipo

    myTextFormat = new TextFormat();
    myTextFormat.bold = true;
    myTextFormat.font = "verdana"
    mytextFormat.size= 15

    testo.setTextFormat(myTextFormat);

    dove testo è la tua casella di testo

  3. #3
    Grazie intanto della risposta!
    Avevo già provato con textformat, in quel modo, mettendo:


    myTextFormat = new TextFormat();
    myTextFormat.bold = true;
    myTextFormat.font = "verdana"
    mytextFormat.size= 15


    testo .setTextFormat(myTextFormat);


    ..ma niente, forse sbaglio a posizionarli, essendo il campo di testo all'interno di un ciclo.
    Il fatto è anche questo: io non dovrei in teoria settare con text format il solo testo , ma "testo"+i (che è nel codice che ho postato prima nelle proprietà di createtextfield!)..è forse questo che non mi fa prendere la formattazione?

    Grazie ancora per l'interessameto!
    Spero di trovare una via d'uscita davvero!!

  4. #4
    codice:
    myTextFormat = new TextFormat();
    myTextFormat.bold = true;
    myTextFormat.font = "verdana"
    mytextFormat.size= 15
    
    for (i=1; i<=n_bot; i++) {
       _root.createEmptyMovieClip("bt"+i,i)
       with(_root["bt"+i]){
         createTextField("testo"+i,i,this._x,this._y,20,20)
         _x=537+i*20
         _y=550
         eval("testo"+i).textColor=0x666666
         eval("testo"+i)
         eval("testo"+i).text=i
         eval("testo"+i).setTextFormat(myTextFormat)
       }
    }

  5. #5
    Non so che dire.. in questo momento sono commosso..
    sono 3 giorni pieni che le provo tutte..e su tutti i forum..

    grazie a mille..davvero..


    Ps. non vorrei approfittarmi,sono sincero, ma vedo che ho trovato uno che ne sa parecchio..e non posso non chiederti questo(abbi pazienza!!):
    Il testo che andava formattato sono dei numeri(bottoni), a cui sono associate delle foto, c'è la possibilità..(anche per uno come me)..di far cambiare colore al numero/bottone che clicco?
    Cioè, quando seleziono un bottone mi rimane del colore "rosso" che sta ad indicare che è già stato premuto.

    Comunque..grazie ancora..davvero..

  6. #6
    Ti posto l'intero codice, forse ti è d'aiuto..se vuoi:

    stop();
    resize()
    vuota._alpha = red._alpha=boxx._width=boxx._height=0;
    vuota.loadMovie("foto/1.jpg");

    //*****************************
    function resize() {
    this.onEnterFrame = function() {
    car = vuota.getBytesLoaded();
    tot = vuota.getBytesTotal();
    if (car>5 && car == tot) {
    WW = vuota._width;
    HH = vuota._height;
    boxx._width += (WW-boxx._width)/3;
    boxx._height += (HH-boxx._height)/3;
    boxx._x += ((Stage.width/2)-boxx._x)/3;
    boxx._y += ((Stage.height/2)-boxx._y)/3;
    vuota._x = boxx._x-WW/2;
    vuota._y = boxx._y-HH/2;
    if (boxx._width>5 && boxx._width>=WW-1 && boxx._width<=WW+1) {
    (vuota._alpha<100) ? (vuota._alpha += 10) : (delete this.onEnterFrame);
    }
    }
    };
    }
    //**********************************
    myTextFormat = new TextFormat();
    myTextFormat.font = "arial"
    mytextFormat.size= 12


    n_bot = 14;


    function abilita(BTT) {
    for (i=1; i<=n_bot; i++) {
    _root["bt"+i].enabled = 1;
    _root["bt"+i]._alpha = 50;
    BTT.enabled = 0;
    BTT._alpha = 0;
    }
    }
    //*********************
    for (i=1; i<=n_bot; i++) {
    _root.createEmptyMovieClip("bt"+i,i)


    with(_root["bt"+i]){
    createTextField("testo"+i,i,this._x,this._y,20,20)
    _x=537+i*20
    _y=550
    eval("testo"+i).textColor=0x666666
    eval("testo"+i)
    eval("testo"+i).text=i
    eval("testo"+i).setTextFormat(myTextFormat)
    }

    bt1.enabled=false
    _root["bt"+i]._alpha = 50;
    _root["bt"+i].onRollOver = function() {
    this._alpha = 100;
    };
    _root["bt"+i].onRollOut = function() {
    this._alpha = 50;
    };
    _root["bt"+i].onPress = function() {
    red._alpha = 100;
    red._x = this._x;
    red._y = this._y;
    boxx._width = boxx._height=0;
    vuota._alpha = 0;
    unloadMovie(vuota);
    };
    _root["bt"+i].onRelease = _root["bt"+i].onReleaseOutside=function () {
    resize();
    abilita(this);
    N = this._name.substring(2);
    vuota.loadMovie("foto/"+N+".jpg");
    };
    }

  7. #7
    Ma deve cambiare colore solo il testo o tutto il bottone.
    Basta che usi di nuovi textformat comunque qualcosa tipo

    codice:
    _root["bt"+i].onPress = function() {
      
      myTextFormat = new TextFormat();
      myTextFormat.color = 0xCC0000 //rosso
      _root["bt"+i].testo.setTextFormat(myTextFormat)
      red._alpha = 100;
      red._x = this._x;
      red._y = this._y;
      boxx._width = boxx._height=0;
      vuota._alpha = 0;
      unloadMovie(vuota);
    };
    Comunque sostituisci il codice che creava il testo con questo, non serve mettere un numero diverso ad ogni casella.
    Se non lo fai non ti funziona il codice sopra, perchè il testo non si chiama testo, ma testo0,1,2,3 e non sai qual'è al momento che clicchi il bottone, dovresti assegnarlo come variabile a bt0/1/2/3.

    codice:
    for (i=1; i<=n_bot; i++) {
       _root.createEmptyMovieClip("bt"+i,i)
       with(_root["bt"+i]){
         createTextField("testo",i,this._x,this._y,20,20)
         _x=537+i*20
         _y=550
         eval("testo").textColor=0x666666
         eval("testo")
         eval("testo").text=i
         eval("testo").setTextFormat(myTextFormat)
       }
    }

  8. #8
    l'ho fatto, ma non funziona, volevo mandarti il file .fla ma sembra non si possa.
    Non fa niente..fin troppo gentile, vedo se riesco con le tue indicazioni!
    In sostanza volevo che i numeri diventassero, per esempio "rossi" quando ci clicco, quindi si sta ad indicare che sono su quella foto e che ho cliccato su quel numero/bottone.

    Grazie ancora.

  9. #9
    il codice quello fa, devi vedere bene i nomi delle caselle di testo, ed eventuali imprecisioni, ma la tecnica è quella

  10. #10
    Macchè niente Stan.. ci sto perdendo la vista.. intendevi cosi tu?
    perchè cosi nn mi funziona..

    stop();
    resize()
    vuota._alpha = red._alpha=boxx._width=boxx._height=0;
    vuota.loadMovie("foto/1.jpg");

    //*****************************
    function resize() {
    this.onEnterFrame = function() {
    car = vuota.getBytesLoaded();
    tot = vuota.getBytesTotal();
    if (car>5 && car == tot) {
    WW = vuota._width;
    HH = vuota._height;
    boxx._width += (WW-boxx._width)/3;
    boxx._height += (HH-boxx._height)/3;
    boxx._x += ((Stage.width/2)-boxx._x)/3;
    boxx._y += ((Stage.height/2)-boxx._y)/3;
    vuota._x = boxx._x-WW/2;
    vuota._y = boxx._y-HH/2;
    if (boxx._width>5 && boxx._width>=WW-1 && boxx._width<=WW+1) {
    (vuota._alpha<100) ? (vuota._alpha += 10) : (delete this.onEnterFrame);
    }
    }
    };
    }
    //**********************************

    n_bot = 14;

    myTextFormat = new TextFormat();
    myTextFormat.font = "arial"
    mytextFormat.size= 12





    function abilita(BTT) {
    for (i=1; i<=n_bot; i++) {
    _root["bt"+i].enabled = 1;
    _root["bt"+i]._alpha = 50;
    BTT.enabled = 0;
    BTT._alpha = 0;
    }
    }
    //*********************
    for (i=1; i<=n_bot; i++) {
    _root.createEmptyMovieClip("bt"+i,i)
    with(_root["bt"+i]){
    createTextField("testo",i,this._x,this._y,20,20)
    _x=537+i*20
    _y=550
    eval("testo").textColor=0x333333
    eval("testo")
    eval("testo").text=i
    eval("testo").setTextFormat(myTextFormat)
    }




    bt1.enabled=false
    _root["bt"+i]._alpha = 50;
    _root["bt"+i].onRollOver = function() {
    this._alpha = 100;
    };
    _root["bt"+i].onRollOut = function() {
    this._alpha = 50;
    };
    _root["bt"+i].onPress = function() {

    myTextFormat = new TextFormat();
    myTextFormat.color = 0xFF0000 //rosso
    _root["bt"+i].testo.setTextFormat(myTextFormat)


    red._alpha = 100;
    red._x = this._x;
    red._y = this._y;
    boxx._width = boxx._height=0;
    vuota._alpha = 0;
    unloadMovie(vuota);

    };


    _root["bt"+i].onRelease = _root["bt"+i].onReleaseOutside=function () {

    resize();
    abilita(this);
    N = this._name.substring(2);
    vuota.loadMovie("foto/"+N+".jpg");
    };
    }

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.