0 Replies Latest reply on Aug 30, 2012 9:16 AM by WebEntrepreneur

    Grap & highlight 'selected text' in a loaded SVG file via Actionscript.


      I have been looking at all the functionalities here...

      http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/text/TextSnapshot.html


      I am trying to find out if this is possible via Flex, Flex Library or something...


      There is a problem that is not clear on the Adobe Examples or any Adobe Forums...


      Is it possible to do the same with SVG loaded into an swf. I would like to be able to select

      text charaters in the SVG with in Flash/Flex, and then get the actual text selected like can be done in Javascript.


      When I try to select text inside an SVG file that is loaded into Flash, it is not selectable, and it does not seam

      to even fire any events, neither any 'pointer events'  back to the Flash that ActionScript can catch.


      When SVG is loaded I can see text from the SVG in the debugger:





      Is it possible to load an SVG file that has text for example, 'abc' in it, into an swf and

      do like:


      private function loadSVGHandler(evt:Event):void {

          trace('find string iIN SVG: ' + evt.parent.textSnapshot.findText(0, 'abc', false) ); // returns -1

           trace('find string count IN SVG: ' +evt.parent.textSnapshot.charCount ); // returns 0



           evt.parent.textSnapshot.setSelected(0, 4, true);

           trace('1) find iIN SVG: ' + evt.parent.textSnapshot.getSelectedText(false) ); // nothing happens



      In all my tests, I received no syntax error, only I received the responses 'false' and -1 in all cases.


      I delved into the debugger etc, and it looks like it is not possible to do this in Actionscript 3.


      Please inform, am I correct, is it not possible to do this in ActionScript or am I missing something?