swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Swftools-common] Selectable Text


From: Goldstein, Seth
Subject: RE: [Swftools-common] Selectable Text
Date: Wed, 18 Feb 2009 08:39:43 -0600

Well, I was playing around with this, and I got it kinda working.  The
only problem left as far as I can tell is that the character hit
selection doesn't work while zoomed.  Can anyone help me out as to what
changes are necessary to get it to worked while zoomed?  Thanks!

For those that might be interested, so far I've taken 2 steps in
modifying Cristian Rusu's original code ( http://swfviewer.blogspot.com/
) :

1) Deleted dragarea and commented out all references to areabutton in
the actionscript

2) Added the following actionscript, which is based on
http://www.swftools.org/flash/textsnapshot.html :

stop();

//my_snap = cliparea.getTextSnapShot();
my_snap.setSelectColor(0xffff00);
firstChar = -1;

cliparea.onPress = function() {
        firstChar = my_snap.hitTestTextNearPos(_xmouse, _ymouse, 0);
        my_snap.setSelected(0, my_snap.getCount(), false);
        trace("cliparea.onPress = " + my_snap.getSelectedText(true));
};

cliparea.onRelease = function() {
        if (firstChar >= 0) {
                lastChar = my_snap.hitTestTextNearPos(_xmouse, _ymouse,
0);
                if (firstChar != lastChar) {
                        if (firstChar < lastChar) {
                                my_snap.setSelected(firstChar,
lastChar+1, true);
                        } else {
                                my_snap.setSelected(lastChar,
firstChar+1, true);
                        }
                }

                trace("cliparea.onRelease = " +
my_snap.getSelectedText(true));
                firstChar = -1;
                lastChar = -1;
        }
};

cliparea.onMouseMove = function() {
        if(firstChar != -1) {
                my_snap.setSelected(0, my_snap.getCount(), false);
//unselect everything

                lastChar = my_snap.hitTestTextNearPos(_xmouse, _ymouse,
0);
                if (firstChar < lastChar) {
                        my_snap.setSelected(firstChar, lastChar+1,
true);
                } else if(lastChar >= 0) {
                        my_snap.setSelected(lastChar, firstChar+1,
true);
                }

                trace("cliparea.onMouseMove = " +
my_snap.getSelectedText(true));
        }
};

-----Original Message-----
From: address@hidden
[mailto:address@hidden
On Behalf Of Goldstein, Seth
Sent: Saturday, February 14, 2009 10:17 AM
To: address@hidden
Subject: Re: [Swftools-common] Selectable Text


Cristian Rusu, were you able to make any progress with zviewer so you
could select text on the generated SWF?  I'd love to be able to do this,
but I have zero flash experience and so far having trouble with the
whole wrapper concept that Matthias mentioned.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]