AS3 Text link event not working - actionscript-3

quick question regarding the TextEvent:LINK.
It stopped working recently when I switched my interface and I'm not quite sure why or how to fix it.
I have a movie clip which contains a text area and a scroll handler. 3 of these are added to my interface, although only 1 at a time is active in the display, depending on which tab you click.
All of that works fine, but once I change the chat object (textfield and scrollbar) in the display, it seems to stop working, and I'm not quite sure why. I'm not creating new instances all together, just adding and removing from a parent clip upon clicking different tabs.
Any idea what would be or could be causing this? As far as I can tell nothing is over or obstructing the clip containing the text field and scroll bar. The scroll bar actions work fine, which is next to the text field, however there seems to be no action going on as far as clicking links in the text field. I can select text in this text field as well, so I'm a bit confused :<
Thanks for your help.
Edit - Textfield is selectable, I know they need to be for the event to work.

I'm not entirely sure about the layout and the behavior of the project, but from my own bitter experience with TextEvents I learned that the less you mess around with the textfield, the better.
Maybe you should consider hiding the textfield instead of adding/removing it, i.e. changing the way the UI works without actually touching the affected elements in any way whatsoever.
If that's not possible, I'd try "rewriting" the text in the field and reattaching the event listener once the object is made visible again.
Hope you solve it quickly, texts are a pain in Flash.

Related

SVG disappears after adding / removing class in React app

I'm wanting to have a little expand / collapse svg rotate on click in my React app and it sometimes just disappears after the click and I have been looking in the inspector and have no idea why it isn't visible. It's happening in multiple browsers and I have recreated it in sadbox.io.
It seems to be very intermittent (sometimes it happens on the first click, sometimes you can toggle the class on and off many times before it will disappear. If it doesn't occur after a good amount of clicking I think it will still eventually occur or refreshing the page might do something to have it trigger sooner.)
Any ideas / help would be appreciated!
Sandbox
Ok, it looks like I figured out how to fix it through trial and error and looking at how it was done in a different project. It looks like if you apply the class to a parent element of the SVG then this problem will not occur. I'm not sure of the explanation or technical reasons for this.

Sencha Touch list scrolling while soft keyboard is up

I'm building a mobile app that lives inside of a UIWebView and is written in sencha.
Right now, I have a page that has a ext.list containing <textarea> element inside of the rows.
When the user clicks on the text area, the soft keyboard comes up and pushes the screen as expected. However, if you try to scroll the list while the keyboard is up, the list will dart all the way down to the bottom. At this point, you can try to scroll the list back up to see the <textarea> (keyboard still up), but whenever you're done scrolling and remove your finger it will immediately stick you down at the bottom of the list again.
Once you dismiss the soft keyboard, the problem goes away. We want scrolling with the keyboard up, unfortunately.
Things I've tried:
*Use the scrollstart event to unfocus the <textarea> and dismiss the keyboard when scrolling begins works, but like I said, we want scrolling with the keyboard up
*Put the <textarea> on a toolbar, or just plain fix it to the middle of the screen. It doesn't seem to care where the <textarea> is. The main problem seems to be the keyboard + scrolling interactions.
I've looked around for some time now and cannot find anything on this. It seems most people are complaining about Android, which I haven't even explored yet. I feel like this has got to be something people are incorporating into their apps, though (like a search that displays results while you type and you can browse those results), so I must just be missing something? Does Sencha 2 fix this?
Thanks in advance. I can post code and/or a demo as per request.

Prevent Chrome from setting scrollbar position to last on history state change

I used https://github.com/browserstate/history.js in a recent project to manage state changes in an ajax rich website.
Chrome exhibits a very annoying behaviour at times where it decides to reposition the scrollbar to some arbitrary position after a state change event. I have not experienced this problem with any other browser.
Does anyone have any suggestions? I would post code, but am not sure which parts will be relevant and I am hoping there is an obvious solution to this problem.
There are some obvious workarounds. Scroll to the top if that's what you want, or add a field to data object to store scroll position and restore it yourself. If it's a Chrome bug, work around it; if it's a feature you don't like, work around it; and if it's something you just have to implement yourself with three lines of code, work around it.

When you touch an HTML element in Safari on the iPad, it turns gray. What is the logic to decide which element among nested elements is shown in gray?

When you touch an element, such as an edit box, in a web page on the iPad, it turns gray while you are touching it.
I have a table wrapped by a floating div. Instead of an individual data element or row going gray, the whole table (or its wrapping div) goes gray when a data element is touched. (The function of this table is an autocomplete pop-up)
Elsewhere in the site, I have a table in which only the touched data element goes gray.
I wondered if anyone could direct me to an explanation of the logic behind this graying on touch, so that we can code our table to give the desired behavior. Ideally, we'd like the row to highlight when it is touched.
In the alternative, if we could turn off this graying behaviour, that would be another option. We could then code the highlighting ourselves. Is there a way to turn off this behavior for particular html elements?
Thanks.
This author suggests a solution to remove the highlighting:
If for whatever reason you don't want some elements of your web site or application to be highlighted, simply add the following CSS rule to the corresponding elements.
-webkit-tap-highlight-color: rgba(0,0,0,0);
It won't disable the highlighting, but it will make it invisible (an opacity of zero).
I have not tested this, however.
I have discovered something about the "logic" behind the graying behavior. It seems that elements that have handlers such as onclick, onmousedown etc. exhibit the behavior and those without such handlers don't. A (somewhat tedious) workaround for us is to change the code of the autocomplete so that each row has its own onmousedown etc. handler rather than the wrapping div taking care of this.
Try styling the wrapper div with select:none;
That should turn it off, and then you could code the highlight onfocus yourself.
Most browsers actually do this, but it's a bit more noticeable on the iPad and other Apple touch products. It's really for usability purposes, so I would only recommend disabling it if it is causing problems like the one you mentioned. It serves to help the user know what they are clicking, and gives them a chance to move their finger away if they are on the wrong thing.

Scrollbar with Sprite and Rectangle won't move text, just the Rectangle it's painted on

Warning: school assignment.
For those of you still with me, I am tasked with making some scrollable content in Flash. Load in a TextFile using LoadURL(), then display it. To get the text, we've written our own class TextFieldExtended, which is basically just there to give the textfile location to the constructor and then have the class do the various steps of getting it and loading it for you.
So I needed to get a Scrollbar, which I got here: http://kirupa.com/forum/showthread.php?t=245468
(all files in a zip linked at the end of this text)
The thing is, it works with Sprites.
After trying to get it to accept TextFieldExtended, I bumped into a block, since the scrollbar relied heavily on a Sprite property that TextFieldExtended didn't have or could have.
So I tried adding the TextFieldExtended instance to a Sprite instance using addchild.
A problem occurs here that I do not know how to handle. It seems that a Rectangle is drawn and the Text is drawn on that. I say this because the scrollbar moves the Rectangle up and down a bit, but the text doesn't scroll, just the Rectangle it is positioned in and the text then moves along with it.
My question: can this be fixed, or is does this implementation of scrollbars need a lot of adaptations before this is possible?
If so, any scrollbars you can recommend, because it's too extended for me at this point.
All files: http://www.mediafire.com/?q2ium22gmox
This was made in Flash CS4 using ActionScript3. The Example class is the final implementation
Sounds like an odd problem; I was reading up to the point where you say you put your TextField in a Sprite thinking "he just needs to put that TextField in a Sprite", so I'm not quite sure how to fix the specific problem you've got. I'd guess it's the Scrollbar you're using. So here's another one that's fairly straightforward to use:
http://www.warmforestflash.com/blog/2009/04/free-as3-scrollbar-fullscreen-and-resizable/
Give that a whirl. Scrollbars can be fiddly in my experience, but it's just a matter of finding an implementation that suits you. Hope it helps.