Variable Reference of Instance Name

While I have had no problems with bracket evaluation of
constants and number variables, I don't know the coding convention
for brack evaluation of a string.
I get an undefined for oBtnName
oBtnName = new Object;
oBtnName = this["mcWing" + aWingColor[nIdx] + "Btn"];
where aWingColor is an array of strings. So I tried setting
aWingColor[nIdx] to variable thinking the inside array brackets
were goofing this up:
oBtnName = new Object;
var sWingColor:String = aWingColor[nIdx];
oBtnName = this["mcWing" + sWingColor + "Btn"];
trace (sWingColor + " " + oBtnName._name );
returns Pink undefined
and interactive debug is showing oBtnName as undefined as
well.
So, then I tried this
oBtnName = this["mcWing" + sWingColor._value + "Btn"];
and then this
oBtnName = this["mcWing" + "[sWingColor]" + "Btn"];
and so on and so on. . . .

Isn't
this["mcWing" + aWingColor[nIdx] + "Btn"]=new Object()
the same as
var oBtnName:Object = new Object;
oBtnName = this["mcWing" + aWingColor[nWingRollIdx] + "Btn"];
I am doing this to shorten the reference name
Here is the rest of the code
mcWingPinkBtn.onRollOut = function () {
clearInterval(nInterval);
nWingRollIdx = 1;
nInterval = setInterval(fFadeOutWing, 1);
function fFadeOutWing():Void {
var oBtnName:Object = new Object;
oBtnName = this["mcWing" + aWingColor[nWingRollIdx] +
"Btn"];
oBtnName._alpha -= nAlphaIncrement;
----oBtnName is undefined here so the following if doesn't
work -----
if(oBtnName._alpha <= nAlphaStart) {
oBtnName._alpha = nAlphaStart;
clearInterval(nInterval);
updateAfterEvent();

Similar Messages

  • 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:

  • How to reference the Instance name using Substitution string or SQL

    All:
    We have an Application that will be replicated in multiple Apex instances and would like to display the current Oracle Apex Instance name ( Similar to the &APP_USER. on the Welcome portion of the page ) .
    Is there a substitution string for this ?
    We plan on using a Show/Hide region on the splash page titled [About], that when clicked displays an HTML region with the subsitution strings.
    If no substitution strings, can someone help with an SQL that returns the Instance name ?
    Thanks for all the help.
    Aubrey Fernandes

    Aubrey Fernandes wrote:
    I currently have 3 URLs to get to my Development, QA and Production servers & will have many more production servers with different Application Ids.
    Development = http://canqa101:7777/pls/ngcrmd01/apex
    QA = http://canqa101:7777/pls/ngcrmq01/f?p=100:1
    Production = http://cancs105:7777/pls/ngcrmp01/f?p=100:1
    What I need are the portions before the final forward slash ( canqa101:7777/pls/ngcrmd01 ) which I assumed is the Oracle Apex instance.That information is determined by the web server configuration (e.g. the DADs when using OHS) rather than through APEX itself. There are no built-in substitution strings for this. Create an application item and an On New Instance (new session) computation to set the value using the function<tt>owa_util.get_cgi_env</tt> function to get the CGI environment variables <tt> HTTP_HOST</tt> and <tt>SCRIPT_NAME</tt>. You can then reference the value in the region using substitution string syntax.

  • 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.

  • Calling a variable in an instance name

    Maybe I am far off here, but I'm hoping someone can help.
    Basically I'm creating a question with 4 answers (i.e. a,b,c,d).
    I have my question working fine, but I'm having a problem adding a check mark beside the answers once the user clicks the submit button.
    I've created four instances of my check mark; rightAns1_mc, rightAns2_mc, rightAns3_mc, rightAns4_mc.  I've set them all to _invisible = false;
    I've also set up a variable; nCheck:Number = 0; and when the user clicks one the radial buttons I have the variable change (i.e. if they click A, it set to nCheck = 1; if they click B, it sets to nCheck = 2; etc)
    So in my if statement for the submit button I figured I could have rightAns(nCheck)_mc._visible = true;
    This completely breaks everything. Like I said, I'm probably far off here. If I am what should I do differently, and if I'm close what am I doing wrong?

    use array notation to coerce flash to resolve strings to objects:
    this["rightAns"+nCheck+"_mc"]._visible=true;

  • How do i reference a movie clip instance name from inside child movie clips.

    I have a label I am referencing form a movie clip inside the movie clip which contains the "label_2."
    Here is the code I used:
    MovieClip(parent.parent).gotoAndPlay("return_2");
    Now I need to reference a instance name of a movie clip in side the same scene.
    What would the code be?

    You should probably start by reading the docs and/or google:
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/Event.html
    http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7fca.html
    http://www.google.com/search?hl=en&q=AS3+events
    Once you got the basics down, look into creating/using your own custom events:
    http://www.google.com/search?hl=en&q=AS3++custom+events
    http://www.adobe.com/devnet/actionscript/articles/event_handling_as3.html
    Event dispatching and event handling is one of the most important things about ActionScript. The sooner you get into them, the better.

  • Using and storing instance names

    I know you can store instance names in an array and call on the array values to reference the instance names in it.
    I was wondering if there is any way I can take an instance name, feed it directly into a function and use the name of the function variable/array/whatever to affect the object instance of whatever I name.
    if it's an array of instance names, what is it actually an array of?
    Also, is there any way to hold and reference an instance name in a single value?
    sidenote:
    this doesnt have much to do with my question, but can arrays be fed directly into the header of a function?

    Look, there is no any ambiguity in what array holds - it is what you make it hold.
    If you are talking about instance names as strings, the following can be done (given objects with instance names are instantiated);
    var myInstanses:Array = ["instance1", "anotherInstance", "myMovie"];
    than you can feed instance name onto a function and do whatever you need to:
    function myFunction(instanceName:String):void{
         this[instanceName].x = 200;
    myFunction(myInstances[1]);
    But if you are talking about instances as instances - not names:
    var myInstanses:Array = [instance1, anotherInstance, myMovie];
    function myFunction(instance:Sprite):void{
         instance.x = 200;
    myFunction(myInstances[1]);

  • Instance names in 'submovies'?

    hello, i'm unsure of how to reference an instance name if
    that instance is in a movieclip that is placed in the main movie.
    i have a UIscrollbar component on the stage, the movie that
    displays correctly in here is called mc_mySubMovie
    mc_mySubMovie has 3 buttons in it, that i have given the
    instance names of b1, b2, and b3
    my main movie has the scrollbar on it, and i am unsure of how
    to access the buttons within mc_mySubMovie in order to have them
    make changes in the main movie, for example:
    b1.addEventListener(MouseEvent.CLICK, doClick);
    function doClick(e:MouseEvent):void
    do something here
    i must be missing something simple here?

    you can reference a parent by using the parent property of
    display objects and you can reference your main timeline by using
    the root propety of display objects.

  • How to access instance name? need help here.... :D

    using actionscript..
    if i have a movie clip in my Scene 1 and inside that movie clip is another symbol e.g. a button, how will i reference the instance name of that button in my Scene 1. tnx!

    Use the dot operator. Say for example you have a movieclip with instance name mysymbol and it has a child symbol button with name childsymbol then you use mysymbol.childsymbol on the main timeline. Try also to trace the symbols to see if they exist like trace(mysymbol) or trace(mysymbol.childsymbol)

  • Convert integer to instance name?

    I have 40 movieclips, with the instance names p[1-40] (for example, p14 or p32). I want them all to do something in order, so I'm using a 'for' loop. In simplified psuedo-code, it looks like:
    for 40 {
         variable = variable + 1
         p[variable]
    How do I use p[variable] as an instance name?
    Thank you in advance!

    var mc:MovieClip;
    var totalMovieClips:Number = 40;
    for(var i:Number = 1; i<=totalMovieClips; i++){
              mc = new MovieClip();
              mc.graphics.beginFill(0xFF00FF, 0.7);
              mc.graphics.drawRoundRect(0, 0, 50, 50, 10, 10);
              addChild(mc)
              mc.name = "mc" + i;
              //trace(mc.name);
              mc.x = i * (mc.width+5);
              mc.addEventListener(MouseEvent.CLICK, onCLick);
    function onCLick(evt:MouseEvent){
              trace(evt.target.name); // Do something write what the button wants actions to do

  • 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.

  • 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!

  • 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

  • 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?

Maybe you are looking for

  • Getting error when calling package from master

    Hi , I am facing one issue , when i am running package indivisually its running fine , but when I am calling same package from Master package it gets failded. below is the error massage which I am getting. "Exception has been thrown by the target of

  • Use J2EE CAS COM Bridge locally for non visual components

    if you only have non visual java-classes which you want to access locally through COM, you should use J2EE CAS COM Bridge. this is a very powerfull component, that makes it very easy to use about ANY java-class in VC++, VB, ASP and VBScripts. Some pe

  • Mac n00b question

    I'm a recent OS X convert, but I can't seem to find the option to set default applications. eg. I want all links in programs to open in Opera, not Safari, open all image files with preview by default (photoshop has made itself the default since I ins

  • JAAS to RSA RADIUS Server

    I need to write a JAAS module that will validate passwords against an RSA RADIUS Server (via RSA's Authentication Manager). I'm not seeing the sort of api's I saw when I did a similar module for Siteminder, so a couple of questions: - Is there a Java

  • DAG Design

    I've got 3 database servers in a DAG, 2 of them at my main site, and 1 of them at my DR site.  We also have 2 file share witnesses configured, the primary being at the main site, and the alternate at the DR site.  We recently had a scenario where the