Add the symbol to the stage based on string of symbols

Hello

I am the string to add a symbol on the stage based on a string value in an existing symbol which is on the stage. I get no error when the game turns, but the symbol just reproduce on stage. I have no idea why

This is the code:

Variables used

var score: int = 0

var startX:int = stage.stageWidth = 920

var startY: int = stage.stageWidth = 475

Check to see if the "partition" amounts to 350 in ScoreBoardDisplay.txtScore.text

If (ScoreBoardDisplay.txtScore.Text == String (350))

{

var HD1 = new HealthDrop();

HD1.x = stage.stageWidth = startX

HD1.y = stage.stageHeight = startY

stage.addChild (HD1);

HealthDrops.push (HD1)

}

Assuming you do not penetrate into this framework, when you check the score, but are always there, or at least hang out for a while, the problem is that the conditional code that you show only will run once, immediately entering into this framework.  He is not sitting it monitor any changes in the value of the text field.  You must specify the code to run.

In this case what you could do is to place this code in a function that runs whenever the textfield value is changed.

This code that you have to change the value of the TextField?

Tags: Adobe Animate

Similar Questions

  • Tracing a clips on the stage, based on XML

    Hi all
    I'm having a problem drawing a clip with AS2 on the stage based on XML. I think her looping thought the XML, but for some reason any its not draw all the clips on the timeline...

    So what I'm trying to do, is to trace a clip online based on its < note_position > and < note_height >, which he does very well. But its not trace all nodes < note >... trace 2 clips of < comment > < line tNom = "Name 1" color = "0 x 336633" > then it trace clips < note > 1 < line tNom = "Name 2" color = "0 x 333366" > then he traces 2 clips of < comment > < line tNom = "Name 3" color = '0 x 663366' >

    what he must do, is to trace all the clips of < comment > < line tNom = "Name 1" color = "0 x 336633" > then draw all the clips of < comment > < line tNom = "Name 2" color = "0 x 333366" > and last but not least draw all clips from < comment > < line tNom = "Name 3" color = '0 x 663366' >...

    So all in all it does is plotted 5 < note > clips in total instead of the 10 < note > clips must be traced on the stage...

    OK well I think I'm going to loos, my mind... Is more, I think that it is thought looping the XML that is the problem. I think that its so be it I enclose the clip of the plot or something I don't see thought the fog...

    Any ideas? Ive been battaling this for two days and I am at a total loss... so any help would be greatly apprecated.

    I thank in advance
    Scott: eek:

    OK, I got this work here is my fix...

    function attachXMLNodes () {}
    Attach the clip and insert my data
    var newPlot = attachMovie ("plot", "plot" + h + "" + i, this.getNextHighestDepth ());
    duplicateMovieClip ("plot", "plot" + i, depth);
    Assign the values...
    This ["conspiracy" + h + "" + i].entry_clip.entry_date = "" + entry_date + ""; "
    Finally, set the position
    This ['plot' + h + ' ' + i] ._y = 685;
    This ['plot' + h + ' ' + i] ._x = number (entry_pos).

    }

  • Why ColdFusion adds the backslashes to my string concatenated?

    Well, serializeJSON isn't enough create JSON for me to use with jQuery.

    So I decided to build it myself.

    Here is my code:

    <cffunction name="getActions" output="false" access="remote" returnformat="JSON">
        <cfquery name="Actions">
          SELECT * FROM Actions
        </cfquery>
        <cfset ActionsList = '{"success" : "true"}, {"Actions" : ['>
        <cfloop query="Actions">
          <cfset ActionsList = ActionsList & '{ "ID" : "' & ID & '", "Name" : "' & Name & '"},'>
        </cfloop>
        <cfset ActionsList = ActionsList & ']}'>
        <cfreturn ActionsList>
      </cffunction>
    

    So basically I send an asynchronous call AJAX with jQuery to the cfc that contains this code.

    jQuery told me that the JSON was bad.

    So I pulled out what Coldfusion has been sending to the browser.

    "{\"success\":\"true\"},{\"Actions\":[{\"ID\":\"1\",\"Name\":\"View Public\"},{\"ID\":\"2\",\"Name\":\"View Full\"},{\"ID\":\"3\",\"Name\":\"Create Page\"},
    {\"ID\":\"4\",\"Name\":\"Create Part\"},{\"ID\":\"5\",\"Name\":\"Create Section\"},{\"ID\":\"6\",\"Name\":\"Create Question\"},{\"ID\":\"7\",\"Name\":\"Create Table\"},
    {\"ID\":\"8\",\"Name\":\"Assign Pages to Location\"},{\"ID\":\"9\",\"Name\":\"Input Data\"},{\"ID\":\"10\",\"Name\":\"Edit Page\"},{\"ID\":\"11\",\"Name\":\"Edit Part\"},
    {\"ID\":\"12\",\"Name\":\"Edit Section\"},{\"ID\":\"13\",\"Name\":\"Edit Question\"},{\"ID\":\"14\",\"Name\":\"Edit Table\"},
    {\"ID\":\"15\",\"Name\":\"Assign Pages to Location Type\"},{\"ID\":\"16\",\"Name\":\"Add Location\"},{\"ID\":\"17\",\"Name\":\"Add Location Type\"},
    {\"ID\":\"18\",\"Name\":\"Change Location\"},{\"ID\":\"19\",\"Name\":\"Assign Location Designee\"},{\"ID\":\"20\",\"Name\":\"Assign District Designee\"},
    {\"ID\":\"21\",\"Name\":\"Update User Information\"},{\"ID\":\"22\",\"Name\":\"Add User Type\"},{\"ID\":\"23\",\"Name\":\"Manage Permissions\"},]}\""
    

    Why coldfusion adds a bar backslash before each quotation mark?

    I built the exact way of sam JSON in another function, and it worked fine.

    The only difference between this function and this one is that it has a loop.

    I've been at this for hours... what Miss me?

    and replace(ActionsList,"\","","ALL")

    does not help...

    You're not perform a JSStringFormat() on that anywhere, are you?  (maybe in the code not released).  JSStringFormat() assumes that the text passed to it is a literal string, and then he escaped values in quotes (as we see here)

    In addition, on either said by the way, your JSON data is not valid, no?

    Your loop will update the list of actions with a table, but it always takes into account there is another index of values, so it did precede the comma.  {[{You can even see in the final version of your data table ends with a '...},]}' you may need to make a conditional test to see if the loop is at its max index and if not, then add the comma.

  • Add the parameter to hardcoded string to decode function

    I have a query something like this:

    Select...
    ..............
    decode ((select bill_sequence_id
    of bom_structures_b one
    where a.assembly_item_id = POL. ITEM_ID
    and a.organization_id = FSP.INVENTORY_ORGANIZATION_ID
    and a.alternate_bom_designator is null
    and msi.bom_enabled_flag = 'Y'
    ), null, null, 'test_url | a.bill_sequence_id) "Destination".
    Of...
    where the...

    I want to add the value of the column that I looked at the end of "test_url.
    If I decode (..., null, null, 'test_url' | 222222222) it worked, but when I give bill_sequence_id or a.bill_sequence_id, he cries for invalid identifier.

    Please help.
    Thank you

    Hello

    Let me make sure I understand the problem.
    You want to return a value like

    'Today is = ' || x
    

    where x is a complex expression. But if x is NULL, you don't want to not return 'is now', you want to return null.
    What is the problem?

    Here's how you can do this without repeating x:

    NULLIF ( 'Today is = ' || x
           , 'Today is = '
           )
    

    A more general solution is to calculate the value in a subquery. In the Super request, you can see him as often you simply by using the alias that you gave in the subquery, like this:

    WITH    got_inner_select     AS
    (
         select a.dummy,
                (  select  b.dummy
                       from       dual       b
                where       a.dummy = b.dummy
                )  AS inner_select
         from   dual  a
    )
    SELECT     dummy
         DECODE ( inner_select
                , null     , null
                           , 'Today is = ' || inner_select
               )
    FROM     got_inner_select
    ;
    
  • Display a series of images on the stage based on the value of a variable

    Hi all

    Here's another interesting problem! Well, I have an interactive retention test which is charge of an xml file based on the value of a variable scenario (for example, if script = Architecture, then load Q_set 1, if scenario = history then load something else). Now, I would like to extent this and display a series of images on my stage which will be valid only in the current scenario. Here is my code so far. I thought load a list of images on the beginning of the film (for example, Architecture_list, History_list) and then call them according to the value of the variable of scenario, but I would like to hear what you have to say. Any ideas?

    The answer is a series of managers: one called at the beginning of the movie to fill the lists of the appropriate folders (based on the value of the variable gimage) and the other called next and previous. Here they are in case yu need:

    ---------
    Global gFileList, gImagePath, gimages

    on buildList

    gFileList =]

    -defining the path to images:

    gImagePath = "@images /" & gimages & ' / ' "»

    Repeat with i = 1 to the maxinteger
    thisFile = getNthFileNameInFolder (gImagePath, i)
    If thisFile = EMPTY then exit
    If thisFile = the movie then the next repetition
    types of files = [".pct", ".jpg", ".bmp", ".gif"]
    howManyTypes = count (fileTypes)
    Repeat with thisType = 1 to howManyTypes
    extension = getAt (file types, if thisType)
    If thisFile contains extension then
    gFileList.append (thisFile)
    end if
    end repeat
    end repeat

    Member ("Display"). FileName = gImagePath & gFileList [1] - put the first image in the folder at the appropriate place

    Member ("Display"). Picture = .photo member ("display")

    buildList end

    --------------------
    Global gFileList, gFileIndex, gImagePath

    on nextFile

    gFileIndex = gFileIndex + 1

    If gFileIndex > count (gFileList) then

    whichFile = gFileList [1] - set the image = in the last loaded picture holder
    gFileIndex = 1 - the value of the index to the last trick question

    Member ("Display"). FileName = gImagePath & whichFile
    Member ("Display"). Picture = .photo member ("display")
    updateStage

    -go to the audio issues

    _movie. GB (31)

    on the other

    whichFile = gFileList.getAt (gFileIndex)

    Member ("Display"). FileName = gImagePath & whichFile

    Member ("Display"). Picture = .photo member ("display")

    updateStage
    end if

    end

    Global gFileList, gFileIndex, gImagePath
    -----------------------------------------------------------
    the backfile

    gFileIndex = gFileIndex - 1

    If gFileIndex = 1 then

    whichFile = gFileList [1]
    Member ("Display"). FileName = gImagePath & whichFile
    Member ("Display"). Picture = .photo member ("display")
    updateStage
    Sprite (17) TRUE = FALSE - disable the "back" button

    -gFileIndex = count (gFileList)
    end if

    If gFileIndex > 1 then

    whichFile = gFileList.getAt (gFileIndex)

    Member ("Display"). FileName = gImagePath & whichFile
    Member ("Display"). Picture = .photo member ("display")
    updateStage
    end if
    end

  • How to add a symbol at the beginning of a project?

    I have a pretty complex Animate composition.  I want to add a simple symbol/Animation at the beginning.  I tried to insert time and it did nothing.  Basically, I want to just move everything with a couple of images.  I thought to transform the balance of the composition into a symbol, but a lot of interactivity is based on the labels on the main timeline of the scene, and it breaks when I try to convert it to a symbol.  I don't know what I'm missing here?  Any help would be really appreciated!

    Thank you!

    Jon

    If you select everything on the timeline you can transfer all right. Make sure everything is orange in the mounting area before moving it. You can then add your symbol at the beginning. You may have to disable everything you just move a 0 and then when you want the rest to appear.

  • Find the number of symbols on the stage

    Hello

    I'm trying to find out how much of symbols with a certain naming convention is on the scene. The name of these symbols are incremented by 1, if for example I have symbols "drag_1" & "drag_2" currently on the stage and I want to go back to how many symbols "drag_" is on the scene. This can change depending on how much of these symbols that the user adds to the scene.

    I have included some pseudo-code below to help understand what I'm talking about!

    for (var i = 0; i < 100; i ++) {}

    If (SYMBOL_ON_STAGE = "drag_" + i) {}

    number_of_symbols = number_of_symbols + 1

    }

    }

    Thanks for any help!

    You can use

    var childSymbols = sym.getChildSymbols ();

    var num = 0

    for (var i = 0; i)<>

    var reg = new RegExp(/Stage_drag_*/);

    {if (Reg.test (childSymbols [i] .getSymbolElementNode (USER.USER)))}

    NUM ++;

    }

    }

    Alert (num);

  • How to add the symbol "%" in custom number Format obiee11g

    Hi all

    We can see the measure Null or empty as '-' using custom digital Format for numeric column no problems, the same logic that we must apply the measure column % too, how do I add the "%" symbol in the measurement column % custom digital, if anyone has the solution please share with us. Thank you

    under replace null as "-" works very well but we are unable to add the "%" symbol

    Table of edge/strike '-' so you can enter:

    #, ## 0.0 ;-#, ## 0.0 ;-

    Reference:

    http://www.clearpeaks.com/blog/Oracle-BI-EE-11g/setting-custom-data-format-in-OBIEE-answers

    http://total-bi.com/2010/10/replace-nulls-in-OBIEE-pivot-table/

    Thank you

    Deva

    Hello

    Fixed a problem.

    Solution:

    #,##0.0%;-#,##0.0%;-

    Thank you

    Deva

  • How can we add a text field on the stage, but without the text label?

    How can we add a text field on stage, but without the left text label by default?  I want just the field.

    I thought about it.  Go to the page layout palette and change the options of caption for the text box.

  • Call a function on the stage of the symbol that is nested in a symbol

    Scenario of

    creation of complete scene

    stage = sym.getComposition () .getStage ();

    SYM.func_btn1 = function() {}

    code

    }

    symbol btn_1

    stage.func_btn1 ();

    It works well

    symbol Index

    symbol btn_1

    stage.func_btn1 ();

    No chance to fire service

    Where is my mistake?

    I write a little different functions, but I tested my way and it works.

    Create functions in compositionReady like that

    SYM. Test = function() {}

    SYM.$("element"). Hide();

    }

    When this function is run it will hide the element on the stage, called 'Element '.

    You can call this function in compositonReady leave a nested using this line symbol

    sym.getComposition () .getStage (). Test();

    I have install a sample project I hope it helps.

    http://www.mediafire.com/download/wv8k19pzqdg9b31/NestedSymbolFunction.zip

  • Is there a widget or a button that will add the symbol, for example, a copyright symbol?

    I need to add a symbol of my footer copyright.  Is there a button or widget in MUSE that can do this?  If this isn't the case, muse will convert the ascii code?

    Hello

    You can add the copyright symbol using HTML code:

    (1) open the page in design view

    (2) in the menu item, select "insert HTML code.

    (3) type:

    ©

    4) click OK

    It may be useful

    Sonam

  • How to add background images to the stage?

    I use the last version (2014.1.1)

    I want to add a photo to be a background image in the stadium.

    So I do:

    1. Add 'compositionReady' to the stage

    (2 key - in: sym.$("Stage").css("background-image","url(images/bg.png)"); "

    but I can't see the picture and to develop tools, the tag had background-image.

    How to solve the problem?

    You are missing quotes in your code.

    SYM.$("stage"). CSS({"background-image":"URL('images/BG.png')"});)

    or

    SYM.$("stage"). CSS ("background-image", "URL('images/BG.png')");

  • JSON content - click here to see another symbol on the stage

    Hello

    Thanks Zaxist, I have a code of work similar to that below:

    $.getJSON ("content.json",

    {function (Data)}

    for (var i = 0; i < data.length; i ++) {}

    var s = sym.createChildSymbol ('template', 'content');

    s.$("title").html (Data [i] .title);

    s.$("description").html (Data [i]. Description);

    s.$("Seira").html (Data [i]. Seira);

    s. $("imageholder") .css ({'background-image': "url ('" + data [i].) "}) (image_+_«_'_»)});

    .data s. $("imageholder") ("Great", data [i] .largeimage);

    s.. Click$ ("imageholder") ("click", Function {}

    sym.getComposition () .getStage ().$("finte").css ({'background-image': ' url ("+ .data ('l arge') $ (this) + ') '});

    });

    }

    });

    Now, I'm trying on the click function to show the display symbols on the stage, for example during the click on the first point, the red symbol will appear, so cliked the second element of the (previous symbols which appeared will be hidden) and the new blue symbol will appear. So on with all the other ellements with JSON files.

    I tried this on the code, but nothing:

    $.getJSON ("content.json",

    {function (Data)}

    for (var i = 0; i < data.length; i ++) {}

    var s = sym.createChildSymbol ('template', 'content');

    s.$("title").html (Data [i] .title);

    s.$("description").html (Data [i]. Description);

    s.$("Seira").html (Data [i]. Seira);

    s. $("imageholder") .css ({'background-image': "url ('" + data [i].) "}) (image_+_«_'_»)});

    .data s. $("imageholder") ("Great", data [i] .largeimage);

    s.. Click$ ("imageholder") ("click", Function {}

    sym.getComposition () .getStage ().$("finte").css ({'background-image': ' url ("+ .data ('l arge') $ (this) + ') '});

    If (data [i] = 3) {}

    sym.getComposition () .getStage ().$("red").show ();

    }

    else {}

    sym.getComposition () .getStage ().$("red").hide ();

    }

    If (data [i] = 5) {}

    sym.getComposition () .getStage ().$("blue").show ();

    }

    else {}

    sym.getComposition () .getStage ().$("blue").hide ();

    }

    });

    }

    });

    Could you help me?

    Thanks in advance!

    Well, if I have understood correctly, you want to check your image index, and the index was 3 or 5 show you a symbol appropriate for this...

    I want to tell you something before I tell you how you can do this:

    data [i] is your index of json files that return data from your json file not a number, and if your json file is something like this:

    [

    {"image": "images/toy - B.jpg",}

    "title": "1st Image."

    'Names': 'toy-B '.

    }

    ]

    (I'm looking for purpose of json that have index 0) means of data [0]

    Well in this address, we have an object, but no data! because it has not itself data say witch we want, so it just return a data unreadable (just object), so if we say

    Image Data [0] (now we have image data and this will return us Images/toy - B.jpg )

    so we cannot simply say that [i] data

    you need to do this way:

    .data s. $("imageholder") ("Great", data [i] .largeimage);

    s. $("imageholder") .data ('myIndex', i); We need another variable to save our index

    s.. Click$ ("imageholder") ("click", Function {}

    sym.getComposition () .getStage ().$("finte").css ({'background-image': "u rl (" + $(this).data('Large') + ")"});

    If ($(this) .data ("myIndex") == 3) {/ / read value right and check}

    sym.getComposi () .getStage ().$("blue").hide () ing;

    sym.getComposition () .getStage ().$("red").show ();

    }

    ElseIf ($(this) .data ("myIndex") == 5) {}

    sym.getComposi () .getStage ().$("red").hide () ing;

    sym.getComposition () .getStage ().$("blue").show ();

    }

    });

    }

    });

    also, you wrote your statement if and else in an improper way, learn the right way at the top for future use

    If you have any question do not hesitate to ask

    Zaxist



  • Dynamically set the order of the symbols on the stage?

    Is it possible to change the order of the symbols on the stage dynamically via the coding?

    While clicking on a button would be a symbol on the back?

    The reason why I ask is because even if one of my symbols is set to invisible, it still hinders my ability to click on the buttons that are technically below.

    Any help would be appreciated.

    Thank you

    You can use the z-index with this basic format:

    SYM. $('NomSymbole') .css ({' z-index': 100 '});

  • How to read a label on the stage of in a symbol

    Hi Edgefriends,

    I'm working on a side project lead, but I have zero experience with JavaScript and I can't seem to get this to work without him so I hope someone can help me to achieve this.

    Below you see the code that I need help. It is part of a symbol on the stage. What I need to do is to play a label ("subFontsTitels") located on the level of the stage. I tried a lot of posibilities but without (good) results. Could you please help me?

    Part of the code:

    Symbol.bindElementAction (compId, NomSymbole, "${_Button} ', 'click', function (sym, e) {})

    read the chronology of the given position (ms or label)

    sym.getComposition () .getStage ().sym.play ('subFontsTitels');

    Insert the code for the mouse, click here

    });

    End of binding edge

    Hi, Rangata01-

    You're close enough.  Tell him in your symbol:

    useful only if your symbol is a level down

    sym.getParentSymbol () ("myLabel") .play;

    can be used any level

    sym.getComposition () .getStage () ("myLabel") .play;

    Hope that helps,

    -Elaine

Maybe you are looking for

  • Danish in the free sim card iPhone 6 or 6 s?

    Hi, I am currently here in America exchange student, and I need a new phone, so I am considering getting an iPhone 6s, but I would if I could still use it when I return to the Denmark. So I was wondering if eny body could tell me with certainty that

  • HP PAVILION 15-p010sr: replace stock to IPS 15.6 inch screen

    Hello! I have the stock display in my model 15.6 inches. I can replace it on some larger IPS overview screen. And if you can, give me link in the store on screen Thank you and sorry for the bad English.

  • How to unlock recovery?

    How to unlock recovery?

  • Adding 2nd SSD precision 7510 m2

    I just bought a laptop from precision 7510.  I ordered it with the following main and any secondary drive: 400 AILW 256Go M.2 PCIe High Performance Solid State Drive, MPWS I would like to add a second drive of NVMe m2 (maybe a Samsung 950 Pro) into t

  • The sidebar menus

    Someone at - it an example of how to replicate the side menu in the following link? http://docs.BlackBerry.com/en/developers/deliverables/41577/menus.jsp Thanks in advance.