Adobe Flex的移动 - 文本区拒绝滚动在Android,的StageWebView不会滚动所有 [英] Adobe Flex Mobile - TextArea refuses to scroll on Android, StageWebView won't scroll at all

查看:133
本文介绍了Adobe Flex的移动 - 文本区拒绝滚动在Android,的StageWebView不会滚动所有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使文本被添加到它的Spark TextArea组件会自动向下滚动。

I'm trying to make the Spark TextArea component automatically scroll down as text is added to it.

在第一次填充文本区,垂直滚动条是在底部。但是,如果我追加更多的文本,它只是干脆拒绝滚动。它的工作在iOS平台上,但不会在Android上!

When the TextArea is first populated, the vertical scrollbar is at the bottom. But if I append more text, it just outright refuses to scroll. Its working on the iOS platform, but it won't on Android!!

我试着做以下,根据这里找到了例子:的 http://devgirl.org/2010/12/16/automatically-scroll-flex-mobile-textarea/

I've tried doing the following, according to the example found here: http://devgirl.org/2010/12/16/automatically-scroll-flex-mobile-textarea/

StyleableTextField(TextArea1.textDisplay).htmlText += textHTML;
StyleableTextField(TextArea1.textDisplay).scrollV++;

我也试过下面两行code:

I've also tried the following two lines of code:

StyleableTextField(TextArea1.textDisplay).verticalScrollPosition = int.MAX_VALUE - 1;
TextArea1.scrollToRange(int.MAX_VALUE, int.MAX_VALUE);

没有什么作品!每当文本区被更新,它只是向后滚动到顶部,或不动的。

NOTHING WORKS! Whenever the TextArea is updated, it just scrolls back up to the top, or doesn't move at all.

我甚至试图改变程序,以便HTML内容,而不是显示在一个的StageWebView。但我不能让一个滚动可言,甚至在iPad上。我试图调用JavaScript函数(的document.getElementById('身份证')。重点())以及插入一个隐藏的锚标记到code,并要求使用loadURL()就可以了。无论是解决方案的工作。

I even tried changing the program so that the HTML content is displayed in a StageWebView instead. But I can't get that one to scroll at all, even on the iPad. I tried calling a JavaScript function (document.getElementById('id').focus()) as well as inserting a hidden anchor tag into the code, and calling loadURL() on it. Neither solution worked.

是否有人可以帮助我走出这个?我绝对难住了。

Can someone please help me out with this? I am absolutely stumped.

推荐答案

您可以使用默认的文本框,但要留意,你必须处理一切都像自动滚动时的TextInput集中在文本框(因此,如果您放置了TextInput太近的键盘,它将由键盘被覆盖)的区域,SoftKeyboardType可能无法正确​​(如数字键盘)出现... 从我的角度来看,舞台文本是的TextInput最好的选择。

You can use default textfield but be mindful that you have to handle everything like Autoscroll to that textfield when textinput is focused in (so if you place the textinput too close the area of the keyboard, it will be covered by the keyboard), SoftKeyboardType may not appear correctly (like Number keyboard)... From my point of view, stage text is the best possible option for textinput.

这是我的工作,各地,使您的StageText的预期的TextInput工作。

This is my work around to make your StageText textinput works as expected.

  1. 复制StyleableStageText的内容,并创建一个像ExtendedStyleableStageText一个新的文件

  1. Copy the content of StyleableStageText and create a new file like ExtendedStyleableStageText

在ExtendedStyleableStageText添加2个功能:

In ExtendedStyleableStageText add 2 functions:

公共职能freezeStageText(){   如果(StageText的){       如果(stageText.visible){          createProxyImage();   }   stageText.visible = FALSE;   stageText.stage = NULL;   } }

public function freezeStageText(){ if(stageText){ if(stageText.visible){ createProxyImage(); } stageText.visible = false; stageText.stage = null; } }

公共职能unFreezeStageText():无效{ 如果(StageText的){     如果(!stageText.visible){     disposeProxyImage();      }      stageText.visible =真;      stageText.stage =阶段; }
}

public function unFreezeStageText():void{ if(stageText){ if(!stageText.visible){ disposeProxyImage(); } stageText.visible = true; stageText.stage = stage; }
}

复制spark.skins.mobile.supportClasses.StageTextSkinBase的像ExtendedStageTextSkinBase一个新的文件中的内容。

Copy the content of spark.skins.mobile.supportClasses.StageTextSkinBase to a new file like ExtendedStageTextSkinBase.

复制spark.skins.mobile.StageTextInputSkin的内容,并创建你自己的TextInput外观的文件。 在你的皮肤,使皮肤类应该扩展新创建ExtendedStageTextSkinBase文件,并添加功能

Copy the content of spark.skins.mobile.StageTextInputSkin and create your our own textinput skin file. In your skin, the skin class should extend your newly created ExtendedStageTextSkinBase file and add the function

    protected function commitCurrentState():void{
      super.commitCurrentState();
      if(currentState == 'disabled'){
         textDisplay.freezeStageText();
      }else{
         textDisplay.unFreezeStageText();
      }
    }

  • 在任何你认为需要使用的TextInput,如果你需要显示在视图顶部的弹出式,一定要改变所有的TextInput启用为false,或者如果您需要来定位文本正确地滚动时,您可以添加TouchInteractionStart和TouchInteractionEnd的卷轴,然后听的情况下,当用户开始触摸和滚动滚轮,禁用所有的文字输入是在视图中显示,当用户停止触摸,重新启用所有textinputs。

  • In any of your view that need to use the textinput, if you need to display a popup on top of the view, make sure to change all your textinput enabled to false, or if you need to position the text correctly when scrolling, you can add TouchInteractionStart and TouchInteractionEnd to the scroller then listen to the event, when user starts touching and scroll the scroller, disabled all the text input that are visible in the view and when user stops touching, re-enabled all the textinputs.

    希望这有助于。

    这篇关于Adobe Flex的移动 - 文本区拒绝滚动在Android,的StageWebView不会滚动所有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆