Loading:


    TextField styleSheet [AS 2]

    Klasa: TextField

    Kompatybilność: ActionScript 1.0, Flash 6+

     

    Dołącza arkusz styli do pola tekstowego.

     

    Aby dowiedzieć się o tworzeniu arkuszów stylów, odwiedź wpis o klasie TextField.StyleSheet dostępnej [ tutaj ].

     

    Arkusz stylów załączony z polem tekstowym może być zmieniony w każdej chwili. Jeśli arkusz stylów w użyciu jest zmieniony, wtedy pole tekstowe jest przerysowywane używając do tego nowego arkusza stylów. Aby usunąć arkusz stylów należyć nadać wartość NULL lub UNDEFINED.

    Wskazówka: Jeśli arkusz stylów jest usunięty, wtedy zawartość obydwojga TextField.text oraz TextField.htmlText zmienia się. Aby zaprezentować oryginalną treść TextField.htmlText bez formatowania, zapisz wartość w zmmiennej przed usunięciem arkuszów styli.



    Napisz Artyku³

    Listing

    this.createTextField("news_txt", this.getNextHighestDepth(), 0, 0, 300, 200);
    news_txt.wordWrap = true;
    news_txt.multiline = true;
    news_txt.html = true;
    var newsText:String = "<p class='headline'>Description</p> Method; "
        + "starts loading the CSS file into styleSheet. The load operation is asynchronous; "
        + "use the <span class='bold'>TextField.StyleSheet.onLoad</span> "
        + "callback handler to determine when the file has finished loading. "
        + "<span class='important'>The CSS file must reside in exactly the same "
        + "domain as the SWF file that is loading it.</span> For more information about "
        + "restrictions on loading data across domains, see Flash Player security features.";

    news_txt.htmlText = newsText;

    css1_btn.onRelease = function() {
        var styleObj:TextField.StyleSheet = new TextField.StyleSheet();
        styleObj.onLoad = function(success:Boolean) {
        if (success) {
            news_txt.styleSheet = styleObj;
            news_txt.htmlText = newsText;
        }
        };
        styleObj.load("styles.css");
    };

    css2_btn.onRelease = function() {
        var styleObj:TextField.StyleSheet = new TextField.StyleSheet();
        styleObj.onLoad = function(success:Boolean) {
        if (success) {
            news_txt.styleSheet = styleObj;
            news_txt.htmlText = newsText;
        }
        };
        styleObj.load("styles2.css");
    };

    clearCss_btn.onRelease = function() {
        news_txt.styleSheet = undefined;
        news_txt.htmlText = newsText;
    };
    //plik "styles.css"

    .important {
        color: #FF0000;
    }
    .bold {
        font-weight: bold;
    }
    .headline {
        color: #000000;
        font-family: Arial,Helvetica,sans-serif;
        font-size: 18px;
        font-weight: bold;
        display: block;
    }

    Save this CSS file with the filename "styles2.css"

    .important {
        color: #FF00FF;
    }
    .bold {
        font-weight: bold;
    }
    .headline {
        color: #00FF00;
        font-family: Arial,Helvetica,sans-serif;
        font-size: 18px;
        font-weight: bold;
        display: block;
    }

     




    Dodano przez: divix
    Ranga: Administrator serwisu Punktów: 0
    Komentarze użytkowników
      • Tre¶æ komentarza
        Kod do komentarza (opcjonalnie)
        PHP JavaScript MySQL Smarty SQL HTML CSS ActionScript
        Autor
        Token
        token

         

         








    funkcje.net
    Wszelkie prawa zastrzeżone©. | Funkcje.net 2008-2025 v.1.5 | design: diviXdesign & rainbowcolors