A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Scroll text/html text

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    24

    Scroll text/html text

    Awhile back, someone was nice enough to let me use his scrolling text box for my site.

    It works wonderfully, but I really need to distinguish certain text with either bold, italic, or color.

    Is it possible to add html text code to this scroll box. I'm not very good with actionscript so any help would be very much appreciated.:

    <b>function scroller(f, x, y, w, h, e, o, l, c, r) {
    var z = 0;
    p.removeMovieClip();
    function drawsquare(t, n, w, h, c, b) {
    t.createEmptyMovieClip(n, ++z);
    typeof (c) == "string" ? t[n].lineStyle(c, b) : t[n].lineStyle(1, b);
    typeof (c) == "string" ? t[n].beginFill(0xffffff, 0) : t[n].beginFill(c);
    t[n].lineTo(w, 0);
    t[n].lineTo(w, h);
    t[n].lineTo(0, h);
    t[n].endFill();
    return t[n];
    }
    function scrollcontent(xy) {
    ra = r;
    dy = 0-((xy/(y+h))*mc._height);
    updateAfterEvent();
    mc.onEnterFrame = function() {
    Math.round(dy) == Math.round(mc._y) ? delete mc.onEnterFrame : mc._y += (dy-mc._y)*ra, ra += r*r;
    };
    onMouseUp=function() {
    delete onMouseMove;
    }
    }
    p = this.createEmptyMovieClip("scrollinglayer", ++z);
    p._x=x, p._y=y;
    mc = p.createEmptyMovieClip("textlayer", ++z);
    fm = new TextFormat(o, l, c, null, null, null, null, null, null, w/e/2, w/e);
    lv = new LoadVars();
    lv.load(f);
    lv.onData = function(r) {
    s = r.toString().split("\r\n").join("\n");
    mc.createTextField("tf", 0, w/e, 0, w, h);
    mc.tf.wordWrap = true;
    mc.tf.autoSize = true;
    mc.tf.setNewTextFormat(fm);
    mc.tf.text = s+"\n";
    };
    o = drawsquare(p, "o", w, h, "1", c);
    b = drawsquare(p, "b", w/e, h, "1", c);
    k = drawsquare(p, "k", w/e, h, c, c);
    d = drawsquare(p, "d", w/e, l+e, c, c);
    m = drawsquare(p, "m", w, h, c, c);
    d.setMask(k), mc.setMask(m);
    d.onPress = function() {
    delete this.onEnterFrame;
    d.startDrag(false, d._x, 0, d._x, h-(d._height-1));
    d.onRelease = d.onReleaseOutside=d.onMouseUp=function () {
    d.stopDrag();
    };
    onMouseMove = function () {
    scrollcontent(d._y);
    };
    };
    b.onPress = function() {
    scrollcontent(_ymouse-(d._height));
    d.y>h-(d._height-1) ? d.y=h-(d._height-1) : d.y=Math.round(_ymouse)-d._height;
    d.onEnterFrame = function() {
    d.y>h-(d._height-1) ? d.y=h-(d._height-1) : Math.round(d._y) == d.y ? delete d.onEnterFrame : d._y += (d.y-d._y)*ra;
    };
    };
    }
    //scroller("faq.txt", xposition, yposition, width, height, percentage, "fontfamily", fontsize, color, scroll speed);
    scroller("faq.txt", 0, 0, 520, 390, 40, "verdana", 15, 0xb3b3b3, .1);</b>

  2. #2
    Senior Member
    Join Date
    Jan 2005
    Posts
    110
    That's awefully complex code for a simple text scroller. At least for me.

  3. #3
    Junior Member
    Join Date
    Oct 2004
    Posts
    24
    lol, well, for me too. I didn't write it and I'm lost lol

    But still, it's a very cool scrolling text box.

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    This is most probably Moagrius' script, and yes he likes complicated scripts. He's mostly on the actionscript forum, so you should post on that forum, and ask him!

    http://www.flashkit.com/board/forumd...php?forumid=30

  5. #5
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    i heard my name...

    the o, l, and c parameters are font-family, font-size and color respectively.

    if you want more than that, take this line
    Code:
    fm = new TextFormat(o, l, c, null, null, null, null, null, null, w/e/2, w/e);
    and beneath it put
    Code:
    fm.bold = true;
    fm.italics = true;
    fm.underline = true;
    fm.indent = 4;
    fm.leading = 6;
    fm.color = 0x000000;
    fm.size = 12;
    //etc...
    whatever properties you want to affect. for a complete list of properties, go to the help docs and look up TextFormat class.

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397

    i heard my name...

    Yeah sure! And I have land for sale in Florida!

  7. #7
    Junior Member
    Join Date
    Oct 2004
    Posts
    24
    Your ears were ringing, I'm sure of that.

    Again, I need to thank you for such an awesome scroll bar. I've tried creating my own but am still a novice and they come out very simple and boring

    I have one question about this scroll box. How easy or difficult is it to move the scroll from the left to the right side? I've tried to mess around with things and ...well, I royally screw it up


    THough this isn't massively important, it just seems that I always want to go to the right to scroll, like on a regular webpage.

    Thank you for the code, I'll add that. On the otherboard I got some suggestions also that have worked. THough everyone seemed to be in concensus that your code is most difficult

    Thanks

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