MovieClip accesses a variable that is in a function outside the movieclip

I try to access the variable myParentVariable in the myParentFunction() of the myMovieClip_mc function myMovieClipFunction() MovieClip function.

I know it works if I declare the myParentVariable variable outside of the myParentFunction() but I really don't want to do, any help would be great.

main timeline

//-----------------------------------------------------------------------

myParentFunction();

function myParentFunction (): void

{

var myParentVariable:int = 50;

myMovieClip_mc.myMovieClipFunction ();

}

//-----------------------------------------------------------------------

inside MovieClip (the name of the movie clip is myMovieClip_mc( )

//-----------------------------------------------------------------------

function myMovieClipFunction (): void

{

Attempts to access the variable myParentVariable

trace (MovieClip (root) .myParentVariable);

trace (MovieClip (this.root) .myParentVariable);

trace (MovieClip (parent) .myParentVariable);

trace (MovieClip (this.parent) .myParentVariable);

None of these work!

}

//-----------------------------------------------------------------------

This work , but I don't want the variable outside the function

main timeline

//-----------------------------------------------------------------------

var myParentVariable:int = 50;

myParentFunction();

function myParentFunction (): void

{

myMovieClip_mc.myMovieClipFunction ();

}

//-----------------------------------------------------------------------

inside MovieClip (the name of the movie clip is myMovieClip_mc( )

//-----------------------------------------------------------------------

function myMovieClipFunction (): void

{

trace (MovieClip (root) .myParentVariable);

}

//-----------------------------------------------------------------------

If you declare the variable within the function you have limited its scope of application to be in the service, and nothing outside of the function will be able to determine its value.  Being inside the function, it is not a stored either value.  It is assigned to the function is not something you can reach and grab the current value.  The only way to realize the value of the service, other than the registrant outside the service, is that it be passed as the function return value.

Tags: Adobe Animate

Similar Questions

  • My Variable is not consistent when called outside the Group

    Dear all,


    I stored a variable that was within the group as follows:
    <? for-each-group: MarketingFundTransferOut; / FromFundId? >
    <? sorting: current-group () / FromFundId; ' ascending '; data-type = "text"? >
    <? sum (ATTRIB_01 [.! = "])? >
    <? xdoxslt:set_variable ($_XDOCTX, 'INIT3', xdoxslt:to_number (sum (ATTRIB_01 [.! = "])))? >-> store for the variable INIT3
    <? end for each group -? >


    and he asked outside the group with these:

    <? xdoxslt:to_number(xdoxslt:get_variable($_XDOCTX,'INIT3'))? >


    Sometimes the true result and sometimes the wrong result (non-compliant)

    Here is the example of one is not consistent:

    1.2 regular TV
    In Total total
    10 0 10 (I've posted the out) 10 (I've posted the in)

    Does anyone have an idea to solve this problem? It will be highly appreciated


    Best regards
    TSE

    You can initialize this variable before this group, so that it does not have the previous value of groups

  • I need a variable that I can use to display the total time spent in a course.

    I want to create a personalized certificate of completion that the learner can print at the end of a course.

    I would like to have the total time spent in the price that is displayed on it, but I'm not sure of the variable to use.

    Take a look at: time display information - Captivate blog

    After reading if you have any other questions, fire away.

  • creating a variable that corresponds to a function

    I don't know if this is actionscript 2 or 3. My friend gave me his flash file and I look at the code and it was something like this:

    Hello = {function (OOP)

    function body

    }

    It means Hello, it is a function with parameter OOP? So, I can call the function by typing hello (5)?

    Yes, you can reference a function in AS2 or AS3 even if I think it's a more common tone at the prototype-esque AS2. And Yes, that's how you would use it.

  • The 'back' button, used to access a feature that formularies a brief history of the newest web sites. I don't find that in V4. Still exists in another format?

    In previous versions of FF there used to be a small arrow which, if you click on it, displays a history list. I can't find where this function is in FF V4.

    The arrow to open the history tab of the previous buttons and following was removed in Firefox 4.

    Use one of the following methods to open the tab history list:

    • Right-click on the back or next button
    • Press and hold the left button of the mouse on the active back or forward button until the list opens

    You can watch this extension:

  • After that report trigger package.function () in the XML data model is not running is not running? What can be the reason

    < / Group >

    < / dataStructure >

    < name dataTrigger = "AfterReport" source = "GE_XDO_PKG.submit_bursting_prg" / >

    < / dataTemplate >

    It has been resolved

  • You try to access a page that is no longer active.

    I get the following error when running a page OA_FRAME_WORK.

    You try to access a page that is no longer active.
    -The referring page could come from a previous session. Please select home page to proceed.

    All Pages of framework should be a function defined on the page when MAC Lite is on and the MAC URL check fails.

    Any help would be appreciated.
    I already did what follows after checking Sumit Sharma response to a mistake of simillar.
    (1) profile FND_VALIDATION_LEVEL set to none.
    (2) verified that I use IE version 7.0.5.

    Make sure that the following configuration is in your JDeveloper?

    1. Tools-> preference-> Embedded OC4J-> host name or IP address used to see Embedded OC4J-online it must be set to-> by default (recommended) local IP address

    2. close the JDeveloper, restart once more. Ensure that the process of JDeveloper and OC4J Embedded processing obtained completed before re-launch.

    If this isn't help, check your Version OFA in your environment. And make sure you use the right version.

    Let me know if you need measures information about Version JDEV OAF/correct.

  • Published the network Variables not accessible by other computers on the network

    I am trying to create a system where a computer will display network variables that can see any computer on the network, this includes a person bringing in a laptop computer and the connection for a short period.  So I was looking through a large number of forums to find an answer and tried many solutions and nothing has worked.

    This is where I am.  On a single computer if I update a variable network it appears on the DSM NOR (Distributed System Manager) under which the name of the computer and I use this variable and it is updated.  Any other computer connected to the network also appears on the DSM.  On the other computer, he sees the first computer in the DSM, but cannot see any one of the variables.  I also register the IP address of the computer, but it does not help.  If anyone has had this problem and know how to fix?  I had the same problem using my code for the project and the example code in the shared Variable Comms between Executables.Ivproj.

    Thank you for your time

    Mitchell

    I had some problems lately with the network stream. I know that this isn't nearly the same as shared variables, but it uses the same underlying process in windows. In my case, it's the windows firewall in Windows 7 that has the problem.

    This link help me configure my firewall correctly:

    http://digital.NI.com/public.nsf/allkb/0D7B86F4B4D19A5E86256F9A006EECB1

  • How to access a global variable that is common between the different baskets project library

    My project consist of several libraries, after generation the library project packed for each library, I find it cannot share data in a global variable between different packaged project library file. For example: packed project library #1 contains VI variables global wirte 'position' and give it a value '400 '. Library #2 present another VI project try to read this global variable, but he gave reading of is NULL not "400". Why has this happened? Is it possible to solve, welcome any help, I wll appreciate for this!

    If you understand what is happening here...

    When you build a PPL, it takes in the .lvlib and also all the dependencies of the .lvlib.

    In your case, when you generate the Test Task.lvlib in a .lvlibp, she also pulls on a copy of the DataProcess.lvlib:GlobalsVariable.vi because it's addictive to read GlobalVar.vi.

    When your application runs, you end up with two copies of GlobalsVariable.vi in memory:

    DataProcess.lvlibp:GlobalsVariable.vi

    AND

    Test Task.lvlibp:: GlobalsVariable.vi (I don't know how PPLs namespace dependencies... If there is still the DataProcess.lvlibp)

    Because they are different screws (i.e. in a different namespace), they have their own memory and that's why you can't access the data.

    Your Test Task.lvlibp calls the version of GlobalsVariable.vi, he pulled the dependencies.

    To solve this problem - you must ensure that Task.lvlibp of Test calls the version of GlobalsVariable.vi of the DataProcess.lvlibp - you'll need to replace all instances with the version of the PPL. Of course, if you run DataProcess in the development environment, then it will always be bad namespaced, hence the suggestion to put your global variable VI in is own PPL that you then use in the process of data and Test tasks.

  • Is there a limit to the number of variables that can access a host on the PXI-7831R or PXI-7841R controller.

    What are the limits on the number of variables that can be transferred between the host controller and a PXI-7841R?  For example, I have several software and controls the status items that the host controller uses to communicate with the PXI-7841R.  These elements are not dependent on digital or analog i/o of the FPGA device.  Is there a limit?  Is there a specification of speed for this communication (by the number of input/output?).  Thank you.

    Any control or indicator that you create in your FPGA LV code allocates space on the Xilinx FPGA. As with all coding, FPGA, there is no way to tell a 'limit' on the space. When you add several controls and indicators, your compilation will take more time and do different things to optimize where everything is stored on your FPGA. You can see the compilation report to see how much space you have left.

    Regarding the speed of specs between the card and the host computer, which will just be specification 133.3 MB/s PCI - fresh general speed.

  • How to access a variable of any page

    I have a variable on the page 1 known. p1_my_var I need to be able to access this variable in any other page, I can do this and if so, how?

    CREATE AN element of the apllication in share component

    my_variable

    with the protection of session state

    without restriction

    create a process plsql on the page where this p1_my_var is present

    immediately present after the calculation and validation

    BEGIN

    () APEX_UTIL.set_session_state

    p_name-online "p1_my_var."

    p_value =>: my_variable);

    END;

    condition

    submit button

    After that: my_variable value can be used in a different page within the session

  • To access package variables

    create or replace PACKAGE foo
    AS
    function f1 ( bar in VARCHAR2)
    return boolean;
    END;
    
    
    create or replace PACKAGE BODY foo
    AS
    function f1 ( bar in VARCHAR2)
        return boolean
       IS 
       BEGIN
      DBMS_OUTPUT.PUT_LINE ('IN FUNCTION F1');
       return TRUE;
    END F1;
    END;
    

    I have the package above and I want to access package foo variable bar in stand-alone function f2. . How can I achieve this?

    create or replace FUNCTION f2 ( p IN  VARCHAR) 
    RETURN BOOLEAN 
    IS
    BEGIN
    DBMS_OUTPUT.PUT_LINE (foo.bar);
    DBMS_OUTPUT.PUT_LINE (9);
    return true;
    END;
    
    I am getting an error  
    
    Error(5,27): PLS-00302: component 'BAR' must be declared 
    
    
    

    2779499 wrote:

    Oh I mean the bar in parameter to the function f1. I can access in F2?

    No, you can't.  Variables and objects etc. have 'reach.  That means that they exist only in scope, they are declared (so the level they are declared and children procedures/functions etc..).  F2 is completely outside f1, so that she can not possibly access this variable or a parameter, as this function f1 is not instantiated, even to the point that running code F2.  This isn't just a thing of PL/SQL, it is the principles of almost all of the procedural languages encoding standard.

  • Access a variable in another layer?

    Is there a way to access a variable in another layer?

    Example:

    Layer 1 expression:

    x 1 = v * time;

    .....

    Expression of layer 2:

    something like that

    anotherLayerX1 = thisComp.layer("1"). GetVariable (x 1);

    thisComp.layer("1"). SetVariable (x 1, anotherLayerX1 + 10);

    Nope. The only thing available to other expressions is the value that results.

    Dan

  • Is it possible to create a variable that tells you what slides, the user has visited?

    Hello.

    I'm working on a project where I want a slide to display a button continue and hide the 2 areas of text, but ONLY when the user has already visited 2 other slides. I can only find variables indicating the slide the user previously visited.

    Is it possible to set a variable that does this?

    I want to create the following advanced measures:

    If the user has visited slides 62 AND 87, image_536 to show and hide text_caption_243 and text_caption_242

    I don't want action be executed if only 1 2 slide have been opened - it must occur when the two were opened.

    Hope that makes sense.

    I use 7 Captivate.

    Thank you.

    You will need two variables, it can be Boolean values. I will label them v_one and v_two with a default value of 0

    Because I don't know how the slides are formatted, do you use a Next button or are all visited media executives? You will need to have an event on the two blades to trigger an action:

    Assign the v_one with 1 slide 62

    And a similar action on the other slides to alternate v_two (do not use the toggle command, if the user accesses a slide twice, it could be toggled to 0).


    You do not specify where these text containers need to be (please, label your objects and slides)? But you'll need advanced conditional action triggered by another event somewhere:

    IF v_one is equal to 1 AND

    v_two is equal to 1

    See the Text1

    See the Text2

  • Setting a variable that I can call it from any symbol value.

    Hey everybody!

    I'm working on a lively game of edge and I'm learning I'll you can tell

    The way I put it in place is that I have a container that contains different symbols depending on the button you clicked on. They symbols open up to a deep part of the game.

    However, I want to be able to define a variable on the stage that I can handle later when different symbols are open.

    What I have so far is my limited understaning of jquery, in the scene that I'm leaving by setting a variable

    var variable1 =     5,
        variable2
    =     10;

    Then in my symbol I want to be able to do something like this


    if(variable1 > variable2) {

    Then do something


    }
    else {

    Then do something else
    }

    }

    Variable1 = 10

    variable2 = 5

    However the problem I'm having is that when I put the value of the variable in time the name of the variable value and whole isn't rememembered in the symbols.

    So is there any code I could write in symbols that can call the variables defined in the scene in the symbols.

    I thank very you much for any help. It is greatly appreciated.

    Hi, I have solved literally just this problem for me! I was unable to include variables in the symbols to remember too. It will be familiar if you have access to the care of in a symbol, like this (this kind - of takes a step backward and takes you to the main stage of symbol):

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

    How I updated the score (shown on the stage) to in a symbol, it's to GET the variable from the scene:

    var score = sym.getComposition () .getStage () .getVariable ("score");

    score += 100;

    sym.getComposition () .getStage ().$("valueDisplay").html (score);

    sym.getComposition () .getStage () .setVariable ("score", notes);

    So for you I recommend you:

    var variable1 = sym.getComposition () .getStage () .getVariable ("variable1");

    var variable2 = sym.getComposition () .getStage () .getVariable ("variable");

    if(Variable1 > variable2) {this}

    Else {who}

    If you want to update the variables and store them on the scene, then you'd in the same way:

    Variable1 ++;

    sym.getComposition () .getStage () .setVariable ("variable1", variable1")

    I hope this helps, I am not 100% and it can be better explained as I learn I will myself!

    Ray

Maybe you are looking for