Egret learning diary entry --- twenty-nine (the contents of the book section 9.20)

Twenty-nine (the contents of the book section 9.20)

  Start 9.20.

  

  

  

  

  

  

  

  

   

  

  

  

  

  

  

  

  

  Key:

    1, master the use of scrolling text.

    2, after the height of the text exceeds the height of the ScrollerText component, appears to show how cases of incomplete treatment.

    3, do not use EXML of papers, direct use code way to create ScrollerText components.

  operating:

    1, master the use of scrolling text.

       Step 1: Create exml file, drag the component and set the properties of the component.

        Creating ScrollerTextSkin.exml file, and drag components Scroller, Scroller and restrained the four corners.

        

        Label component of drag, since good ID name, and a width set to 100%, and a relatively high level.

        

        At the same time, to set the Wrap property to true to true and multiple lines of text attributes.

          

          

      Step 2: Create Binding class.

        Create a ScrollerText.ts file.

        

        Instantiated.

        

      Step 3: Run View results

        

    2, after the height of the text exceeds the height of the ScrollerText component, appears to show how cases of incomplete treatment.

      First take a look at the specific circumstances of the problem:

        This is the text I want to display.

        

        Visible, very long. Then we run the project point of view, the contents of display problems.

        

        As you can see, the content seems to be limited, I still remember I had to Label height of it?

          At that time I was set up 1000.

                    

        So, we want Label height equal to the height of the text of the job.

        

        After setting the code, you can see the effect.

        

        So no problem.

        By the way, the issue of load txt file, the book provides RES.getRes () method does not work.

        I Quguan network to find a solution.

        

        Then own package a bit.

        

    3, do not use EXML of papers, direct use code way to create ScrollerText components.

       No! I want to Tucao! ! ! XX! ! Small fresh green healthy! ! !

      按照书中的代码,根本猫用都没有!!

      这是我修改后没问题的代码。

      

      

      

      最后,看一下运行效果。

        

  至此,9.20节 内容结束。

  

Guess you like

Origin www.cnblogs.com/dmc-nero/p/11314511.html