Radio - text format buttons

Hello world!

I can't get this to work! I want the text on the buttons of radio to wrap correctly when they reach the end of the scene (right now they just go on forever.) Here is the code I use:

package {}
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.events.Event;
Import fl.controls.RadioButton;
Import fl.controls.RadioButtonGroup;

SerializableAttribute public class QuizQuestion extends MovieClip {}
question private var: String;
private var questionField:TextField;
choice of private var: Array;
private var theCorrectAnswer:int;
private var theUserAnswer:int;

variables of positioning:
private var questionX:int = 25;
private var questionY: int = 150;
private var answerX:int = 25;
private var answerY: int = 200;
private var spacing: int = 25;

public void QuizQuestion (theQuestion:String, theAnswer:int,... responses) {}
store the arguments provided in the private variables:
question = Ducoup;
theCorrectAnswer = theAnswer;
choice = answers;


create and position the object textfield (question):
questionField = new TextField();
questionField.width = 775;
questionField.wordWrap = true;
questionField.multiline = true;
questionField.text = question;


trace (questionField.width);
questionField.autoSize = TextFieldAutoSize.LEFT;
questionField.x = questionX;
questionField.y = questionY;
addChild (questionField);


Format text for radio buttons
var txtFmt:TextFormat = new TextFormat();
txtFmt.font = "Arial";
txtFmt.blockIndent = 2;
txtFmt.color = 0 x 000000;
txtFmt.size = 11;
txtFmt.leading = 4;

create and position the radio buttons (responses):
var myGroup:RadioButtonGroup = new RadioButtonGroup ("group1");
myGroup.addEventListener (Event.CHANGE, changeHandler);
for (var i: int = 0; i < choices.length; i ++) {}
var rb: RadioButton = new RadioButton();
rb.setStyle ("textFormat", txtFmt);


rb.textField.autoSize = TextFieldAutoSize.LEFT;
RB.label = choice [i];
RB. Group = myGroup;
RB. Value = i + 1;
RB.x = answerX;
RB.y = questionY + questionField.height + 25 + (I * spacing);
addChild (rb);
}
}

private void changeHandler(event:Event) {}
theUserAnswer = event.target.selectedData;
}
public function get correctAnswer (): int {}
Return theCorrectAnswer;
}
public function get userAnswer (): int {}
Return theUserAnswer;
}
}
}

As you can see, I managed to get the style of text field option buttons to use "txtFmt' as the style:

rb.setStyle ("textFormat", txtFmt);

The question:

If I add:

rb.textField.width = 352;
rb.textField.height = 60;
rb.textField.multiline = rb.textField.wordWrap = true;

inside the ' loop for "creating the option button, it is simply my crazy text! It extends the text about 30 pixels after the option button, and then start wrapping, which makes any stack. How can I do create the radio button, display the text on the text field, roll once it reaches the edge of the stage and continue the next button.

Thank you in advance,

Rafa.

you not add the bottom of the issue of rb.  and the code that I have proposed changing the layout.  This does not solve the problem, but he amends the provision.  When you give misinformation, mislead you people who try to get you help.

and there are problems.

use:

package {    import flash.display.MovieClip;    import flash.text.TextField;     import flash.text.TextFormat;    import flash.text.TextFieldAutoSize;    import flash.events.Event;    import fl.controls.RadioButton;    import fl.controls.RadioButtonGroup;

    public class QuizQuestion extends MovieClip {        private var question:String;        private var questionField:TextField;        private var choices:Array;        private var theCorrectAnswer:int;        private var theUserAnswer:int;

        //variables for positioning:        private var questionX:int = 25;        private var questionY:int = 150;        private var answerX:int = 25;        private var answerY:int = 200;        private var spacing:int = 25;

        public function QuizQuestion(whichQuestion:int, theQuestion:String, theAnswer:int, ...answers) {            //store the supplied arguments in the private variables:            question = theQuestion;            theCorrectAnswer = theAnswer;            choices = answers;               //Text Format for readio buttons               var txtFmt:TextFormat = new TextFormat();               txtFmt.font = "Arial";               txtFmt.blockIndent = 2;               txtFmt.color = 0x000000;               txtFmt.size = 12;               txtFmt.leading = 4;            //create and position the textfield (question):            questionField = new TextField();            questionField.width = 770;               questionField.wordWrap = true;               questionField.multiline = true;                questionField.text = question;               //trace (questionField.width);            questionField.autoSize = TextFieldAutoSize.LEFT;            questionField.x = questionX;            questionField.y = questionY;               questionField.setTextFormat(txtFmt);            addChild(questionField);            //create and position the radio buttons (answers):            var myGroup:RadioButtonGroup = new RadioButtonGroup("group1");            myGroup.addEventListener(Event.CHANGE, changeHandler);            var rbY:Number = questionField.y+questionField.height;

               for(var i:int = 0; i < choices.length; i++) {                var rb:RadioButton = new RadioButton();                rb.setStyle("textFormat", txtFmt);                rb.textField.width = 352;rb.width=400;                rb.textField.autoSize = "left";                rb.textField.multiline  = rb.textField.wordWrap = true;                rb.textField.autoSize = TextFieldAutoSize.LEFT;                rb.label = choices[i];                rb.group = myGroup;                rb.value = i + 1;                rb.x = 30;                rb.y = rbY+rb.textField.height;

                rbY = rb.y+rb.textField.height;

                addChild(rb);            }        }

        private function changeHandler(event:Event) {            theUserAnswer = event.target.selectedData;        }        public function get correctAnswer():int {            return theCorrectAnswer;        }        public function get userAnswer():int {            return theUserAnswer;        }    }}

Tags: Adobe Animate

Similar Questions

  • Display radio group-Format values

    Hi all

    I use the Application Express 4.2.3.

    I have a group of buttons with the LOV query as follows:

    SELECT option1 | » '|| details as display, option1 AS return FROM my_table

    'details' are a hardcoded text in the table "my_table" enriched in the entry screen and stored as html text field

    When viewing in the radio group, details field appears in the html code.

    for example:

    Apple < p > < em > < strong > red in color. < facilities > < you /i > < / p >

    But I need the information should appear in the text formatted only.

    Any suggestions?

    Thanks in advance!

    Kind regards

    Archana

    For this radio group set "Escape special characters" no in the Security section of the element definition.

  • Text formatting on SegmentedControl and inside the drop-down list

    Hello

    I'm trying to change the color of the text on the buttons of a SegmentedControl and part of a drop-down list.

    I don't want to change the skin, but only the text. With the drop down menu, I managed to change the upper part (just what you see when the drop down menu is closed) using

    myDropDown.button.setTextFormatForState(myUpColor, SkinStates.UP);
    

    etc, but with the elements inside the list and buttons SegmentedControl I can't find a property that lets me set the text format...

    Any ideas?

    It doesn't seem to be an easy way to do.

    The only way would be to extend the SegmentedControl and then override the following method with the following code. It should do the trick. We will work on making that it puts far more easily in the future.

    override protected function onButtonAdded(child : RadioButton) : void
            {
                var dpLength : int = __dataProvider.length;
                child.width = Math.round( width / dpLength );
                // change this to be percentages
                child.groupname = __groupName;
                //Set your formats to whatever you like here.
                            child.setTextFormatForState( ThemeGlobals.getTextFormat( ThemeGlobals.SEGMENTED_CONTROL_FORMAT_DISABLED ), SkinStates.DISABLED );
                child.setTextFormatForState( ThemeGlobals.getTextFormat( ThemeGlobals.SEGMENTED_CONTROL_FORMAT_OUT ), SkinStates.UP );
                child.setTextFormatForState( ThemeGlobals.getTextFormat( ThemeGlobals.SEGMENTED_CONTROL_FORMAT_DOWN ), SkinStates.DOWN );
                child.setTextFormatForState( ThemeGlobals.getTextFormat( ThemeGlobals.SEGMENTED_CONTROL_FORMAT_SELECTED ), SkinStates.SELECTED );
                child.setTextFormatForState( ThemeGlobals.getTextFormat( ThemeGlobals.SEGMENTED_CONTROL_FORMAT_SELECTED_DISABLED ), SkinStates.DISABLED_SELECTED );
                child.drawNow();
                // set the button text formats here
            }
    
  • Paste the text formatted in inDesign

    Hi all

    I'm trying unsuccessfully to paste text formatted in InDesign CC (2015)

    I tried the following:

    Preferences ()Clipboard handling > option button for pasting of formatted text) in InDesign are defined to manage information. No chance!

    I tried with different formats, .rtf, .doc, etc., using the show import options when placing the text. No luck.

    Can someone guide me in the right direction?

    Best/Jonas

    Sorry about the URL, try this: http://www.lynda.com/InDesign-tutorials/Using-Word-InDesign-Together/122930-2.html

    You can map Word styles to Indesign Styles.

    Derek

  • Text format text field shows as a hyperlink?

    Hello

    I created a PDF form fillable which is automatically filled by VBA integrated in a macro on an Excel worksheet button.

    One of the pieces of data that are retrieved from the Excel sheet is a link to a Web site.

    When the PDF form is sent by e-mail to a customer that I need this link appears as a hyperlink to my client can easily open the site by clicking on the text field.

    After looking through all the format options, I don't see anything that will allow me to format the text as a hyperlink field, so I think I'm going to need a script any?

    The Web link is different for each form that is created if unfortunately is not a static address, which can be hard coded on the form.

    Any help with this would be much appreciated!

    Thank you!

    Using the option "Open a web link" would probably mean that the link should be predefined in the text field?

    This isn't what I meant. A script can be written that will (attempt to) open the current text in the text box, regardless of what it is in the browser. Basically, it would be something like this (as the mouse upward event):

    try {app.launchURL (event.target.value) ;} catch (e) {}

    Using the link option in Rich Text Format could put on to launch everything that is entered in the text rather than a predefined web address field?

    No, it must be set manually. I don't see how this feature of script.

  • No Manipulation of the text (Ribbon) button?

    This is the first time that I actually tried to change the content in a PDF using Adobe Acrobat X Pro.

    OK, so you can use the "Edit the text Document" in the context menu content.   But I do not see buttons at the top of Acrobat... things you normally see in word processing applications.  You know your typical police "BOLD", change the drop-down list, etc.

    So I see that you can change the text, right click then go to properties of the highlighted text.  There, you can do it all.

    Is this the only way?   I do not pray.

    Unless I'm missing, I don't see a bar at the top that I can activate that gives me formatting buttons in Acrobat.

    Acrobat isn't a word processing application.

  • Text Format problem

    Hi all

    I am building an application in AS3, but I'm the problem in text formats.

    I'm sure that's not a big problem., but I'm new so can not make sense for him.

    I have three text fields of type entry in my application, where when I type it show preview on the right side in the other fields of text in real-time using earphone Event.CHANGE. Now I have to apply the format on all separately three fields. (Bold, italic, size etc.). But when I use it to make "BOLD" using the "BOLD" button, the text in all three text fields change to "BOLD" at once.

    What I need is to apply the format of separately for each field using a "BOLD" text, Italic button etc.  The format will apply the last text field edited or by selecting the text field in the preview and change its formula.

    Here's the best example if formats the text I want.

    http://www.Spreadshirt.com/create-your-own-t-shirt-C59

    I hope that the experts will understand and can give me suggestions.

    Here is the code example, what I'm doing...

    Its share of demand.

    Import fl.controls.Button;

    var txtF1:TextFormat = new TextFormat();
    var txtF2:TextFormat = new TextFormat();
    var txtF3:TextFormat = new TextFormat();

    var b1:Boolean = new Boolean();
    var b2:Boolean = new Boolean();
    var b3:Boolean = new Boolean();

    var preview1:TextField = new TextField();
    var preview2:TextField = new TextField();
    var preview3:TextField = new TextField();

    function previewfirst(e:Event):void
    {
    Tf1.text = Preview1.text;
    Preview1.x = tf1.x + tf1.width + 20;
    Preview1.y = tf1.y;
    addChild (preview1);

    boldBTN.addEventListener (MouseEvent.CLICK, makeFirstBold);
    }

    function previewsecond(e:Event):void
    {

    preview2. Tf2.text = text;
    preview2.x = tf2.x + tf2.width + 20;
    preview2.y = tf2.y;
    addChild (preview2);
    boldBTN.addEventListener (MouseEvent.CLICK, makeSecondBold);
    }

    function previewthird(e:Event):void
    {

    preview3. Text = tf3.text;
    preview3.x = tf3.x + tf3.width + 20;
    preview3.y = tf3.y;
    addChild (preview3);

    boldBTN.addEventListener (MouseEvent.CLICK, makeThirdBold);
    }


    TF1.addEventListener (Event.CHANGE, previewfirst);
    TF2.addEventListener (Event.CHANGE, previewsecond);
    TF3.addEventListener (Event.CHANGE, previewthird);


    function makeFirstBold(e:MouseEvent):void
    {
    If (B1)
    {
    txtF1.bold = false;
    Preview1.setTextFormat (txtF1);
    } else
    {
    txtF1.bold = true;
    Preview1.setTextFormat (txtF1);
    }
    }

    function makeSecondBold(e:MouseEvent):void
    {
    If (B2)
    {
    txtF2.bold = false;
    preview2.setTextFormat (txtF2);
    } else
    {
    txtF2.bold = true;
    preview2.setTextFormat (txtF2);
    }
    }

    function makeThirdBold(e:MouseEvent):void
    {
    If (B3)
    {
    txtF3.bold = false;
    preview3.setTextFormat (txtF3);
    } else
    {
    txtF3.bold = true;
    preview3.setTextFormat (txtF3);
    }
    }

    Yes, that's the reason. Change:

    this["tf" + i].addEventListener(Event.CHANGE, onTextChange);
    

    And so on.

  • Mandatory radio as XML button

    Based on the examples here and here I have a datagrid that uses an XML object as its dataprovider. The xml code goes like this:

    < questions >
    < question >
    < message > who are your heroes? < / guest >
    < answers >
    < response >
    < address > true < / correct >
    < text > Luther Higgs < / text >
    < / answer >
    < response >
    < address > false < / correct >
    < text > Barney Fife < / text >
    < / answer >
    < / answers >
    < / question >
    < / questions >

    Correct (if a bit confusing) xml. I have two columns in my datagrid. The second column binds to questions.question.answers.answer.text and works very well. The editable datagrid is set true and I am able to click on the second column and type and it records the response in the object xml very well. The problem lies in my first column. The mxml looks like this:

    < mx:DataGridColumn headerText = 'Correct' >
    < mx:itemRenderer >
    < mx:Component >
    < mx:VBox horizontalAlign = "center" >
    < mx:RadioButton id = "myRadioButton.
    buttonMode = "true" useHandCursor = "true".
    Group = "{outerDocument.myRadioButtonGroup}" selected = "{data.correct}" / > "
    < / mx:VBox >
    < / mx:Component >
    < / mx:itemRenderer >
    < / mx:DataGridColumn >

    The problem is that the radio properties some buttons are not related to the xml data, which is set to true does not appear as selected. If I set the datagridcolumn's editable property to false, clicking on the checkbox option does not affect the XML at all either. If I leave the datagridcolumn's editable property inherited by default true (based on the parent of the datagrid component editable property) when I click on the option button the default itemEditor is displayed (a text entry box) which contains the following text:

    < / answer >

    and when I come out of the Editor (click outside or press enter) the XML looks like this:

    < answers >
    < response >
    < address > true < / correct >
    < text > Luther Higgs < / text >
    < / answer >
    < response >
    < address > false < / correct >
    < text > Barney Fife < / text >
    < null > & lt; response & gt;
    & lt; correct & gt; false & lt; / OK & gt;
    & lt; text & gt; Barney Fife & lt; / text & gt;
    & lt; / response & gt; < / null >
    < / answer >
    < / answers >

    I've seen controls that do not have the written correctly xml path display the entire xml node rather than only the data, but I see no reason why anything should never reference just the closing tag. For me, this looks like a bug in data between the radio button and the xml object links.

    Just to clear the air in order to avoid suggestions that will work but do not meet the design requirements, what I need is a datagrid that has a radio (only one good answer outside the Group) group in the first column and channels in the second column, which should be editable. I guess I could write hairy event listener code and manually to hack things together, but avoid other headaches, I'd love to use data links for what they were intended to-I just need to know why it doesn't seem to be working properly. Many thanks in advance for any help.

    The research of the LiveDocs, revealed the answer. Under the heading "to the aid of an E4X expression in a tag", I found this case instead of


    buttonMode = "true" useHandCursor = "true".
    Group = "{outerDocument.myRadioButtonGroup}" selected = "{data.correct}" / > ""

    I have


    buttonMode = "true" useHandCursor = "true".
    Group = "{outerDocument.myRadioButtonGroup}" / >

    It works beautifully.

    Apparently binding between XML and the selected property of a radio button (which is of type boolean) needs of the rather than the rating of the brace in the tag.

    PS The link on livedocs is here:
    http://livedocs.Adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=live Docs_Book_Parts & file = databinding_091_05.html #177459

  • After re - install, when I "answer" text of the sender is in plain ASCII text format, regardless of the settings.

    I had trouble with Thunderbird, I so re-installed. (Version 38.2.0) I use TB for years, usually with no problems. But this time, after re - install, when I "answer" text of the sender is in plain ASCII text format, regardless of the settings. And plain text is bright blue!

    I want to preserve the HTML format (usual) of e-mail of the sender when I answer. My settings specify the HTML format.

    I don't want to use TB with this "disability" - help! Thank you!

    I don't see where you checked the compositions and the addressing of adjustment to your account. For all accounts also.

  • Text formatting will not work on 7.23

    Hello.

    It has been recently updated (about two weeks ago) that completely broke text formatting for me.

    None of the options work for me.

    They would look like this under my messages:

    * bold *.

    _italics_

    ~ bar ~

    {code} and I don't even know what to call this code from {}

    None of them appear correctly, yet other people I chat with that do not have this problem.

    What happened, and is there a way to fix this?

    Under "Tools" - "Options" - 'IM and SMS' - "Appearance IM", make sure that 'Show advanced text formatting' are checked.

  • How can I save data in text format

    How can I save data in text format in labwindows cvi

    Hello

    If your data is in a table, the easiest is to use the ArrayToFile function.

    Automatically, it creates a file and puts your data in it depending on the size you provide.

    If you have individual samples you need to write from time to time, you can either collect them in a table and then use ArrayToFile or open a file with fopen and write them as they are acquired with fwrite.

    Hope this helps,

  • How to generate a report in text format

    How to build a report in text format and send it to both a file and a printer?

    Hi Chuck,

    Yes, it seems that the printed report and save the report to the VI file seen in the link above from smercurio_fc is going to do what you need.

    Also, here is an example of our community that can be useful to print to the printer by default by using report generation,.

    I hope this helps!

  • loss of text format

    @when iam trying to display text that is formatted as clob. He loses the formatting... This is the code that iam using to display

    IAM using Express application 5.0.0.00.31

    DECLARE

    v_chunk_size NUMBER: = 2000; joelkallman-Oracle

    CURSOR l_cur IS

    SELECT EB_TEXT

    EBOOKS

    WHERE EB_SLNO =: P7_SLNO

    AND dbms_lob.getlength (EB_TEXT) > 0;

    BEGIN

    FOR l_rec in l_cur LOOP

    BECAUSE me in 1... ceil (dbms_lob.getlength (l_rec. EB_TEXT) / v_chunk_size)

    LOOP

    HTP. PRN (substr (l_rec. EB_TEXT, ((i-1) * v_chunk_size) + 1, v_chunk_size));

    END LOOP;

    END LOOP;

    END;

    How can I display the text without losing text format?

    Taharka Krishna wrote:

    Lose the paragraph formatting.

    This is because the HTML specification normally requires all the extra white space characters are collapsed and treated as a single space. However, preformatted text can be displayed using the pre element, in which whitespace is rendered as:

    DECLARE
    
      v_chunk_size NUMBER:=2000;
    
       CURSOR l_cur IS
      SELECT EB_TEXT
        FROM EBOOKS
       WHERE EB_SLNO= :P7_SLNO
        AND dbms_lob.getlength(EB_TEXT)>0;
    
    BEGIN
    
      htp.p('
    ');
    
      FOR l_rec in l_cur LOOP
          FOR i IN 1 .. ceil(dbms_lob.getlength(l_rec.EB_TEXT)/v_chunk_size)
          LOOP
            htp.PRN(substr(l_rec.EB_TEXT,((i-1)*v_chunk_size)+1, v_chunk_size));
          END LOOP;
      END LOOP;
    
      htp.p('/
    ');
    
    END;
    
  • How to show the white space of the text formatted?

    Hello

    I use Jdev 11.1.1.6.0 with ADF Faces.

    I have a requirement to show a text report page in recorded format. The report in text format is saved as a text report several records with each line containing the maximum 78 characters.

    Each drive is formatted with a space to display the data in the column. For example:

    SUMMARY

    -------

    Col1 Col2 Col3

    xyz1234 abc9999 mno1234

    ...

    The report data appears currently unformatted. It removes the white space and shows just with a few default spaces. Something like:

    SUMMARY

    -------

    Col1 Col2 Col3

    xyz1234 abc9999 mno1234

    ...

    Thus, you cannot read the data with the appropriate column header. If you query the table in SQL Developer, it shows with perfect formatting. Also our legacy Oracle Forms application to display with the correct format.

    Currently, I tried following, but it does not work:

    < af:outputText value = "#{row.rptText}" id = 'ot1' "

    inlineStyle = "do-family:"Courier New";" font-size: 12.0pt; »

    noWrap = "false" / >

    I tried this on af:column too, especially noWrap = 'false', but so far without success.

    Any help is appreciated.

    Thank you

    JAI

    If you can use a converter custom jsf (validation and conversion of entry) to change in the query using "pre" helped the (text with pre sourrounf) when the data is rendered. The converter must implement two methods. Then you can try to use ' ' as a space of unbreakeable instead of simple spaces.

    Timo

  • is it possible to import text formatted in a document word or pages?

    Hey,.

    I need to import a text, which is about 13 pages. Is it possible to import the text with all the formatting?

    Every time I'll import text, formatting is gone.

    Best regards

    Tristan

    If you can convert your documents into PDF files, you can watch in the Muse themes widget to display PDF files within a web page itself.

    http://www.Muse-themes.com/products/PDF-Viewer

    Charlie

Maybe you are looking for