Highlighted

Links in HTML TextField not working well on iPad

New Here ,
May 31, 2011

Copy link to clipboard

Copied

Hi there;

I've got a TextField with html in it that has anchors that call out to Flash functions using the href="event:" mechanism.

It works 100% fine when I test my fla on my Mac... ie. Clicking on the links is responsive, and all works as expected.

When I publish this to the iPhone or iPad, the links work, but only after I click them 2 or 3 times. It *seems* like the stroke of the font is the only clickable part.... It feels like clicking in the center of a letter "O" wouldn't work, and clicking the strokes of the letter "O" would...

The links are very big... and there are about 20 of them on the page.

Has anyone else run into this problem? I've tried using css styles to set display:block, but that didn't seem to help!

Thanks,

Brad

Topics

Development

Views

1.5K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Links in HTML TextField not working well on iPad

New Here ,
May 31, 2011

Copy link to clipboard

Copied

Hi there;

I've got a TextField with html in it that has anchors that call out to Flash functions using the href="event:" mechanism.

It works 100% fine when I test my fla on my Mac... ie. Clicking on the links is responsive, and all works as expected.

When I publish this to the iPhone or iPad, the links work, but only after I click them 2 or 3 times. It *seems* like the stroke of the font is the only clickable part.... It feels like clicking in the center of a letter "O" wouldn't work, and clicking the strokes of the letter "O" would...

The links are very big... and there are about 20 of them on the page.

Has anyone else run into this problem? I've tried using css styles to set display:block, but that didn't seem to help!

Thanks,

Brad

Topics

Development

Views

1.5K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Contributor ,
May 31, 2011

Copy link to clipboard

Copied

One workaround that I use is that I make a movieclip with an alpha of 0, place it over the "linked" word, and make an on click listener for the box to navigate to whatever url you want.  But if you text is constantly changing or there are a lot of links, that might not be a good solution for you.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 31, 2011

Copy link to clipboard

Copied

unfortunately my text is constantly changing, as it's authored and loaded dynamically for a lot of different situations... if i can't find a solution i'll have to change the way this part of the system works, which would be lots more work than I (or my client!) would like to do! thanks for the suggestion though!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Jun 01, 2011

Copy link to clipboard

Copied

My links in TLF textfields are also not working well on the IPAD. Maybe about 30% of the links will work and often it takes repeated clicks. I'm certainly not expert in TLF so it might be something simple I'm missing. Anyways here are my notes and would appreciate any input.

Originally I put the addEventListener(FlowElementMouseEvent.MOUSE_DOWN listener in my textflow which runs over 20 containers. This works like a charm on the desktop and on my Android mobile device, all of the approximately 50 links work instantly.

I then tried putting the same listener on every link and not on the textflow. Still fine on desktop, no improvement with IPAD.

I tried using touchevents on the links, again no luck.  Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT;  container.addEventListener(TouchEvent.TOUCH_TAP  it seemed only to recognize textlines, no links.

Finally I tried just a single .fla with 1 TLF textfield containing 5 words with a google link on the middle word and one empty classic textfield plus 5 lines Actions code:

import flashx.textLayout.elements.*;
import flashx.textLayout.events.FlowElementMouseEvent;
TLFx.textFlow.addEventListener(FlowElementMouseEvent.MOUSE_DOWN , function (event:FlowElementMouseEvent):void {
CLSx.htmlText=LinkElement(event.flowElement).href ;
});

This simple link would not work on my IPAD but fine on desktop. Again it could be something trivial that I'm missing but any input would be appreciated.

Thx, Peter

[using CS5.5]

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jun 01, 2011

Copy link to clipboard

Copied

Hi Peter... thanks for your input.... I too had tried touchevents with no luck, and simpler examples that didn't seem to work either.... so definitely a similar situation over here.... i'm thinking i might have to rework these parts of my app, but it's so much more flexible this way, I'd hate too!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Jun 01, 2011

Copy link to clipboard

Copied

had this all typed in earlier today just when we had a major power outage and lost it, plus restraining myself from tossing the IPAD and sticking to Android mobile!

anyways, per your message, tried to rework my app here as well and this method seems to work for me with item still to be worked out per notes below.

overview:

using TLF CS5.5

use TouchEvent listener on my containers to return textline being touched

once touched, loop through all spans and if parent is a link, get the textline associated with that link

if match then jackpot, return,

some rough code below,

where this fails is when my link rambles over several lines and it's only recognizing the first line of the link. Otherwise, all links in all containers respond well.

     function taphandler(event:TouchEvent): void {

       var leaf:SpanElement;
       var link:LinkElement;
       var absoluteStart:int;
       var matchTextLine:TextLine;
       leaf = SpanElement(TLF2.textFlow.getFirstLeaf());

       while (leaf = SpanElement(leaf.getNextLeaf())) {

         link = leaf.getParentByType(LinkElement) as LinkElement;
         if (link != null){

           absoluteStart = link.getAbsoluteStart();
           matchTextLine = link.getTextFlow().flowComposer.findLineAtPosition(absoluteStart).getTextLine(true);
            if(matchTextLine==event.target){
              //JACKPOT! use link.href         
              return;
            } 
         }
       }

    }

i welcome any input to code (i think i miss out if i have a link in first span which I should not have but..) and how to get at the second, third, fourth,.. lines of the link.  hopefully someone in the TLF area can explain the quantity and hierarchy of the objects of the links that are spread over many lines since from a user perspective we just see text, mind you high quality and very intelligent text and Adobe should be commended.

UPDATE:

as it worked above, a sample textline with plain text and 3 links, clicking anywhere on the textline always gives me link#1 unfortunately.

seems like I need a for loop just before the matchTextLine that iterates i=(link.parentRelativeEnd-link.parentRelativeStart) times, then must do a GetAtomBounds LocalToGlobal compare to Stage.x then modify the line if(matchTextLine==event.target){  to if(matchTextLine==event.target&&thisLinkIsAtX==true){      ouch I hope I don't have to do all this..

Message was edited by: hiteck7

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jun 02, 2011

Copy link to clipboard

Copied

Thanks for all the info! I had unfortunately already started underway to resolve my problem without using TextFields, but may come back to this sometime next week... thanks for your input.... Seems very close to something useful!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...