Search code examples
flashactionscript-2fla

Mask Externally loaded html text in flash


since 3 days back I have been trying to mask this externally loaded HTML text but no success, what I want is to show the scrolling text only in a square or an oval shape, but not in the whole layer width.

PATH TO THE FLA FILE: http://ykt.wen.RU/ticker.rar

1.can someone help me and do it for me here?

or

  1. (MOST WANTED) can some one show me how to control the starting and ending point of the scrolling text using the as2 code?

or

  1. can some one upload another .fla file with what I need for me?

THANKS


Solution

  • You just have to insert your two textfields into an emptyMovieClip (Box), and mask it by using the setMask property. You need to put a movieClip named myMask on your scene.

    var Box = this.createEmptyMovieClip("Box", this.getNextHighestDepth());
    Box.setMask(myMask);
    
    System.useCodepage = true;
    function newsticker(inhalt, posX, posY, tiefe, tempo) {
        this.loadVariables(inhalt);
        this.onData = function() {
            Box.createTextField("text", tiefe, posX, posY, 10, 20);
            Box.createTextField("text2", tiefe + 1, posX, posY, 10, 20);
            with(Box) {
            text.html = true;
            text.htmlText = news;
            text.selectable = false;
            text.autoSize = "left";
            text2.html = true;
            text2.htmlText = news;
            text2.selectable = false;
            text2.autoSize = "left";
            text2._x = text._width;
            }
            function tick() {
                with(Box) {
                    text._x -= tempo;
                    text2._x -= tempo;
                    if (text._x >= posX) {
                        text._x = posX;
                        text2._x = text._width + posX;
                    }
                }
                updateAfterEvent();
            }
            ykt1_btn.onRollOver = function() {
                clearInterval(tick_interval);
            }
            ykt1_btn.onRollOut = function() {
                tick_interval = setInterval(tick, 30);
            }
            if (!tick_interval) {
                tick_interval = setInterval(tick, 30);
            }
        }
    }
    newsticker("ticker.txt", 0, 7, 1, 1);
    

    Other solution

    More simple, you can directly mask your _root (as a container), just adding before your code:

    this.setMask(myMask);