Appending variable to instance name

Hi,
I have a very basic question. I am trying to get all the button instances to become invisible on the screen. They are named img1 to img30. I thought of using a while loop to quickly run through them. The code within img1 button is:
var i:Number = 2;
while(i<=30) {
img2._alpha = 0;
i++;
The problem is how do I append the i after img, to replace the 2? so that the code runs through img 2 to img 30. I know the answer might be simple, but I really could use some help here.
Thanks

Try:
var i:Number = 2;
while(i<=30) {
_root["img"+i]._alpha = 0;
i++;

Similar Messages

  • Adding a variable an instance name

    i have a variable that is my flash movie is retreiving (well,
    hopefully....i'm having troubles with the
    loadVariables)....anyweezer, the variable is named "id". i would
    like to add the value of this variable to then end of a text string
    and then use it as reference to an instance name.
    for example, i have movie clip with an instance name of
    TTMO110333. if the ID variable had a value of 110333, how could i
    use that in actionscript to allow me to refer to the latter part of
    the instance name with the variable?
    something to the effect of....
    on(rollOver) {
    this."TTMO"+id._visible = true;
    }

    thanks for your help, but neither solution is working for me.
    i think it may be because i'm using this in a function for a movie
    clip, to make it act as a button. i am also having problems getting
    getURL() to open a blank page inside a function for a movie clip
    like this as well. is there something i need to do differently if
    i'm trying to apply this to a movie clip? here's my AS....
    this.loadVariables("linkCCdisplay.php","POST"); //this gets 3
    variables: url1, title1, and id1
    TTbutton1.onRelease = function() {
    TTbutton1.getURL(url1, _blank);
    }; //the "blank in this doesn't work, it goes to the url,
    just not in a new window
    TTMO110333._visible = false; //this refers to a movie clip
    that is on the same stage with an instance name of TTMO110333
    myInterval = setInterval (TTMO,15);
    function TTMO () {
    TTMO110333._x -= (TTMO110333._x - _xmouse)/10;
    TTMO110333._y -= (TTMO110333._y - _ymouse)/10-2;
    TTbutton1.onRollOver = function() {
    this["TTMO"+id1]._visible = true;
    } //this refers to a movie clip with an instance name of
    TTbutton1, i would like to make the clip visible only while the
    mouse is over the movie clip i'm trying to get to act as a button
    any ideas on how to solve these problems? thanks again for
    your time.

  • How can we use variables for instance name?

    I'm using 9 textbox in my stage. Names are similar, only difference is the last character. (s1_0, s1_1, s1_2, ...). I'm trying to use these textbox in a loop. But I couldn't find the right typing... s1_[i], s1_(i) or s1_{i} gives error.
      s1_0.text=0
      s1_1.text=0
      s1_2.text=0
      s1_3.text=0
      s1_4.text=0
      s1_5.text=0
      s1_6.text=0
      s1_7.text=0
    how can make the shortest typing for this issue?

    yes, its working, thank you very much...
    I tried array operator but the word "this"..
    what does it means ? when I delete this word, it gives error. how does flash know that it is a instance name?

  • Using a variable in an instance name

    Hey all,
    Simple question:
    I'm trying to use a variable to call on different instance names:
    var picCaller:uint=2;
    material_mc.addChild(pic_""+picCaller+"");
    The code in red is the issue in question.  In this example, I'm trying to add a child called "pic_2", with the number two called from the variable "picCaller"
    Any assistance is greatly appreciated.
    Thanks!

    Just for context, here is what I'm trying to do:
    I have jpegs in my library and I want to add them to the stage when they're needed, so just to add one image, here is the code I have:
    var pic_1=new pic1(0,0);
    var image_1:Bitmap=new Bitmap(pic_1);
    material_mc.addChild(image_1);
    I want to put the above into a loop so that I dont have to repeat those three lines for every image in my library like so:
    var pic_1=new pic1(0,0);
    var image_1:Bitmap=new Bitmap(pic_1);
    var pic_2=new pic2(0,0);
    var image_2:Bitmap=new Bitmap(pic_2);
    var pic_3=new pic3(0,0);
    var image_3:Bitmap=new Bitmap(pic_3);
    var pic_4=new pic4(0,0);
    var image_4:Bitmap=new Bitmap(pic_4);
    var pic_5=new pic5(0,0);
    var image_5:Bitmap=new Bitmap(pic_5);
    var pic_6=new pic6(0,0);
    var image_6:Bitmap=new Bitmap(pic_6);
    var pic_7=new pic7(0,0);
    var image_7:Bitmap=new Bitmap(pic_7);
    the variable "picNum" is the total amount of images that in the library, each one exported as "pic1", "pic2", "pic3" respectively.
    var picNum:uint=7;
    var picCaller:uint=1;
    var  picMC:MovieClip = new MovieClip();
    picMC=this["pic_"+picCaller];
    for (var  i:int = 1; i <= picNum; i=i+1)
         var "pic_"+i = new image_i(0,   0);
         var image:Bitmap = new Bitmap("pic_"+i);
    Thanks so much for your help.

  • Pass symbol instance name to variable

    Hi all,
    I'm trying to figure out how to pass the instance name (ID) of a clicked object to a variable so I can navigate to a label on the timeline with the same name.
    So far I've tried different variations of:
    sym.getSymbol() //logs as "undefined"
    sym.getSymbolTypeName // logs the symbol name in the library, not the instance
    Any ideas?
    Thanks
    -Dave

    Sweet!
    That worked - Thanks! I ended up combining both your suggestions. on the button symbol i have
    sym.getComposition().getStage().onClick(e.target.id);
    and then after compositionReady I added a function to split out the second name and logged it to test;
    sym.onClick = function(targetId){
              var names = targetId.split("_");
              console.log(names[1]);
    Works perfectly! - Although it would be nice if the EA team could fix that functionality in future releases so e.target.id gives you just the id for the selected symbol. I would think if you can write something like getSymbol("mySymbol") it should be just as easy to get that name without all the extra (Stage...etc)
    Thanks again!
    -David

  • Reference a movieclip by a variable containing its instance name?

    There are some movie clip instances on the stage (not
    dynamically created at run time). Now, I want to do this:
    use a variable to hold a instance name at runtime. then use
    this variable to reference the movie clip it points to.
    Problem: suppose this variable is named "mc_ref". it fails to
    use "_root.mc_ref" to refer to the movie clip by the name that
    mc_ref contains. it seems in this case flash takes "mc_ref" as
    instance name and thus looks for any child by that name. since
    mc_ref itself is not a name, this will not work.
    is there something like MovieClipbyInstanceName function for
    this? Any thoughts? Thanks!

    you're confused. the variable's name and the movieclip's name
    should not be the same.
    the following are correct ways to reference movieclips in
    flash:

  • Referring to instance names with variables

    I have the following problem. I have two movie clips with the
    instance
    names inst01 and inst02.
    I have the code :
    _root.inst01._alpha += 10;
    Now sometimes I would like it to be for "inst01" and others
    "inst02".
    Is there a way that I can just say set a variable like :
    currentinst = "inst01"
    or
    currentinst = "inst02"
    And then write the code as:
    _root.currentinst._alpha += 10;
    Would this work, how would Flash know whether "currentinst"
    was an
    instance name or a variable name?
    THANK!
    Tim

    Thanks!
    I had actually just figured it out, I have to use the array
    brackets,
    thanks so much!
    In article <ess33h$d73$[email protected]>, "David
    Stiller"
    <[email protected]> wrote:
    > Tim,
    >
    > > Is there a way that I can just say set a variable
    like :
    > >
    > > currentinst = "inst01"
    > > or
    > > currentinst = "inst02"
    >
    > There is.
    >
    > > And then write the code as:
    > > _root.currentinst._alpha += 10;
    >
    > The problem with that, as is, is that the variable
    currentint currently
    > refers to a string, and the String class has no such
    property as _alpha.
    > You need to "translate" that string into an actual
    object reference, and
    > there are two ways I know of to do that, both described
    here.
    >
    >
    http://www.quip.net/blog/2006/flash/actionscript-20/reference-objects-dynamically
    >
    >
    > David Stiller
    > Adobe Community Expert
    > Dev blog,
    http://www.quip.net/blog/
    > "Luck is the residue of good design."

  • Simple math and a variable in an mc instance name

    i have several movie clips with instance names in the format
    of screened1, screened2, screened3, and so on. i am trying to
    reference a movie clip as shown below, but it's not working. what
    am i doing wrong? how do i fix it?
    this.screened[numOfItems-8].transform.matrix = F1toP0;
    the transform, matrix and all of that works fine. but when i
    add the information between [ ] to make reference to the movie clip
    instance name, no go. numOfItems is a number, and when run trace on
    it.... it does return a value in the output.

    right on. my favorite flash genius. thanks again!

  • Which file decide instance name in RAC 10g ?

    Which file decide instance name in RAC 10g ?
    How does RAC know which instance should start from which machine?
    Thanks.

    The spfile is NOT the correct answer, actually.
    1. The instance name for any Oracle instance, whether in a RAC or not, is derived from the value for the ORACLE_SID parameter which is in force at the time the startup command is issued. If you were to:
    export ORACLE_SID=SALES
    sqlplus / as sysdba
    startup...you would just have created an instance called SALES.
    2. The spfile (or init.ora if you're not using an spfile) contains a parameter called INSTANCE_NAME. That defaults to whatever ORACLE_SID is set to as an environment variable when the instance is started, hence point 1 above. But you can force an instance to acquire a non-SID name by deliberately setting it to something different. That's unusual to do, though, except in a RAC context where you want to subvert the default load balancing mechanism.
    2b. The spfile (or init.ora) also contains a parameter called DB_NAME -but that is the name of the database, not the name of the instance, and is therefore irrelevant for the purposes of working out how instances get their names,
    3. Neither of the above answers has got anything to do with RAC knowing what instance runs on which machine. That is the job of the Oracle Cluster Registry file (OCR), for which you have to provide about 100MB of space on a shared hard drive during the RAC installation itself.
    You populate that file by running DBCA to create your RAC instances (and DBCA then automatically updates the OCR to record the fact that it created instance X1 on Node A and X2 on Node B, and therefore that's what will happen in the future unless you change things).
    Or you can update the OCR yourself by using the SRVCTL utility. You'd do something like: srvctl add instance -d DB1 -i X3 -n C (add an instance called X3 to run on Node C as part of database DB1).
    A little more details about the OCR is available in Section 13 of this article, for example: http://www.dizwell.com/prod/node/26?page=0%2C5

  • Get current SQL instance name with PowerShell

    Hi all,
    I'm preparing SQL agent job that will backup all jobs on SQL server. Main step is PoswerShell script. I want that job to be universal for all servers. The first parameter that I need to send to script is instancename.
    I want to use variable as InctanceName parameter. So, when I run this job on particular server this variable must get current SQL instance name.
    I can use $env:computername for default instances but I cannot use it with named instances or with clustered instances. Some solutions like using 'HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL' keys won't work because of number of
    instanses can be running on one machine.
    How to get only current SQL instance name?

    Hi, 
    Thank you for your answers.
    I found this solution:
    $serverInstance = "$(ESCAPE_DQUOTE(SRVR))"
    Working perfect.

  • Identical database & instance names in Oracle 11g R2 RAC

    Hi ,
         We are migrating our EBS 11i (11.5.10 CU 2) and oracle 11gr2 (11.2.0.3) database (database only) which is currently on Solaris to Linux. Currently the database is NON-RAC and as a part of the migration we are converting it in to a 5 Node RAC. A lot of third party interfaces connected to this environment are using hard coded database name. Unfortunately due to the project time lines it's impossible to change those applications within the migration timeline. In order to ensure that they don't break we are thinking of keeping one instance name same as database name so those applications can continue to function without any change to their code. We are aware that this would compromise on fail over capabilities for those applications but we are ok with that.
    This what we have in mind: Create 5 PROD instance named as PROD, PROD1,PROD2, PROD3 & PROD4. PROD being the name of the database also. I would like to know:
    1) Is this configuration allowed i.e., is it ok to have one instance with the same name as database?
    2) We will be creating a 5 node Data gaurd environment for this so what will be the impact of such a naming on it?
    3) Since it's an EBS environment will there be any issues with application configuration?   Our application architecture will be as below:
    6 application nodes - Two for concurrent managers, two for forms & web & two external nodes
    The two CM app nodes will be tied to two database instances using Services
    Remaining app nodes will connect to the remaining 3 instances once again using services.
    We will be configuring services using "vip" instead of scan names.
    4) What will be the impact if the node having the instance name same as database name goes down?
    5) Any other areas to worry about with such a configuration say like cluster services, 3rd partyinterfaces/applications?
    Please let me know if you have any idea of such a configuration.
    regards
    pramod

    Brian, rchem & Martin thanks for your responses. Appreciate it much. I was thinking about the service alternative but unfortunately I understand from my customer that their applications have hard coded database (used as a instance name) name. All they are saying is that their applications are using instance name instead of database name without providing much details on how it's being used. I just know that there 180 applications... Oracle & non Oracle based in which the instance name is hard coded, but haven't got answers to my questions on how it's hard coded i.e., is it being pulled from the database using a hard coded query like "select instance_name from v$instance" or is it a part of some variable in the script/application etc., and what it's being used for (later) within the application.  Answers to those question will help in deciding what  should be the right strategy but since I am short of time I thought of this and wanted to know if anybody has implemented or come across a similar architecture.
    I am creating services and using them in my EBS application ifile thereby avoiding SID but agree with you on the node failure part as I haven't tested this new set up yet.
    Martin,
              You are right, they are using the database name as a SID in their application hence the above need.  My cluster version is 11.2.0.4.0 (both Active & Software versions). The source database on solaris is 11.2.0.3 Non RAC, it's going to be upgraded to 11.2.0.4 before conversion/migration hence I have installed & created a 11.2.04 RAC environment as a part of POC/Load testing.
    Regards
    pramod

  • Retrieve App Instance Name in Adapter

    Hi,
    I am trying to get App Instance Name in the adapter, was not able to achieve this using standard set of Adapter Variable.
    Could someone provide your input on this.I tried mapping using Request Info but was not able to get thru it.  Appreciate your input on this.
    What I am looking for is, I have a connected App Instance created attached to RO/IT res. I have attached a custom adapter, i am trying to get the App Instance name that I am requesting in the adapter.
    Use Case is as below:
    1. User Requests App Instance in Catalog Search Screen
    2. Upon successful submission of the request, I am invoking adapter where I need to get the app instance that user requests.
    Thanks
    Raj

    Using the Process Instance Key and Resource Object Name:
                Account instance = null;
                SearchCriteria search = new SearchCriteria(ProvisioningConstants.AccountSearchAttribute.OBJ_NAME.getId(), resourceName, SearchCriteria.Operator.EQUAL);
                List<Account> accountsProvisionedToUser = getProvSvc().getAccountsProvisionedToUser(userKey, search, null, true);
                ACCOUNTS:
                for (Account account : accountsProvisionedToUser) {
                    if (account.getProcessInstanceKey().equalsIgnoreCase(processInstanceKey)) {
                        instance = account;
                        LOGGER.log(Level.INFO, "Account Instance Found: OIU Key:" + account.getAccountID());
                        break ACCOUNTS;
    The name is instance.getAppInstance().getApplicationInstanceName()
    -Kevin

  • Get All instance names in the stage

    hi,
    is there any way to get all instance name of the objects presents on the stage ? trace them for example
    thank you

    thank you, it's the correct answer but i still can't solve my problem ,
    the thing is that am using a code from http://www.freeactionscript.com that make enemie follow the player, but i need to do some modification, i need to detect collision between enemies so they will not get the one into the other and the thing that i cannot found their instance name, even when i used your function i only get "player_mc : _level0.player_mc" at the output,
    here is the code, i will be really greatful if you can find a way to help me solve this problem .
    ps :
    am trying to write my own code that make enemie follow the player, coz this one looks very complicated
    thank you
    the code :
    * Game Enemy AI Behavior - Run Away & Follow Player
    * Version:           1.0
    * Author:           Philip Radvan
    * URL:                     http://www.freeactionscript.com
    var enemiesArray:Array = new Array();
    var radians:Number = 180/Math.PI;
    createEnemies(5, "typeA", "e1");
    createEnemies(5, "typeB", "e2");
    createEnemies(5, "typeC", "e3");
    // createEnemies(number of enemies, behavior)
    // use ex: createEnemies(10, "slow", "myLinkedMovieClip);
    function createEnemies(enemyAmount:Number, enemyBehavior:String, enemyLibraryClip:String):Void
              //run a for loop based on the amount of enemies
              for(var i = 0; i < enemyAmount; i++)
                        //set temporary variable that will hold the new enemy attributes
                        var tempEnemy:MovieClip = _root.attachMovie(enemyLibraryClip, "enemy"+_root.getNextHighestDepth(),_root.getNextHighestDepth())
                        //give new enemy a random x/y position based on stage width/height
                        tempEnemy._x = random(Stage.width);
                        tempEnemy._y = random(Stage.height);
                        tempEnemy._rotation = random(360);
                        //set enemy behavior
                        if(enemyBehavior == "typeA")
                                  //define enemy characteristics
                                  tempEnemy.speed = 1
                                  tempEnemy.turnRate = .05
                                  tempEnemy.agroRange = 200;
                                  tempEnemy.mode = "follow"
                        else if(enemyBehavior == "typeB")
                                  //define enemy characteristics
                                  tempEnemy.speed = 4
                                  tempEnemy.turnRate = .5
                                  tempEnemy.agroRange = 200;
                                  tempEnemy.mode = "follow"
                        else if(enemyBehavior == "typeC")
                                  //define enemy characteristics
                                  tempEnemy.speed = 1
                                  tempEnemy.turnRate = .2
                                  tempEnemy.agroRange = 100;
                                  tempEnemy.mode = "run"
                        //define variables that are used to calculate following
                        //*don't change these*
                        tempEnemy.distanceX = 0;
                        tempEnemy.distanceY = 0;
                        tempEnemy.distanceTotal = 0;
                        tempEnemy.moveDistanceX = 0;
                        tempEnemy.moveDistanceY = 0;
                        tempEnemy.moveX = 0;
                        tempEnemy.moveY = 0;
                        tempEnemy.totalmove = 0;
                        //add new enemy to array
                        enemiesArray.push(tempEnemy)
    //Update enemies function
    function updateEnemies():Void {
              //run a for loop based on the amount of enemies
              for(var i = 0; i < enemiesArray.length; i++)
                        //set temporary variable that will hold the new enemy attributes
                        var tempEnemy:MovieClip = enemiesArray[i];
                        //run follow function with temporary enemy as the follower
                        updatePosition(tempEnemy, player_mc);
    // updatePosition(follower, target)
    // use ex: updatePosition(myEnemyMovieClip, playerMovieClip)
    function updatePosition(follower:MovieClip, target:MovieClip) {
              //calculate distance between follower and target
              follower.distanceX = target._x-follower._x;
              follower.distanceY = target._y-follower._y;
              //get total distance as one number
              follower.distanceTotal = Math.sqrt(follower.distanceX * follower.distanceX + follower.distanceY * follower.distanceY);
              //check if target is within agro range
              if(follower.distanceTotal <= follower.agroRange){
                        //calculate how much to move
                        follower.moveDistanceX = follower.turnRate * follower.distanceX / follower.distanceTotal;
                        follower.moveDistanceY = follower.turnRate * follower.distanceY / follower.distanceTotal;
                        //increase current speed
                        follower.moveX += follower.moveDistanceX;
                        follower.moveY += follower.moveDistanceY;
                        //get total move distance
                        follower.totalmove = Math.sqrt(follower.moveX * follower.moveX + follower.moveY * follower.moveY);
                        //apply easing
                        follower.moveX = follower.speed * follower.moveX / follower.totalmove;
                        follower.moveY = follower.speed * follower.moveY / follower.totalmove;
                        //move & rotate follower
                        if(follower.mode == "follow")
                                  follower._x += follower.moveX;
                                  follower._y += follower.moveY;
                                  follower._rotation = Math.atan2(follower.moveY, follower.moveX) * radians;
                        else if(follower.mode == "run")
                                  follower._x -= follower.moveX;
                                  follower._y -= follower.moveY;
                                  follower._rotation = (Math.atan2(follower.moveY, follower.moveX) * radians)+180;
    //onEnterFrame that executes the updatePosition updateEnemies every frame
    _root.onEnterFrame = function(){
              updateEnemies();
    //start/stop drag for player_mc
    player_mc.onPress = function(){
              startDrag(this);
    player_mc.onRelease = function(){
              stopDrag();

  • Get the instance names of clips attached to a movieclip

    I want to get the instance names of all the cmovieclips that
    are attached to a movieclip.
    Is there a simple way to do this.
    I imagine this is something that can be done with AS3 but can
    it be done with AS2?
    regards J

    you're welcome.
    FYI: a for...in loop loops through all the accesible
    properties (in the broadest sense of the meaning, includes
    methods/functions and variables etc). Each time it finds one it (in
    this case) assigns the property name to the variable 'unknown'
    the code inside the loop just checks
    a) is it a property that references a movieclip instance and
    b) is it the same property name as the movieclip instance's
    _name property (this is to avoid listing additional references to
    the same movieclip instance that may be set up as variables in your
    McA's scope).
    I just read that and I'm wondering if it actually will help
    you understand... its quite complicated to describe,sorry...
    although its simple to understand once you get used to it. To learn
    you should experiment with a few for.. in loops on different
    objects and see what trace outputs you get.

  • Email subject line with Alert unique Identifier,host name, instance name

    Is there any way that i can set the following information in the notification email subject line,
    Alert Unique Category,
    Host name,
    instance name.
    Please advise.
    Thanks.

    Yes I did look under the email customization section. But i am unable to get how to place alert Unique ID with in the subject line as i don't see any variable to place under it.
    Please advise.
    Thanks.

Maybe you are looking for

  • Cannot print from mac OSX 10.5.8 to my HP B210 - I already reset the printer - HP utility won't open

    When I try to open the HP Utility - it just sits there and does nothing - I have to force quit. And my printer is not printing from my mac. My wife can print from her PC laptop. We use Netgear.

  • How to create a transport for queries from production system

    We have a situation where the production client has been open during cutover and a user has modified queries which were previously transported into production from our development system. We now wish to 'synchronise' our systems so production can be

  • Can't import .mov file into iMovie

    I have a video clip in .mov format that won't seem to import so that I can edit it. I'm a guy who's worked with windows for years and I am Mac illiterate. Is there a reason why I can't import the clip, but it still plays in quicktime? G5   Mac OS X (

  • ERROR WUC-24 [URLDownload.pullFile()]

    I am working on Oracle Application server 10g (9.0.4). I configured webutil for OLE functinality (to create excel). I am running the test form provided to test the webutil. It works fine but the folliowing error come in the java console when form loa

  • How do I use snapshot tool on Surface 2 (RT)

    I have begun to use my Surface 2 (RT) to put together my powerpoint presentations for work.  I am constantly using PDF files and using adobe snapshot tool to cut and paste pictures and charts from the PDF files.  On the surface, the only adobe versio