Visualizzazione dei risultati da 1 a 9 su 9

Discussione: txt e css esterno

  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2002
    Messaggi
    410

    txt e css esterno

    Ho due problemini con txt esterno cariacato dentro un campo di testo creato dinamicamente e formattato con css esterno:

    il css viene caricato ed infatti mi imposta colore, carattere, dimensione del testo ma... non mi accetta il line-height: 1px; per settare l'interlinea, nel dubbio che fosse supportato ho provato a settare il mio campo di testo con: _root.percorso.leading = 5; ... ma nada! Forse non è questo il modo di usarlo?

    ...altro problema che non capisco... il testo è html = true; ed infatti i link che ho nel mio txt funzionano alla perfezione ma non riesco ad andare a capo tra un link e l'altro... ho provato con
    e con
    ma nulla i link mi vengono tutti in linea


  2. #2
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182

    Re: txt e css esterno

    Originariamente inviato da frifrini
    ...altro problema che non capisco... il testo è html = true; ed infatti i link che ho nel mio txt funzionano alla perfezione ma non riesco ad andare a capo tra un link e l'altro... ho provato con
    e con
    ma nulla i link mi vengono tutti in linea

    rispondo per la seconda cosa...

    il campo di testo deve avere impostato multiline a true, è già così?

  3. #3
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    per la prima invece...

    come scritto qui solo una parte delle proprietà CSS è riconosciuta in flash, e tra queste a quanto vedo non c'è il line-height

    mentre la proprietà "leading" può essere usata solo su un oggetto TextFormat (link) da applicare poi al TextField, non sò se gli stili applicati con la classe StyleSheet entrano in conflitto con quelli applicati con la classe TextFormat... dovresti provare... io non posso

  4. #4
    Utente di HTML.it
    Registrato dal
    Nov 2002
    Messaggi
    410
    Grazie mille! Uno di questi giorni ti farò un monumento!
    Per la prima, una svista mia, avevo messo solo il wordWrap = true;
    ...per la seconda ho provo!


  5. #5
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    Originariamente inviato da frifrini
    Grazie mille! Uno di questi giorni ti farò un monumento!
    sìììì come per la Arcuri :maLOL: (la Arcuri... )

  6. #6
    Utente di HTML.it
    Registrato dal
    Nov 2002
    Messaggi
    410
    Non sapevo del monumento ella Arcuri!!! ...ma me lo sono andato a cercare, ache è venuta in mente una cosa del genere??? ...però sempre Bbona!

    Comunque ho provato, ma nada, forse ho sbagliato come al solito, ad ogni modo non credo che accetti entrambe le cose.
    grazie come sempre!


  7. #7

    Problema css txt

    Ciao io creo un menù dinamicamente che importa le voci dal file xml, e qui va tutto bene.
    Il menu a il link a dei file di testo che ho formattato con dei css, che vengono aperi dentra una textbox. Il problema è che carica il testo contenuto nel file txt, ma non mi visualizza la formattazione fatta con il file css? Sapete dirmi come mai? Grazie

  8. #8
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    puoi postare il codice che utilizzi? potrebbe essere un problema di "ricezione" del CSS

  9. #9

    ecco il codice

    Ciao in allegato trovi il file txt e questo è il codice as:
    // generates a list of menu items (effectively one menu)
    // given the inputted parameters. This makes the main menu
    // as well as any of the submenus
    GenerateMenu = function(container, name, x, y, depth, node_xml) {
    // variable declarations
    var curr_node;
    var curr_item;
    var curr_menu = container.createEmptyMovieClip(name, depth);

    // for all items or XML nodes (items and menus)
    // within this node_xml passed for this menu
    for (var i=0; i<node_xml.childNodes.length; i++) {
    // movieclip for each menu item
    curr_item = curr_menu.attachMovie("menuitem","item"+i+"_mc", i);
    curr_item._x = x;
    curr_item._y = y + i*curr_item._height;
    curr_item.trackAsMenu = true;

    // item properties assigned from XML
    curr_node = node_xml.childNodes[i];
    curr_item.action = curr_node.attributes.action;
    curr_item.variables = curr_node.attributes.variables;
    curr_item.name.text = curr_node.attributes.name;

    // item submenu behavior for rollover event
    if (node_xml.childNodes[i].nodeName == "menu"){
    // open a submenu
    curr_item.node_xml = curr_node;
    curr_item.onRollOver = curr_item.onDragOver = function(){
    var x = this._x + this._width - 5;
    var y = this._y + 5;
    GenerateMenu(curr_menu, "submenu_mc", x, y, 1000, this.node_xml);
    // show a hover color
    var col = new Color(this.background);
    col.setRGB(0xf4faff);
    };
    }else{ // nodeName == "item"
    curr_item.arrow._visible = false;
    // close existing submenu
    curr_item.onRollOver = curr_item.onDragOver = function(){
    curr_menu.submenu_mc.removeMovieClip();
    // show a hover color
    var col = new Color(this.background);
    col.setRGB(0xf4faff);
    };
    }

    curr_item.onRollOut = curr_item.onDragOut = function(){
    // restore color
    var col = new Color(this.background);
    col.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,b b:0});
    };

    // any item, menu opening or not can have actions
    curr_item.onRelease = function(){
    Actions[this.action](this.variables);
    CloseSubmenus();
    };
    } // end for loop
    };

    // create the main menu, this will be constantly visible
    CreateMainMenu = function(x, y, depth, menu_xml){
    // generate a menu list
    GenerateMenu(this, "mainmenu_mc", x, y, depth, menu_xml.firstChild);
    // close only submenus if visible durring a mouseup
    // this main menu (mainmenu_mc) will remain
    mainmenu_mc.onMouseUp = function(){
    if (mainmenu_mc.submenu_mc && !mainmenu_mc.hitTest(_root._xmouse, _root._ymouse, true)){
    CloseSubmenus();
    }
    };
    };

    // closes all submenus by removing the submenu_mc
    // in the main menu (if it exists)
    CloseSubmenus = function(){
    mainmenu_mc.submenu_mc.removeMovieClip();
    };

    // This actions object handles methods for actions
    // defined by the XML called when a menu item is pressed
    Actions = Object();
    Actions = Object();
    Actions.gotoURL = function(urlVar){
    getURL(urlVar, "_blank");
    };
    Actions.message = function(msg){

    //Carico il CSS
    var lolCSS = new TextField.StyleSheet();
    //load style
    var cssjoURL = "example.css";
    //Load CSS file
    var textcontent = new LoadVars();
    var textpath = msg;
    textcontent.load(textpath);
    textcontent.onLoad = function(success) {
    if (success) {
    viewhtml.htmlText = this.content;
    } else {
    viewhtml.text = "Error loading external text file!";
    }
    };
    message_txt.text = msg;
    };

    lolCSS.onLoad = function (success) {
    if (success)
    {
    viewhtml.html = true;
    viewhtml.styleSheet =lolCSS;

    // Load the XML
    // xmlAddr.load("addressText.xml");
    }

    }


    lolCSS.load(cssjoURL);





    /*//aggiunto b7
    Actions.mediaType = function(msg7){
    message_txt.html=true;
    message_txt.html=msg7;
    };*/

    Actions.newMenu = function(menuxml){
    menu_xml.load(menuxml);
    };






    // load XML, when done, run CreateMainMenu to interpret it
    menu_xml = new XML();
    menu_xml.ignoreWhite = true;
    menu_xml.onLoad = function(ok){
    // create main menu after successful loading of XML
    if (ok){
    CreateMainMenu(10, 10, 0, this);
    message_txt.text = "WW";
    }else{
    message_txt.text = "error: XML not successfully loaded";
    }
    };
    // load first XML menu
    menu_xml.load("menu3.xml");

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.