A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Different fonts on the same line

  1. #1
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80

    Different fonts on the same line

    I'm importing some text from an xml file. Which looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <rss>
    <channel>
    <item id="1">
    <TitleCopy<![CDATA[<title>jane</title<keywords> - Hopeful | Chatterbox | Ardent</keywords>]]></TitleCopy>
    </item>
    </channel>
    </rss>

    I have a css style file. Which looks like this:

    title {
    color: #A6CE46;
    font-size: 24px;
    font-family: DivineFont;
    }
    keywords {
    color: #999999;
    font-size: 16px;
    font-family: NeoSanLightFont;
    }

    At the moment when the text is loaded into the dynamic text block it looks like this:

    jane
    - Hopeful | Chatterbox | Ardent

    What I want to happen is this:

    jane - Hopeful | Chatterbox | Ardent

    I'm not asking the "keywords" to drop to the next line. The dynamic text block is long enough to accompany all the text.

    Please help

    Thanks

  2. #2
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,317
    your title tag is missing >
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  3. #3
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80
    Yep I missed the > out, but that still doesn't solve it.

    Thanks anyhow webdreamer

  4. #4
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,317
    Can you show the code your using to pull the xml into flash?
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  5. #5
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80
    //frame 1
    var xml_load:XML = new XML();
    xml_load.ignoreWhite = true;
    xml_load.load("copy.xml");
    var xml_array:Array = [];
    loading_status = function () {
    load_txt.text = Math.floor((xml_load.getBytesLoaded()/xml_load.getBytesTotal())*100)+"%";
    };
    xml_load.onLoad = function(status_load:Boolean):Void {
    if (status_load) {
    displayText(txt);
    for (var i = 0; i<xml_load.firstChild.firstChild.childNodes.length ; i++) {
    if (xml_load.firstChild.firstChild.childNodes[i].nodeName.toString() == "item") {
    for (var j = 0; j<xml_load.firstChild.firstChild.childNodes[i].childNodes.length; j++) {

    switch (xml_load.firstChild.firstChild.childNodes[i].childNodes[j].nodeName.toString()) {
    case "TitleCopy" :
    TitleCopy = xml_load.firstChild.firstChild.childNodes[i].childNodes[j].firstChild.nodeValue.toString();
    break;
    }
    }
    xml_array.push({a:TitleCopy});

    }
    }
    delete xml_load;
    nextFrame();
    } else {
    load_txt.text = "Loading Error!";
    }
    };
    // Load the css file
    import TextField.StyleSheet;
    var cssUrl:String = "fonts.css";
    var css:StyleSheet;
    // Deal with a IE/Firefox inconsistency.
    function fixUrl(url:String):String {
    var rootUrl:String = _root._url;
    var iLastSlash:Number = rootUrl.lastIndexOf('/');
    if (iLastSlash>0) {
    rootUrl = rootUrl.substr(0, iLastSlash);
    }
    return rootUrl+"/"+url;
    }
    function loadCSS():Void {
    css = new StyleSheet();
    css.onLoad = function(bSuccess:Boolean):Void {
    if (bSuccess) {
    loading_status();
    }
    };
    css.load(fixUrl(cssUrl));
    }
    function displayText(htmlText:String):Void {
    var t:TextField = txt;
    t.html = true;
    t.styleSheet = css;
    t.embedFonts = true;
    t.autoSize = true;
    t.htmlText = htmlText;
    }
    loadCSS();
    stop();

    //frame 2
    end_txt = xml_array.length;
    xml_reader_page = function (id:Number):Void {
    TitleCopy = xml_array[Counter].a;
    txt.htmlText = TitleCopy;
    };
    Counter = 0;
    xml_reader_page();
    stop();

  6. #6
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,317
    It might just be easier to post the files.
    Are you able to do that?
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  7. #7
    Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    80
    Link to files:

    imagesinmotion.zip

    Thanks

    webdreamer

  8. #8
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,317
    Quote Originally Posted by imagesinmotion
    Link to files:

    imagesinmotion.zip

    Thanks

    webdreamer
    sorry i am at a loss as to why it coming out that way.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center