2 Replies Latest reply on Mar 17, 2010 1:26 AM by bornaeon

    TextFlow anchor problem

    bornaeon Level 1

      Hi folks,

      I want have a link in my textFlow... I'm doing something like this:

       

      <s:RichText x="50" y="50">
           <s:TextFlow>               
                <s:a href='http://www.adobe.com'>Adobe</s:a>
                <s:a href='http://www.yahoo.com'>
                     <s:img source='yahoo.jpg' width='50' height='50' />
                </s:a>
           </s:TextFlow>
      </s:RichText>
      

       

      But, when I run the project, my links (however text or pics) ar not in button-mode and wen I click them, nothing happens.

      What is wrong?

        • 1. Re: TextFlow anchor problem
          Peter deHaan Level 4

          Change the s:RichText control to a s:RichEditableText control.

          You can also set the editable property on the RichEditableText control to false if you dont want users modifying the text.

           

          Peter

          • 2. Re: TextFlow anchor problem
            bornaeon Level 1

            TanQ for your reply... The problem has been solved.

            But there is an another question here.

            I have a click attribute in my textFlow anchor tag, just like this:

             

            <fx:Script>
                 <![CDATA[
            
                 import mx.controls.Alert;
            
                 public function func():void{
                      Alert.show("hello!");
                 }
            
                 ]]>
            </fx:Script>
            
            <s:RichEditableText x="50" y="50" editable="false" id="RET" >
                 <s:TextFlow>
                      <s:a href='http://www.adobe.com' click='func()'>
                           <s:img source='adobe.jpg' width='50' height='50' />
                      </s:a>
                 </s:TextFlow>
            </s:RichEditableText>
            


            When I run the project, everything's allright; and after click on my image, I have adobe site in new window, and also have my popup alert window with "Hello!" text...

            But the Problem is another thing. I want to give this textFlow content from one webservice and put it in a string var then bind it to my RichEditableText. I receive it from webservice, put it in the string, and then bind this string to textFlow attribute of my RichEditableText obj with simple function... after running my project, I can see the content, and when I click on my image, I have adobe site in new window, again. but my function does not call!

            What is the problem?! the code is something like this (of course without webservice codes!):

             

            <fx:Script>
                 <![CDATA[
            
                 import flashx.textLayout.conversion.TextConverter;
                 import mx.controls.Alert;
            
                 public function func():void{
                      Alert.show("hello!");
                 }
            
                 internal var str:String;
                 public function func2():void{
                      str = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008' paddingRight='5'>"+
                      "<a href='http://www.adobe.com' click='func();'><img source='adobe.jpg' width='50' height='50' /></a>"+
                      "</TextFlow>";
                      RET.textFlow= TextConverter.importToFlow(str, TextConverter.TEXT_LAYOUT_FORMAT);
                 }
            
                 ]]>
            
            </fx:Script>
            
            <s:RichEditableText x="50" y="50" editable="false" id="RET" />