Difficulty displaying numeric info in text field

I'm trying to display the playheadTime of an FLV movie
(called vid_player) on the stage in a test field (called
myTextField). I used to be able to do this in older actionscript,
but with AS3, I'm having a heck of a time. Here's my code:
function getCurrentTime(evt:MouseEvent):void {
var currentTime:Number = this.vid_player.playheadTime;
this.myTextField = currentTime;
step3Tab.addEventListener(MouseEvent.CLICK, getCurrentTime);
I get this error:
1067: Implicit coercion of a value of type Number to an
unrelated type flash.text:TextField.

I don't think you've quite been able to do this in previous
versions! The error is telling you exactly what is wrong. You are
trying to change a TextField into a Number and that just won't
work.
I haven't done enough with AS3 to be sure off the top of my
head if it changed or not, but I think you want the text or the
htmlText property of the text field.
this.myTextField.text=currentTime;
or if it doesn't like that you may need to cast or convert
the currentTime to a string;
this.myTextField.text=String(currentTime);
this.myTextField.text=currentTime.toString();

Similar Messages

  • Displaying images in dynamic text fields

    Hi, I am having some difficulty getting my images to display
    in a dynamic text field. The images are linked from a txt file with
    the <img src=""> tag however they are not showing up in the
    text area. The rest of the html are rendering fine except the image
    tag. My example online is here:
    www.supernaturalmedia.com.
    Here is the code I used in Flash:
    var style_sheet = new TextField.StyleSheet();
    var css_url = "global.css";
    style_sheet.load(css_url);
    news.StyleSheet = style_sheet;
    loadVariables("projects_news.txt", this.news);
    My css styles also isn't loadin so i temporarily am using
    html styles for formatting. I'd like to get the css to work as
    well.
    My movie is published as Flash Player 6, AS 2.0.
    I'd appreciate any helpful advice.
    Thanks,
    Stanton

    1. don't assign the stylesheet property of your textfield
    until loading of global.css is complete. ie, use the onLoad handler
    for stylesheets.
    2. you have movieclip images that are linked for export and
    you're using their linkage id in src property of the img
    tag?

  • How to display date in a text field when a calendar is clicked

    hi
    I have a button i placed a calendar image in that button.when i click that button it displaying a calendar,when i click that calendar it is displaying the specific date .
    what i want is,when i click the calendar the specific date must display in a text field.
    please help me.
    thanks in advance

    Hi Arch,
    Go to the following link and check JCalendar API (needs to create a login for downloading JAR)
    [JCalendar API @ dev.java.net|https://jcalendar.dev.java.net/]
    it is a nice JCalendar with lot of options. Also it is working. You can download the JAR file and use it in ur program.
    From this component, you can read out the Date value and then set the text of JTextFiled using this value.
    or go for another implementation
    [Another JCalendar|http://www.gimlisys.com/articles-jdatechooser.html]
    Sunil

  • Display system time in text field

    hi all,
    I want to diplay the current system time (format: hh:mm) in a text field on screen
    ... and update the displayed time every minute.
    How would I implement it ?
    Thanks for your assistance.

    run the code above in a thread that is activated after every 1 min to update the timeYou should not create a thread to do this. Swing components should be updated in the event thread. It is better to use a Swing Timer. This thread deals with this issue. Replies 1 & 4 are the most relevant:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=374524

  • Info From Text Fields

    Hi, i was jsut wondeirng how to get the information submitted from a text field. Like, let's say i have a text field, and when the user types what they want in it, and hits the "Submit" button, it writes that information to a file. Thanks in advance
    PS: I know how to write info to a file, i just need to know how to get the information from the text field.

    Encephalopathic wrote:
    I recommend switching to Swing.Absolutely. Writing your app in AWT makes no sense these days. It doesn't really make your app look more "native" than Swing, due to its severe lack of features (accelerators for menus, toolbars, using the wrong fonts, etc.).
    If you really want to use a "native" toolkit instead of Swing, go with SWT, which has a much fuller feature set than AWT. Just be prepared to build different versions of your application for different platforms.

  • Displaying the value of text field A in text field B

    I have a PDF form with 2 layers. Layer 1 has information, a textfield, and a button. Layer 2 is a certificate design. The user inputs their name in to a textfield called NameEntry.
    When they hit the button, layer 1 disappears -- the instructions and NameEntry box become hidden. Layer 2 is the certificate design and I need a new textfield (which is called NameDisplay) to be populated from inputted information in text field NameEntry.
    The simple answer, I know, is to name both text fields the same. This does not work for me as I need the input textfield to be styled differently (background and border) due to decisions out of my control vs the NameDisplay which will have no background and no border.
    Any ideas? Thanks!

    Use this custom calculation script:
    event.value = this.getField("NameEntry").valueAsString;

  • Taking info from text fields

    I am trying to sut this game up so that if the text "NateTheWizard" are typed in a text field, then the 'new game' button will load level 3 instead of level one.
    with this text, no matter what is in the field, it loads level one:
    public void startButton_actionPerformed(ActionEvent e) {
    if((password.getText() == "NateTheWizard")){
    DotStealthFrame.contentPane.removeAll();
    DotStealthFrame.contentPane.add(new Level3(), BorderLayout.CENTER);
    DotStealthFrame.contentPane.updateUI();
    DotStealthFrame.contentPane.getComponent(0).requestFocusInWindow();
    lvl3Popup level3Pop = new lvl3Popup();
    level3Pop.setModal(false);
    level3Pop.setLocation(300, 300);
    level3Pop.setVisible(true);
    else{
    DotStealthFrame.contentPane.removeAll();
    DotStealthFrame.contentPane.add(new Level1(), BorderLayout.CENTER);
    DotStealthFrame.contentPane.updateUI();
    DotStealthFrame.contentPane.getComponent(0).requestFocusInWindow();
    lvl1Popup level1Pop = new lvl1Popup();
    level1Pop.setModal(false);
    level1Pop.setLocation(300, 300);
    level1Pop.setVisible(true);
    }

    http://access1.sun.com/FAQSets/newtojavatechfaq.html#9

  • How to display links in a text-field in Portal forms?

    In a database the content in a varchar2 field could include a link:
    'Shortname &lt;a ref="#" title="Full or long item name"&gt;Long name&lt;/a&gt;'
    In a Portal report this field is displayed like:
    Shortname {color:#0000ff}_Long name_
    {color}
    where the last part is a link. When pointing to this link with the mouse, the full item name is displayed. If this field is displayed in a Portal form, however, it is displayed exactly as written first:
    Shortname &lt;a ref="#" title="Full or long item name"&gt;Long name&lt;/a&gt;
    Could anybody tell how this field could be displayed as a link in Portal forms? The field itself does not need to be updated, it serves as an identifier for trailing fields in the details of a MD-form. If the long name should be displayed in the field, you would need to scroll horizontal to see the other details.

    Yes your point is clearer now. You wish to see an abridged form of a field data with the facility to see the full data when you hover on that data. just like what we see sometimes in hyperlinks.
    Both of the methods I told you work to display a modified data value* (without modifying them in the databse) and I floated them after testing. Have used slightly different functionalities in some applications a while back.
    To get the 'mouse hover' display, you may want to use the java-script event-handlers of the form elements.
    Both methods work with the premise that we do not want to change field data in DB; only displayed-data needs to be different.
    1. The idea to edit info using sql-queries or functions from default value attribute work is the main thing. how and what should we edit the data to produce is a plsql-coding problem. So for instance, for a data example like yours, the following works!
    assumption: the desired field is LINKS and is a column in PORTAL.TBL_TEST_FORMLINKS
    SELECT DECODE(LINKS, NULL,NULL,SUBSTR(LINKS,INSTR(LINKS,'>','1')+1, LENGTH(LINKS)-INSTR(LINKS,'<','2'))) FROM PORTAL.TBL_TEST_FORMLINKS
    If you need a different output or have a different requirement, then the example should be sufficient to guide you how to help yourself.
    2. The other case of javascript embedded html in an additional plsql code also works. One such example is this:
    <pre>
    BEGIN
    HTP.PRINT('<SCRIPT LANGUAGE="JavaScript1.1">
    // find the element you want to edit first;
    // hint: you may use this scheme and some basic jscript to extract the field LINKS : FORM_NAME.DEFAULT.LINKS.01
    // now use javascript to get its value; treat it to fit your requirement; and equate it back to the LINKS element;
    </SCRIPT>');
    EXCEPTION
    When Others THEN
    null;
    END;
    </pre>
    -- now follow my other instruction on FORM attributes in my second reply to see what you want to see.
    these hints should be more than enough for anyone familiar with these technologies.
    AMN

  • Item level Info record PO text field in Purchase Order Me21n transaction

    Hello All,
    I have to enter some information in the PO info record text field (which is in Item level Texts tab of ME21n transaction ) using an user-exit at the time of creation/change of purchase Order.
    Does anyone knows the user-exit and how to update the text field ?
    Any help is really appreciated
    Thanks
    Ricky

    Check with : Enhancement : MM06E005
    Function module : EXIT_SAPMM06E_017
    This user exit will trigger when you enter the data in item level(Both creation and change)

  • Need help displaying data in text field... Help?

    i have this code:
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import com.adobe.serialization.json.JSON;
    var loader:URLLoader = new URLLoader(new URLRequest("https://api.twitter.com/1/statuses/user_timeline.json?screen_name=ScottMitchell"));
    loader.addEventListener(Event.COMPLETE, loadComplete);
    function loadComplete(e:Event):void {
        processData(e.target.data);
    function processData(data:String):void {
        var tweets:Array = JSON.decode(data) as Array;
        trace(tweets[0].text);
    It works, in the output it tells me the tweets.
    but i need it to be displyed on the app, i need to no how to do this, someone pointed me in the direction of using a item renderer extended from sprite?
    But really all i need to do is display it in a text field, all i want to do is display the data.
    Can anyone help???
    I know this is probably simple and i did try to figure this out on my own, but had no luck.
    All help is appreciated.
    Many thanks in advance.

    you can always use an array if there's no pattern to your positions:
    var positionA:Array=[ [100,20], [2,222], [55,2], [201,111], [78,23] ];
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import com.adobe.serialization.json.JSON;
    var loader:URLLoader = new URLLoader(new URLRequest("https://api.twitter.com/1/statuses/user_timeline.json?screen_name=ScottMitchell"));
    loader.addEventListener(Event.COMPLETE, loadComplete);
    function loadComplete(e:Event):void {
        processData(e.target.data);
    function processData(data:String):void {
        var tweets:Array = JSON.decode(data) as Array;
    for(var i:int=0;i<5;i++){
    var tf:TextField=new TextField();
    addChild(tf);
    tf.multiline=true;
    tf.width=300;
    tf.text =   tweets[i].text;
    tf.autoSize="left";
    tf.x=positionA[i][0];
    tf.y=positionA[i][1];
    nextY+=tf.height;

  • Display current username in a text field

    Hi I have done an application where a particular user can log an issue. I want to display the user bane in a text field so that when i click save the issue is saved along with my other details.
    My question is how do i display my user name in my form?

    yes i have already tried that but it doesnt work. The thing is i have a text field and i'm trying to display it in the text field. Is that the right way to do it? and where do i insert that code

  • Embed Fonts in Dynamic Text Fields

    Hey, I am relatively new around here although I've been a
    member for years. I am just now starting to utilize my account. I
    do have a question in regards to embedding fonts in Flash 8. I have
    read up on this numerous places and haven't been able to find a
    solution that works for me, whether this my user error or not is
    still TBD.
    I am loading text from a XML document into Flash dynamic text
    fields. I need to be using a handwritting font for these text
    fields. After embedding the handwritten font they are not
    displaying in my dynamic fields but are displaying in my static
    text fields that am I also using on the site. I am controlling my
    dynamic text fields w/ an external stylesheet. I believe I must do
    something "additional" for these dynamic text fields but haven't
    figured out what that is, any help anyone can offer is much
    appreciated! Thanks.

    floateronline wrote:
    > Hey, I am relatively new around here although I've been
    a member for years. I
    > am just now starting to utilize my account. I do have a
    question in regards to
    > embedding fonts in Flash 8. I have read up on this
    numerous places and haven't
    > been able to find a solution that works for me, whether
    this my user error or
    > not is still TBD.
    >
    > I am loading text from a XML document into Flash dynamic
    text fields. I need
    > to be using a handwritting font for these text fields.
    After embedding the
    > handwritten font they are not displaying in my dynamic
    fields but are
    > displaying in my static text fields that am I also using
    on the site. I am
    > controlling my dynamic text fields w/ an external
    stylesheet. I believe I must
    > do something "additional" for these dynamic text fields
    but haven't figured out
    > what that is, any help anyone can offer is much
    appreciated! Thanks.
    the question is a bit too general. There are many ways to
    approach it, from copies
    of text fields with that font off stage, to embedded outlines
    and linkage in the library.
    My guess is that somewhere on the way you did not fully
    complete the outline embed options.
    Either done incorrectly or you miss some action.
    Mind to post detail explanation how you embed the outlines?
    Best if you post an example
    file for us to check.
    Best Regards
    Urami
    "Never play Leap-Frog with a Unicorn."
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Wrap a single word in a text field

    Hello everyone!
    I currently have a problem with text data that is displayed in a Flex text field <mx:Text>.
    It's a narrow textfield (100px wide) in a animated ad banner that displays content from a database. There are some words that are too long for the available space, so flash wraps some letters to the next line. I have attached a screenshot that shows the actual problem.
    The text is shown in a Java web-application as well, and since that Java app is displayed as a normale webpage, there is a lot more space for the text. I cannot put hyphens into the text because it would look weird in the normal web view.
    Is there a way to make automatic hyphenation happening when Flash wraps a single word?
    It would be perfect to get language-specific correct hyphenation, but a hyphen at the wrong spot is still better than no hyphen at all.
    Thanks for your time and help!

    I think your simplest bet would be to use mx:label and use the op
    tion truncateToFit="true". Also adjust the width so that the text appears prope
    rly. Hope this helps..!!

  • Adding user-defined number of text fields.

    Okay I am having problems, obviously. I am developing a program where the user will enter X and Y values and the program will calculate the relational data. However, I can't even get a start.
    First of all, the user defines the number of pairs of points they want to define. For example, they have 20 points, each with its own X and Y, so they click on 20 and then okay in the first window.
    The next window will then take their answer and display X and Y text fields for as many points as they defined. However, I can't figure out any way to do this.
    Feel free to run the program, the problem lies in the method setTextFields(). Help please!
    import javax.swing.*;               //FOR SWING COMPONENT CLASSES
    import java.awt.*;                  //FOR CONTAINER CLASS
    import java.awt.event.*;            //FOR EVENT HANDLING
    public class RegressInput extends JFrame
        private JComboBox listJComboBox;        //COMBO BOX TO HOLD HOW MANY PAIRS OF DATA POINTS THE USER HAS TO ENTER
        private JButton answerButton;           //BUTTON TO CLICK AFTER SELECTING PAIRS OF DATA POINTS
        private JPanel textFieldTopPanel;       //TEXT FIELD TOP PANEL
        private JPanel textFieldBottomPanel;    //TEXT FIELD BOTTOM PANEL
        private JPanel textFieldPanel;           //TEXT FIELD PANEL   
        private CardLayout cardSelector;        //DECLARE CARD LAYOUT OBJECT   
        private JPanel cardDeck;                //DECLARE CARD PANEL OBJECT
        public RegressInput(String title)
            super(title);               //CALL SUPERCLASS CONSTRUCTOR
            //CREATE A CONTAINER
            Container container = getContentPane();
            //INSTANTIATE CARD LAYOUT OBJECT
            cardSelector = new CardLayout();
            //INSTANTIATE PANEL OBJECT
            cardDeck = new JPanel();
            //SET LAYOUT OF CARD DECK PANEL TO CARD LAYOUT
            cardDeck.setLayout(cardSelector);
            //DEFINE LABEL FOR FIRST CARD
            Label question = new Label("How many PAIRS of data would you like to enter?");
            //BUTTON TO SUBMIT NUMBER OF POINTS TO PLOT
            answerButton = new JButton("OK");
            listJComboBox = new JComboBox( getArray() );//USE getArray() METHOD TO SET ITEM LIST OF THE COMBO BOX
            listJComboBox.setMaximumRowCount(10);       //SETS THE VISIBLE NUMBER OF ITEMS TO THE USER
            Label xValues = new Label("X Values");      //LABEL FOR X values
            Label yValues = new Label("Y Values");      //LABEL FOR Y values
            //BUILD CARD DECK
            JPanel comboBoxCard = new JPanel();     //CREATE FIRST CARD
            comboBoxCard.add(question);             //ADD question LABEL TO FIRST CARD
            comboBoxCard.add(listJComboBox);        //ADD listJComboBox TO FIRST CARD
            comboBoxCard.add(answerButton);         //ADD answerButton TO FIRST CARD
            textFieldTopPanel = new JPanel();       //CREATE TOP PANEL OF SECOND CARD
            textFieldTopPanel.add(xValues);         //ADD xValues Label TO SECOND CARD
            textFieldTopPanel.add(yValues);         //ADD yValues Label TO SECOND CARD
            textFieldBottomPanel = new JPanel();    //CREATE BOTTOM PANEL OF SECOND CARD
            textFieldBottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));    //SET LAYOUT FOR BOTTOM PANEL
            textFieldPanel = new JPanel();          //CREATE PANEL FOR SECOND CARD
            textFieldPanel.setLayout(new BorderLayout(10, 10)); //SET LAYOUT FOR SECOND CARD
            textFieldPanel.add(textFieldTopPanel, "North"); //ADD textFieldTopPanel TO NORTH
            textFieldPanel.add(textFieldBottomPanel, "South");  //ADD textFieldBottomPanel TO SOUTH
            cardDeck.add(comboBoxCard, "Step 1");       //ADD FIRST CARD TO DECK
            cardDeck.add(textFieldPanel, "Step 2");     //ADD SECOND CARD TO DECK
            container.add(cardDeck);                    //ADD CARD DECK TO CONTAINER
            //DEFINE BUTTON HANDLER OBJECT
            ButtonHandler buttonHandler = new ButtonHandler();
            //ADD ACTION LISTENER FOR BUTTONS
            answerButton.addActionListener(new ButtonHandler());
        }//END RegressInput() CONSTRUCTOR
        //METHOD TO CREATE AND RETURN AN ARRAY OF VALUES FOR JComboBox
        private String[] getArray()
            //CREATE ARRAY TO HOLD 30 VALUES
            int numbers[] = new int[29];
            //CREATE int IN ORDER TO START THE ARRAY AT 2 INSTEAD OF 1
            int number = 2;
            //ASSIGN VALUES FROM 2 TO 30 TO numbers[] ARRAY
            for(int count=0; count < 29; ++count)
                numbers[count] = number;        //SETS EACH INDEX TO number
                number++;                       //INCREMENTS number
            }//END for LOOP
            //CREATE pairs[] ARRAY TO HOLD 30 STRINGS
            String pairs[] = new String[29];
            //ASSIGN VALUES 1 TO 30 IN STRING ARRAY FOR COMBO BOX
            for(int count = 0; count < 29; ++count)
                pairs[count] = "" + numbers[count];
            }//END for LOOP
            return pairs;//RETURNS pairs[] ARRAY FOR THE LIST ITEMS IN listJComboBox
        }//END getArray() METHOD8
        //RETURNS THE ITEM SELECTED BY THE USER FROM THE JComboBox
        private int getValue()
            //ASSIGNS STRING VALUE OF THE JComboBox TO A WRAPPER
            Integer v = new Integer((String) listJComboBox.getSelectedItem());
            //ASSIGNS WRAPPER VALUE TO int
            int value = v.intValue();
            //RETURN VALUE OF SELECTED ITEM
            return value;
        }//END getValue()
        private void setTextFields()
        {//HERE LIES THE PROBLEM! WHAT GOES IN THIS METHOD????
            for(int count = 0; count < (2 * getValue()); ++count)
        }//END setTextFields()
        //BUTTON EVENT HANDLER CLASS
        private class ButtonHandler implements ActionListener
         //PROCESS EVENT
            public void actionPerformed(ActionEvent e)
                //WHICH BUTTON CAUSED THE EVENT?
                if(e.getSource() == answerButton)
                    cardSelector.last(cardDeck);
                    cardDeck.setSize(600,600);
                }//END if STATEMENT
            }//END actionPerformed()
        }//END ButtonHandler CLASS
    }//END RegressInput CLASSHere is main:
    import javax.swing.JFrame;
    public class TestSharpStats
         public static void main(String[] args)
            //DEFINE FRAME OBJECT
            RegressInput window = new RegressInput("Hi");     //SETS TITLE BAR
            window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      //CLOSES WINDOW
            window.setSize(400, 600);    //SET FRAME SIZE
            window.setResizable(true);  //PREVENTS USER FROM RESIZING WINDOW
            window.setVisible(true);     //SETS window TO VISIBLE
        }//END main()
    }//END TestSharpStats CLASS

    muit-post: http://forum.java.sun.com/thread.jspa?messageID=4442652

  • HTML tags in TLF (slice to 2 text fields)

    i create on stage TLF and i slice to 2 text fields
    i put text to TLF in actions tText.htmlText = "Some text...."
    if text is too much, text from 1 text field is not displayed
    in 2 text field. All is displayed only in 1 text field
    if i add text from tText.text is displayed in 1 and 2 text field.
    how to make to text with html tags displayed in 1 and 2 text field?

    This looks to me like a bug in TLFTextField. I'll report this bug to the Flash Authoring team.
    You could use this as a workaround - find all of the containers that should be attached to the flow, set htmlText then reattach the containers (past the first):
    var controllerArray:Array = new Array()
    for (var i:int = 0; i < myText.textFlow.flowComposer.numControllers; i++)
         controllerArray[i] = myText.textFlow.flowComposer.getControllerAt(i);
    myText.htmlText = "some text that should be flowing into the other containers";
    for (i = 1; i < controllerArray.length; i++)
         myText.textFlow.flowComposer.addController (controllerArray[i]);
    myText.textFlow.flowComposer.updateAllControllers();

Maybe you are looking for