Package value variable instance name

Hi, I fall into the beginner category and am learning that I will. If someone would be pretty kind to explain an answer to this question I would appreciate it a lot.

The question is how to turn a String variable in a class name in a package?

What I'm working on is if I have a few values in a shared object and I want to combine one of these SO values with an Word (lets say the word is "smiley"), and these two things come together to create the name on an object in the library I want to appear on the stage.

Example of

1. the library has four objects of smiley, called smiley1, smiley2, smiley3 and smiley4

2. my package so far looks like

package

{

import flash.display. *;

import classes. SetMonth; It detects the current month in the date of the pc

public class MonthSwitch

{

public static function get getMonthSwitch1() public

{

spot1 var: / / do not know what is happening here, I need spot1 equality 'smiley' + value from Shared Object

return (spot1)

}

}

}

I have working right now is

public static function get getMonthSwitch1() public

{

spot1 var = new smiley1()

return (spot1)

}

So what I'm trying to figure out is how to replace "new smiley1()" with a smiley of Word and a value of an object variable shared. Or at least how to make smiley + 1 and I'm going to work on learning to replace the 1 with an object shared vaule later.

Thanks for any help

var m: * = createClassF (yourstringvariable);

function createClassF(s:String): * {}
var classRef: Class = Class (getDefinitionByName ();
var classInstance: * = new classRef();
Return classInstance;
}

Tags: Adobe Animate

Similar Questions

  • Reference button as variable instance name?

    I'm trying to put a button instance name in a variable and then try to use the variable to change the instance _visible property. Without success. Here is a code snippet ("ButtonClicked" is a number):

    var hideButton = "button" + buttonClicked.toString () + "_btn."
    hideButton._visible = false;

    Is there something that I am missing?

    This.accept_btn.onRelease = function() {}
    var hideButton = "button" + buttonClicked '_btn. "
    This ._visible ._parent [hideButton] = false; DOES NOT!

    Remove _global
    Add this

    (as shown above)

  • Add a variable to an instance name

    I have a variable which is my flash movie during extraction (well, if all goes well... I am having trouble with loadVariables)... anyweezer, the variable is called "id". I want to add to the value of this variable then the end of a text string and then use it as a reference to an instance name.

    for example, I film clip with an instance name of TTMO110333. If the variable ID had a value of 110333, how would I use that in actionscript to allow me to refer to the last part of the instance with the variable name?

    something to the effect of...

    {run}
    it. "TTMO"+ id._visible = true;
    }

    Hi, use it.

    TTbutton1.onRollOver = function() {}
    eval("TTMO"+id1)._visible = true;
    }

  • declare the name of the flash using the flash stage as movieclip variable/instance. is this possible?

    We can get the variable of the form in this way.  but I don't want to I'll do cirlces (Forms) at the stage of flash directly and read variables exactly as movieclip instance name

    If

    / * js

    var circle = new createjs. Shape();

    circle.graphics.beginStroke('#000');

    circle.graphics.beginFill('#FFF000');

    circle.graphics.drawCircle (0, 0, 50);

    Circle.x = 250;

    Circle.y = 70;

    stage.addChild (circle);

    */

    You can create a movieclip created by step and assign an instance name in actionscript and easeljs and you can not assign created in step form an instance in actionscript and easeljs name.

  • Understand references to variables vs instance names

    Hi all - even though I've been workginw ith AS3 successfully for a little while now, there is a concept that I don't understand, and as an instructor, I would like to this question if it happens on the ground. I am trying to understand the difference between a variable used to store a reference to a display object (ie. a clip dynamically attached), vs the name of the instance (as represented by the name property). I noticed that draw a dynamically created instance will usually result in a name such as "instance2", or something like that. I am still able to assign a name using the name property. Example:

    var mc:LibraryClip = new LibraryClip();
    addChild (mc).
    I can now control this instance using "cm."
    MC. Name = "myClip";
    He now has an instance name can I use also

    -which is the way own/favorite control dynamically composed of instances - var ref or name? In addition, how do you overcome problems when using a loop to create several instances (it seems not care if you use the same name for each loop):

    Example:
    for (i = 0; i < 10; i ++) {}
    var mc:LibraryClip = new LibraryClip();
    addChild (mc).
    }

    Thank you, as always.

    MyClip is the name property of mc MC is an object reference. You can use either the variable (mc) to make references to this object or return the reference object using its name as a property when using getChildByName().

    the only problem with your loop is if you want to control cases of LibraryClip after that the loop for ends. Then, you'll be out of luck because you have not used unique references for each of them and you don't give them unique names.

  • Displaying an Enum value and the name of the element when the values are not sequential

    Hello

    I use Enum and controls indictators successfully with shared and modbus variables.

    For example:

    Name of the element Value

    Off:                0

    Start 1

    On                2

    Œuvres enum Setup, I don't need to look for a cheat sheet to convert the name of the element in its value, I see the name of the item in my order/indicator.

    My new variables, I'm currently managing look like this:

    Name of the element Value

    Code 0 x 201

    Beginning Code 0 x 202

    Code 0 x 001

    Any ideas how I can display the value and the name of the element on a façade. (for a control and indicator)

    For enumerations, it seems that the item values must go 0,1,2,3,4,5

    I found the solution:

    http://digital.NI.com/public.nsf/allkb/79BA4505AE8C755E86256FB2000140B0

    use a ring of text and deselect the sequential box

  • Database trigger can not see the package global variable after assign in my form

    Hello

    I faced the problem with the trigger and the package variable global using the form designer

    first of all, I get the local IP address machine using WEBUTIL in triggering of the PREFORM and initialize my global package variable by ' Client_Info_Pkg.Set_IP_Address (WEBUTIL_CLIENTINFO.» GET_IP_ADDRESS); ", then I tried to make the DML operation in my form and at the same time I trigger database also uses the package global variable of" Client_Info_Pkg.Gand_IP_Address; "to read in the package, and then insert it into the audit table


    The question this database trigger may not feel the initialization "Client_Info_Pkg.Set_IP_Address (WEBUTIL_CLIENTINFO. GET_IP_ADDRESS)' I did in triggering of the PREFORM and I used to wonder if oracle create new session to run this trigger so he can't see my boot or what?!. .

    the package

    CREATE OR REPLACE PACKAGE Client_Info_Pkg

    Global_IP_Address VARCHAR2 (100);

    FUNCTION Get_IP_Address RETURN VARCHAR2;

    PROCEDURE Set_IP_Address (p_Machine_Name IN VARCHAR2);

    END Client_Info_Pkg;

    /

    CREATE OR REPLACE PACKAGE BODY Client_Info_Pkg

    FUNCTION Get_IP_Address RETURN VARCHAR2 IS

    BEGIN

    RETURN Global_IP_Address;

    END;

    PROCEDURE Set_IP_Address (p_IP_Address IN VARCHAR2) IS

    BEGIN

    Global_IP_Address: = p_IP_Address;

    END;

    END Client_Info_Pk

    relaxation

    --------------

    CREATE OR REPLACE TRIGGER RUNERP.FO_DOC_TYPES_L_T

    BEFORE INSERT OR UPDATE OR DELETE ON FO_DOC_TYPES

    REFERRING AGAIN AS NINE OLD AND OLD

    FOR EACH LINE

    BEGIN

    IF THE INSERTION

    RUN IMMEDIATELY ' INSERT INTO FO_DOC_TYPES_LOG

    VALUES ("I",: DOC_TYPE_ID,: DOC_TYPE_VALUE,: DOC_TYPE_NAME,: Vip_Address' HELP: NEW.) DOC_TYPE_ID,: NEW. DOC_TYPE_VALUE,: NEW. DOC_TYPE_NAME, Client_Info_Pkg.Get_IP_Address;

    END IF;

    IF THE UPDATE CAN

    RUN IMMEDIATELY ' INSERT INTO FO_DOC_TYPES_LOG

    VALUES ("U",: DOC_TYPE_ID,: DOC_TYPE_VALUE,: DOC_TYPE_NAME,: Vip_Address) "USING: NEW." DOC_TYPE_ID,: NEW. DOC_TYPE_VALUE,: NEW. DOC_TYPE_NAME, Client_Info_Pkg.Get_IP_Address;

    END IF;

    IF REMOVE THEN

    RUN IMMEDIATELY ' INSERT INTO FO_DOC_TYPES_LOG

    VALUES ("D",: DOC_TYPE_ID,: DOC_TYPE_VALUE,: DOC_TYPE_NAME,: Vip_Address) "USING: NEW." DOC_TYPE_ID,: NEW. DOC_TYPE_VALUE,: NEW. DOC_TYPE_NAME, Client_Info_Pkg.Get_IP_Address;

    END IF;

    END;

    /

    Thanks in advance

    I solved my problem by using the CONTEXT object, Michael thank you for your interest.

  • Buttons null; losing stage instance names

    Hello, I apologize if this question has already been asked, but as the title suggests, I have problems with my buttons instance names. I use Actionscript 3 with Flash CS5. I apologize in advance to be clear, but it would be better that I explained my problem in detail.

    I have my project put in place so that everything happens in a MovieClip and buttons in the MovieClip are switched to navigate through the MovieClip. The MovieClip contains several images which are all unique and contain a variety of text boxes, MovieClips, buttons, classes and other custom classes. All these components are created directly in Flash Professional by dragging the MovieClip from the library onto the stage inside.

    I then name these components using Flash Professional and use these names of the instance to work with components. Usually, it works without problem. However, now that I'm using a MovieClip nested for my project of many problems are happening. I have it so that when you click on buttons, the MovieClip moves to a certain slice through the gotoAndStop (x); command. It works fine but I have problems to access the buttons that I mentioned earlier. It gives a null object reference error, when I trace the button he designed as "null".

    Initially, I thought this problem was because the MovieClip had not yet initialized but I had used the ADDED and RETURN timeline script, event listeners and other methods but the button was always the null value, leading me to believe that the problem was more than that.

    So I used an event listener to click which told the instance names of the elements I was clicking (trace (e.target.name)). I have a total of 8 buttons on the specific framework of my MovieClip so I clicked on them all. 6/8 buttons mapped out the correct name of the instance that I gave them while the other two buttons traced 'instance 169' and 'instance 177' instead of the name of the instance.

    With all this strangeness, I have commented the code for these 2 specific buttons to see if it would work without them. Of course he did.

    I think my buttons have lost their Stadium, instance names, and I don't know how to solve this problem. I tried to remove the buttons and create them again, but nothing helped. However, it works if I use the Button component that has Flash, but I don't want to do this because I would like to use my own custom buttons (I know the Button component is customizable, but I would use my own anyway).

    If someone could help it, please how can I fix this? If my .fla or specific code must be provided, I can do.

    Do not use "e.target.name" because who can finish by pointing to an object that was clicked that lives inside the button instead of the button itself.  Instead, you should use "e.currentTarget.name".  That will always point to the object that has the event listener are entrusted to him.

    If you get the error 1009, here are some things to consider to help solve...

    1009 error indicates that one of the objects targeted by your code are out of reach.  This may mean that the object...

    -is declared but not instantiated

    n ' is not have an instance name (or the name of the instance is misspelled)

    n ' is not in the frame where this code tries to talk to her

    -is animated in place, but is not assigned the name of the instances of each keyframe for her

    -is one of the two or more consecutive keyframes of the same objects without a name assigned in the image previous (s).

    If you go to your section to publish the Flash settings and select permit debugging option, your error message should have a suite of line number the number of the frame that will help you to isolate the object that is involved.

  • I can do this (use a counter 'i' the instance name)

    Hello

    I have 5 dynamic text object in my scene and I need to make a treatment for them (compare each one to the other)

    my text instance names are:

    0, to1, 2, to3, to4

    and their names of variables are:

    T0, t1, t2, t3, t4

    what I have to do is:

    If (t0>t1) then 0 moves to the place of to1 and to1 will move instead of 0

    up to now, I have no problem to compare 2 elements and change their place, but what happens if I have a large number or an unknown number of items, I know that I can (must) a loop but the problem is that I can't do this

    For examle, let's say I have 10 items:

    for (i = 0; i < 10; i ++) {}

    {If (t [i] > {t [i + 1])}

    Exchange (to [i], to [i + 1]);

    }

    }

    This code perfectly work when I work with a table

    I hope that you understand my problem, I don't need someone to tell me how to apply sorting in a table all the I want, it's the ability to use a counter on a MovieClip instance variable name, DynamicText, etc...

    Thank you

    If you follow what I offered in your other post, it would be something like...

    for (i = 0; i<>

    {if(t[i]>t[i+1])}

    Exchange (this ["on" + i], this ["to" +(i+1));

    }

    }

  • Convert integer the instance name?

    I have 40 movieclips with instance names p [1-40] (for example, p14 or p32). I want what they all do something, so I use a loop "for". As a pseudo-device simplified code, it looks like:

    for 40 {}

    variable variable = + 1

    p [variable]

    }

    How to use p [variable] as an instance name?

    Thank you in advance!

    Try:

    for(var i:int = 0; i < 40; i++) {
        trace(this["p" + i]);
    }
    
  • instance name problem breaks my brain

    How can I create an instance name for a Child MovieClip?

    because I want to do 2 a hittest with a Child MovieClip heres my code:

    Var ID = setInterval (createCopy, 1000);

    var counter = 900;


    function createCopy() {}

    var c:MovieClip = new bulb();

    addChild (c);

    c.x Fokker-built = Math.Random () * stage.stageWidth;

    -counter;

    If (counter < = 0) {}

    clearInterval don't (ID);

    }

    }

    I want to do a hittest, I tried this:

    If (c.hitTestObject (Player))

    {

    -life;

    }

    but I doent work he says theres nothing with an instance name of c

    But what I do not understand how said the c.x Fokker-built = Math.random () * stage.stageWidth; code worked?

    Please answer I have ive been stuck on this the day of hole

    Hello

    #1

    your variable named 'c' is local - so if you try to access outside the method "createCopy" you will get the error.

    #2

    There is a "name" property on MovieClip (from strict DisplayObject):
    http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/display/DisplayOb ject.html #name

    that you can use to give the unique name of the instance, and then retrieve it under this name using the getChildByName (...) method:

    http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/display/DisplayOb jectContainer.html #getChildByName ()

    See this thread for the use, for example:

    http://forums.Adobe.com/thread/854911

    HTH,

    Kind regards

    Peter

  • the class and instance name

    How can I access a movieclip via an instance name in the 1 class file (not the main Document)

    And the class to recognize the movieclip when I use a code like this: this.y = player.y

    Player is the name of the instance.

    Thank you

    Already I saw a thread on the forum and did not have a good solution for this, but after a long hours, I found a solution with the minimum of effort:

    1. create a file in flash with a single movieclip named instance testMC
    2. on the timeline, write the following code to declare the class object

    var obj:TestingAccess = new TestingAccess (internship);

    Here, you must pass the scene as an argument to the constructor of the class

    3. create a class file and write the following code:

    package {}
       
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.display.Sprite;
    import flash.display.Stage;
       
       
    SerializableAttribute public class TestingAccess extends MovieClip {}
    var stagRef:Stage;
    var rootMC:MovieClip;
    public void TestingAccess(stag:Stage) {}
    the constructor code
    stagRef = deer;
    rootMC = MovieClip (stagRef.getChildAt (0));
    rootMC.testMC.rotation = 45;
    }
    } //Class
    } //Package

    I just a made a rotation for that Movieclip. It works

  • Problem of passage of a string like a movie clip instance name

    Hey guys out there.

    I thought it would be a simple, but I am confused.  So I trained to the use of this solution less than optimal, just to make it work...

    If (lobby.gamemap.selectedItem.label == "Map1") card. AddMap (new Map1)

    Else if (lobby.gamemap.selectedItem.label == "Map2") card. AddMap (new map2)

    Map1 and Map2 are video clips in my library with a binding Map1 and Map2, fla

    I have a class of entry Hall, inside it's a combo box with the choice of the map... the problems when I try this application preferred

    card. AddMap (lobby.gamemap.selectedItem.label)

    Survey of error - Type 1067: Implicit coercion of a value of type String to an unrelated type flash.display:MovieClip of

    I read in this post http://forums.Adobe.com/message/2741961 the flash should be able to use this [string] to pass the string as the name instance... film clip then I tried

    card. AddMap (this [lobby.gamemap.selectedItem.label)]

    trace (this [lobby.gamemap.selectItem.label])

    This also will raise an error TypeError: Error #2007: child parameter must be non-null.

    I note also that track come back NULL...

    I tried this, the inclusion of the word 'new '.

    card. AddMap (new this [lobby.gamemap.selectedItem.label])

    This will raise - TypeError: Error #1007: instantiation attempted on a non-constructeur.

    I also tried lobby.gamemap.selectedItem.label to pass a string and try all the previous situations with the string instead of the label of the comboBox.

    .. still no dice.

    Haaalp

    Your preferred approach won't work for what is obvious if all goes well.  Whatever the done function AddMap, he expects a MovieClip as an argument, not a string.  Using the notation of support you've tried at the next attempt fails because the instance must exist to target this way.  And the last is simply wrong, in part for the previous reason and partly because an instance cannot be used directly as a class identifier.

    Here is a code that can be used to create a new instance using a string value for the name of the class.  See if you can fit that...

    var ClassRef: Class = Class (getDefinitionByName ("className"));
    var classInstance: * = new ClassRef();

  • Migration of LCM - Instance name?  Shared services project name? Data source?

    --------------------------------------------------------------------------------
    Situation
    --------------------------------------------------------------------------------
    * We have hyperion 11.1.1.3.24
    * Objective - trying to migrate files LCM of our DEV to UAT environment
    * DEV LDCS alone has enabled planning application ("budget"), little EN reports & other related artifacts.


    --------------------------------------------------------------------------------
    Up to now
    --------------------------------------------------------------------------------
    * Successfully exported these 4 (EPMA, shared services, planning & EN) of our DEV
    * When you try to import EPMA in our UAT, noticed that the State indicates failure. (Notice how claims have been reported in other posts as well.)

    Another dilemma that I have what should I write on the name of the Instance, the name of the Shared services project & the data source.

    * Instance name = >? I'm not sure. How to find it?
    * Shared services project = > have not created one at all. Thus, those who do I use OR how do I know this?
    * Data Source = > I guess, it would be the name of EPMA repository database?


    Although I can migrate all the artifacts in our (the same as our DEV) UAT, Migration status showed as "failed". Is this due to the fact that I jumped Destination options with empty values (for example, shared services and data source). Has anyone ever had success on this stage of the Migration.

    OR should I simply ignore this state of migration, because we can see all of the identical artifacts in our UAT.


    Any help would be greatly appreciated.

    If you connect EPMA and choose an application and select deploy (don't worry, you don't have to deploy, you can cancel it until you do).
    It displays a popup that will be the
    Name of the instance (usually the default), Shared Services project (drop-down menu displays the groups of different applications available), the Data Source (this is the name you gave when you created the source of application data)

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Coordinate the functions of Boolean values by their name

    Hi all

    I have somewhat a challenge I appreciate some help with. I am trying to create a program that synchronizes the function of a group of Boolean values by their names. If the Boolean values are names bool 1_i, I want that they be synchronized such that when for example a bool 1(1)(a) is turned on, then all the other 1_i bool are replaced by the same State.  The value group Boolean bool 1_i will initially be in the same State, but I'm trying to get a program that allows them to work in parallel like this.  I was able to make a table of 16 by 128 to work like this, where every row has represented the bool j_i group where I = j = 128 and 16. Now, I want to have the same function as a stand-alone Boolean values that are not placed in a table the table function palette.  Indeed, I am trying to get an array of Boolean values without creating a Boolean matrix in the traditional sense of the term. It is because I want the position to each boolean standalone to change while maintaining is synchrony with other Boolean values bound to her by name.  Any help on this would be highly appreciated.

    Here are the screenshots of the code that I used the 16 y 128 table

    Sincerely,

    Tax


Maybe you are looking for