Dynamic text variable

I have a dynamic text box call "color.txt" at the root and
two Movie clip buttons one called Red and one called Yellow.
When I press the button the name of the button is passed to
the text box. When I press the second button the
name is not replaced. Do I have to create a seperate function
to do this or is there another way?
Thanks,
_root.red.onPress = function(){
_root.colorTxt.text = "Red";
_root.yellow.onPress = function(){
_root.colorTxt.text = "Yellow";
}

I got it working like this.
var colors:Array = ["red", "yellow"];
var currentColor:Number;
function changeButton(newColor:Number) {
currentColor = newColor;
_root.colorTxt.text = updateText();
_root.red.onPress = function(){
changeButton(0);
_root.yellow.onPress = function(){
changeButton(1);
function updateText():String {
var newText:String;
newText = colors[currentColor];
return newText;
}

Similar Messages

  • Iterate through all dynamic text variables

    Hello,
    I'd like to be able to iterate through all of the dynamic
    text variables in my flash movie, and I'd like it so that if I add
    new text to this movie, it will show up in the iteration.
    Essentially, I want to do something like this:
    for (i in _root) {
    trace(i);
    While this seems to print out all the variables in root, it
    prints more than just the dynamic text variables, and also doesn't
    iterate down through various objects to find the dynamic text
    variable.
    Is there any way I can accomplish this in action script?
    Thanks!

    Great! That code helps me a lot.
    There are still two weird issues.
    1) the test for tl[obj].text seems to always turn out to be
    false. However, if I trace the value of text, I'll see the text.
    Example:
    trace(tl[obj].text); // This will display the value in the
    text field
    if (tl[obj].text) // This is always returning false.
    Any ideas?
    The 2nd issue might be more difficult - some of my text
    objects don't appear until later in the movie (i.e. frame 10). It
    sort of looks like this looping doesn't see objects that appear in
    the future. Do I need to advance the frame 1 by 1 and repeat this
    looping process until the text appears? Maybe instead I can always
    have the text in the first frame, but have it be invisible or
    something?

  • Dynamic Texts from Bex ( for Key Figures ) not coming to WEBI Query

    Hi Gurus,
    We have a Query in BEx : Each  Key figure column text changes dynamically - Like based on Present month
    it will Display Month +1 Month +2  up to Month +12.  Used  dynamic Text variables .
    But when i created the universe and Webi report , i am missing the text in the column for Key figures .
    How should i get the column text in Webi which is same as in Bex : Points will be awarded for helpful
    answers.
    Thanks
    Magge

    Hi,
    text variables with replacement path are supported in BO4.0, see following document: SAP BusinessObjects BI4 - Supported BEx Query Elements
    As an example after entering 2012 in the prompts window, the name of the corresponding key figure will dynamically change:
    After refreshing and selecting 2013, the column name will update:
    Im not sure though if this is the case with unv universe access to BEx queries.
    Best regards,
    Victor

  • Targeting Dynamic Text Box inside moviecip with variable

    Hi,
    How does one target a dynamic text box to change the border
    color inside of a movie clip? Example below which does not work
    theName = ("answerPrint" + arryCount);
    boxName = ("box" + (arryCount+1));
    _root.pagePrintPartA[theName][boxName].border = true;
    _root.pagePrintPartA[theName][boxName].borderColor =
    0x00cc66;

    Thanks for the reinforcement, but I should of indicated what
    was what:
    theName = ("answerPrint" + arryCount);// Name of Variable
    inside Dynamic Text Box Inside MovieClip
    boxName = ("box" + (arryCount+1));// Instance Name of Actual
    Dynamic Text Box Inside MovieClip
    _root.pagePrintPartA[theName][boxName].border = true;
    _root.pagePrintPartA[theName][boxName].borderColor =
    0xFF0000;
    By certifying this script you showed me wher I went wron (not
    seeing the forest from the trees). The last two lines should be:
    _root.pagePrintPartA[boxName].border = true;
    _root.pagePrintPartA[boxName].borderColor = 0xFF0000;
    I was targeting backwards. Thanks alot DazFaz.

  • How can i set the dynamic text box to show variable value?

    In AS2, I can make a dynamic text box set a var name, when i
    use button set/change the var value, this textbox can show the
    value also.
    but In AS3, dynamic text box can't add var name. than how can
    i do it now?

    Set an instance name for the dynamic textfield. Then, to
    populate the textfield with the value of a variable, use:
    textFieldInstanceName.text = variableName

  • Create a Link using Dynamic Text and Capture Variable

    I am building a dynamic website using Dreamweaver CS5 with Coldfusion 9
    Currently I have created a dynamic text table. The table is created by querying the Invoice table and displays the all the customers Invoices. The columns Include Invoice #, Date, Amount Paid, BalanceRemaining, Due Date. So basically lists all the invoices I have applied to the unique customer. It is pulled up using a session variable I created from the login page.
    My question is this I want to make the "Invoice #" linked so when you click on it it goes to a new page and performs a new query which retrieves infro related to that specific invoice such as Services Rendered, Service Description, Date, Price, Total. I was able to create a link to the Invoice # but I am stuck trying to figure out how to capture the Unique Invoice # and apply it to the new query. Is this possible if so how?
    Thanks for your help!

    Now keep in mind I am speaking strictly from a web and SQL standpoint as I have no experience with coldfusion.
    If you are able to create the link to the Invoice, I am perceiving this as the following:
    Invoice
    Links to
    #123
    page.php?invoice=123
    #345
    page.php?invoice=345
    If your page is setup like that then you already have the data stored in the browser request with the GET method.  In PHP the equivalent is the $_GET array.  I am assuming ColdFusion has a similar array to work with forms.  Then on your following page you obviously need to check that the visitor came from the prior page with the proper permissions to ensure that someone doesn't get the address page.php?invoice=### and just guesses through and views all invoices if they are not supposed to.  Then your query would look something like the following:
    SELECT * FROM invoice_table WHERE invoice_number = $_GET['invoice']
    Remember this in written in PHP so yours should be a similar equivalent.
    Hopefully this helps a little to get you going in the right direction.

  • Dynamic Text Box Variables

    Hi,
    At the moment im using the variable option of a dynamic text
    box to load text. The variable is loaded into the swf via an
    external htm file that has multiple variables in it (i dunno if
    that makes sense but you know how you can load in a set of
    variables from an html like eg. down below):
    Anyway, now i want to have 10 different movie clips that act
    as buttons, so that when they are clicked, they change the variable
    of the dynamic text box soo it loads a different section of text
    from the html file. I have tried the .variable property of the text
    box but still no luck. I looked at another thread else where but i
    dont understand exactly how they are changing it there. I'll copy
    in the link anyway just incase it helps or someone can explain what
    they are doing. Can anyone help me with this??
    Thanks in advance for your help
    Cheers
    Damien

    haha Oops. Heres the link to that other thread. My bad.
    http://www.flashmove.com/forum/showthread.php?t=11070

  • Dynamic text box and minus variable?

    I have a text box with dynamic text set to display p variable but when the variable goes < 0 it only displays a '-'.
    im using:
    onClipEvent (enterFrame) {
    p = my_object._x;
    How can I correct this? Also another question with 'my_object._x' it returns the x coord relative to the movie clip it is in. How do I get the position relative to the 0,0 (top left corner)?
    I've been learning Flash for 2 days so sorry if the questions sound simple. I have tried googling these.

    for the textfield question....
    I'm not too sure about that... it could be related to the width of the textfield, or maybe a maxChars setting on the textfield....not really sure sorry. Someone else may have an answer....
    for the other question...
    getRect() gives you the bounding box (without stroke width, use getBounds() if you want bounds outside the stroke width)
    try
    var geometricBounds = my_object.getRect();
    trace(geometricBounds.xMin+","+geometricBounds.yMin)

  • Using alerts with variables-"dynamic text" not working

    Hello all,
    I'm triggering an alert from a BPM, and have set the flag "dynamic text" on for the alert category associated with it. I'm doing it in a similar way to the blog 1382 by Michal:
    [/people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated|/people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated]
    The only difference is that I'm just assigning a fixed text instead of a payload element to the container element, which I've defined as simple type - string.
    However, the text of the alert doesn't show anything. I'm getting an email with just "Process <id>" as the subject and "Alert ID: <number>" in the body of the email (the same in the Alert Inbox).
    I'm starting to think that there could be something wrong in PI 7.1 which I'm using, as I've configured other alerts in scenarios without BPM without problem.
    Thanks for your suggestions!

    I've solved it using an alert from the Enterprise Services Builder (Integration Repository). It's a new feature in PI 7.1. It seems the tab "Container" in the alert category didn't exist before (that's why you don't find it in the weblogs of Michal and others) and now you have to use it.

  • Added dynamic text; How do I stop variable name from showing?

    I am creating a simple game for kids.  On the first page, I added an "input text" field for their first name.  I called the variable firstname.
    When they move to the next page, I used a "dyanamic text" field so I can call them by name on this page.  It works.  However, When I test the game, on the first page, where the firstname is input, it shows    _level0.firstname          instead of just a blank space for them to input their name.
    I know I fixed this in the past and it was something simple, but I can't remember how to do it.  I'd appreciate anyone's help!
    Thanks.

    Beginning with Flash MX (version 6), you assign the text field an instance name using the Property inspector. Although you can use the variable name method with dynamic text fields for backwards compatibility to Flash 5 and earlier versions, Macromedia doesn't recommend this, because you can't control other text field properties, or apply style sheet settings

  • Text arrays (variables) and Dynamic Text Box

    Hello everyone. I have a text file (let's call it sample.txt)
    that has numerous variables or arrays in this format:
    &info=This is some information
    &stuff=This is more stuff
    &whatever=Even more stuff again....
    Anyway, I need to load a particular variable via individual
    buttons from this same sample.txt file into a dynamic text box
    (let's call it dynText), and I am a bit lost as to how to do it.
    Please provide me a solution thank you.
    Glenn

    Thank you very much, it's greatly appreciated. It worked
    perfectly except that it does not like variables that begin with
    numbers like:
    &401_2b=401_2b
    The above doesn't work, but if I do this...
    &h401_2b=401_2b
    Everything is fine. Problem being, I am generating the
    variables via PHP and therefore cannot "change" them. Can you
    provide me with a way that ActionScript can "see" the variable that
    starts with a numeric value? Thanks for your time.
    Glenn

  • Variable won't attach correctly to dynamic text string

    mcWinScreen.songNameTxt.text = songName;
    var accuracyPercent:Number = Math.floor(((numberHit / songTotal) * 100));
    var missedMath:Number = (songTotal - numberHit);
    trace(accuracyPercent);
    trace(missedMath);
    mcWinScreen.missedTxt.text = 'Missed:  ' + missedMath;
    mcWinScreen.accTxt.text = 'Accuracy:  ' + accuracyPercent + '%';
    mcWinScreen.hitTxt.text = 'Hit:  ' + numberHit;
    The numberHit var displays fine without any problems.
    accuracyPercent & missedMath trace fine but don't display in the dynamic text field.
    Any ideas?
    John

    While assigning to the text field try casting the Number typed variables to String or use toString() method of Number class.
    I.e.
    mcWinScreen.missedTxt.text = 'Missed:  ' + String(missedMath);
    or
    mcWinScreen.missedTxt.text = 'Missed:  ' + missedMath.toString();

  • Populating text variable of type Customer Exit dynamically

    Hi,
    I have a report with 3 columns as following.
    "Current period", "Previous period" and "Previous period - 1".
    The text variable name is "ZQTR_TXT".
    My input variable name is "ZALLOC_PRD".
    If I enter 200709 as input, I want to see column headings as
    2007Q3    2007Q2    2007Q1.
    but I am getting 2007Q3 for all 3 columns though I use variable offset to -1 and -2 for other columns.
    Could you please throw some light here as I got stuck with this issue quite a long time? I am using BI 7.0 Query Designer.
    Thanks in advance,
    Hanuma

    There is another variable "ZCUST_QTD" where "ZQTD_TXT" variable is restricted by offsets.
    Input variable is "ZALLOC_PRD" ex: 200709
    I have written Customer exit for the following.
    when 'ZCUST_QTD'.
    ZCUST_QTD will be low 200707 high 200709.
    when 'ZQTD_TXT'.
    "ZQTD_TXT" is 2007Q3.
    But I want "ZQTD_TXT" to be dynamic and different for 3 columns.
    Thanks for your reply.
    Thanks,
    Hanuma

  • Putting variable text into dynamic text field

    How can I make var text input into a dynamic text field that
    appears within another timeline (movieclip) on a different
    frame?

    How can I make var text input into a dynamic text field that
    appears within another timeline (movieclip) on a different
    frame?

  • Displaying the result of a calculation in a dynamic text box

    Hi folks,
    I'm having a very minor issue here (operator error, I'm sure ). With the help of some folks here, I've created a series of calculations, and I've got that part down. Now, I just need it to show up in the movie.
    I've created the dynamic text box in Flash (CS3), but when I hit test, it won't show up.
    After all the calculations, I should have a figure that I call totalmoney. My dynamic text box is called total. The user doesn't need to hit anything for it to appear. It just appears as part of the movie.
    Here's my code:
    stop();
    var startDate:Date = new Date(2010,0,12);  // use your  startyear, startmonth, startdate in the new Date() parameters.
    var  currentDate:Date = new Date();  // assuming user's clock is correct and in your  timezone.  else use server date/time.
    var numberOfSeconds:Number =  (currentDate.getTime()-startDate.getTime())/1000;
    var interest:Number =  (numberOfSeconds*0.74356);
    var totalmoney:Number =  (interest+15,000,000);
    function displaytotal(evt:TextEvent):void {
         total.text = "totalmoney";
    Any thoughts?
    Thanks!
    Napo

    You didn't have to bury any of the calculations in the function--leaving it as you had it is better.  They could remain where they a=werew, and you'll probably find you want them outside it if you have other plans for using them.  If left inside, they only have scope inside.  In the programming world, it's good to think of functions as things that do one thing and one thing only (though it isn't often practiced that way)--it's called modular design.
    When you place an event as an argument for a function, it typically means that there is an event listener that initiates the call to the function.  If you work with buttons you'll see what I mean.  But if the plan is to create your own call to a function when you desire it as such, not have it driven by an event listener, then you don't need to pass any event to it, though you may pass some other type of variable to it if need be.
    For instance, what you have now will call the function without an argument because the function has the value built into its code....
    displaytotal();
    But you could also make the function a little more generic and set it up to recieve the value instead as an argument...
    function displaytotal(amt:Number):void {
         total.text = String(amt); // an earlier error of mine
    displaytotal(totalmoney);
    That would make your function a little more useful.  Now it could be used to display other Number variables as well.
    // my earlier error was that a textfield displays text, so you need to convert the Number value to s String.
    Hope I'm not confusing you.

Maybe you are looking for