Accessing variable in AS on other timeline

I have a variable declared in AS code on the main timeline, which I want to access from the timeline of an underlying movieclip. How do I do this?

Yes, AS3 uses "root", and you need to type references as you found.  So
MovieClip(root).yourVariable
should get you there.

Similar Messages

  • Access Variable on Main Timeline from Package

    I have set a variable on the root level timeline.  I have a movieclip that calls a package and within that package I want to call or access the main timline variable.  I have tried MovieClip(root) currentLabelName or just calling currentLabelName and none of that works.  Is there another way to be able to access it?

    I agree with dmennenoh that it's probably best not to mix the two, but let's start out assuming you do mix the two, and also the following
    Your instance is called assessment5Q
    You have a frame script on the same frame with the label you want to get.
    Your frame script might look like:
    assessment5Q.loadQuestions(currentFrameLabel);
    Your Assessment5Q Class would have a method that looks like:
    public function loadQuestions(label:String):void {
        //do your current load here
    Now that your Class is set up to work from a framescript, it will work from a Document Class without modification. However, it sounds like your instance doesn't exist on frame 1 of the main timeline, so you need to make sure you don't try to reference your instance before it exists. So we're going to make use of a getter/setter pair, which will allow Flash to create your instance on the timeline per usual, but when the setter is triggered you can then do things with the new instance. Your main document code would include code something like this:
    protected var _assessment5Q;
    public function get assessment5Q():Assessment5Q {
         return _assessment5Q;
    public function set assessment5Q(value:Assessment5Q):void {
         If (_assessment5Q != value) {
              _assessment5Q=value;
              If (_assessment5Q) {
                   _assessment5Q.loadQuestions(currentFrameLabel);
    Note that even this better way is not a way I'd recommend if you expect your project to take longer than a couple of days to develop or be maintained over more than a couple of weeks. It's not good practice to have a single Class that has the responsibility for both getting the data and displaying it. If you only have a single question format, you may be able to get away with having a Class that loads the questions and makes questions from it. Then you can pass the loaded questions into your View as above (instead of using a method that takes a string, you can use a method that takes an array of questions).
    It just so happens that I build Assessments as the vast majority of the work I do, and I have it broken down where there is a Class that has some number of Classes inside it that know how to build individual question types. That Class gets XML handed to it (from a different Class that just handles loading XML) and then it figures out which child Class knows how to build each question type and hands a snippet of XML to the appropriate child. Once all the questions are created, a set of questions will be handed into a View that can show between 1 and 9 questions. It does this by having individual question views on stage that, again, know about displaying specific types of questions. I'm not saying that you need to go whole hog into creating such a scalable design as I have. I'm just suggesting that your product is more likely to stand the test of time if you break things into smaller pieces that then cooperate. That way if the bigger pieces aren't quite right, you can put the smaller pieces together in a different way.

  • How to access variables outside user exit

    Hi,
    I'm working with a user exit and my problem is that in a particular moment I have to access variables located outside the scope of the user exit (they are in a standard program)
    How can I reach these variables?
    thanks in advance

    Hi,
    If they are global variables then you can access them using Global assign technique,
    For example,
    FIELD-SYMBOLS: <fs_value> TYPE ANY.
    ASSIGN ('(SAPMV45A)XVBAK') TO <fs_value>.
    It is basically,
    ASSIGN ('(<Std. Program Name>)<Variable name>') TO <field symbol>.
    NOTE: To make sure they are accessible in your user exit, just put a break-point in the user exit and once you are there in debugging, type in,
    (<Std. Program Name>)<Variable name> in the Field names section and if it does not show it in RED then it is accessible..
    Hope this helps.. 
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • How to access variables??

    how to access public variables of any other class??
    suppose i have a file temp.java file ..& i know all the public variables. and
    i want to access the variable of those temp.class file which extends JApplet or Applet..
    and as u know it will declare public void init() .. & in this function only all declaration will be there.
    so now how to invoke this init() function from any mymethod()..to access public variables...

    its not working. for me..
    the variable which i m trying to access is non static.. its displays the error :
    Exception in thread "AWT-EventQueue-1" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
    and by one method i have connected database also.. and it has been called from init()..
    i have collected the data from the database..and i m storing the data in one ArrayList ..
    and i want to access that ArrayList..

  • How to Access Variables defined in the PopUpWindow

    Hi Friends
    I am building a flex site using flex builder 2.....
    Here I need your help.....
    My Problem is how to store a variable from a popup window
    I have this problem while in the login window comes as popup
    while clicking login button in the page a popup where user
    can enter username and password...
    after submitting if the login is successufl the popup
    vanish...
    After a successful login I need to store the logged user name
    in the main index page but I am not able to store
    At first I created a variable 'loggedUsername' in the popup
    panel and after success log i assigned the username to it ... after
    it i am not able to get the loggedUsername..
    doubting I defined the variable in the main index.mxml page
    but this variable is not accessible from the loginwidow.mxml page
    where the popup will function...
    Heip me
    how to store the name if the user login is success..
    thanks
    Chintu...

    Lets say you have a public property in your application like
    public var name:String = "John Smith";
    to access this using an inline item renderer:
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox>
    <mx:TextInput text={outerDocument.name} />
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    To access variables of the applicaton you can use
    Application.application.name (for example) to reference "global"
    variables, so you might also use this technique. With an inline
    item renderer, the outerDocument property will refer to the
    component which contains the renderer.

  • How to access variables declared in main mxml in itemrenderer files

    Hi,
    I have a main mxml which has a cutomRenderer that defines two
    mxml components
    namely raidobutton and textinput.
    Now in this TextInput.as i need to access variable defined in
    main mxml.
    Please suggest a way.
    Thanks,
    Lucky

    Lets say you have a public property in your application like
    public var name:String = "John Smith";
    to access this using an inline item renderer:
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox>
    <mx:TextInput text={outerDocument.name} />
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    To access variables of the applicaton you can use
    Application.application.name (for example) to reference "global"
    variables, so you might also use this technique. With an inline
    item renderer, the outerDocument property will refer to the
    component which contains the renderer.

  • Can't access variables in specific S7-1200 DB's in LabVIEW project

    Hi all,
    I'm trying to establish a connection between LabVIEW and a Siemens S7-1200 though Ethernet and SIemens OPC Server.
    The physical connection is OK (I can ping S7-1200 with no problem).
    When I needed to access variables from specifics DB's inside S7-1200 ( I want to access variable DB190,X0.4), I called Siemens support and they said I had to modify the variable's definition when using OPC Scout, from "MX0.4" to "DB190,X0.4", and then it was possible to access this variable.
    Same solution (renaming the path) applies to NI OPC Client, I can read and write variables properly.
    My problem is that when I try to add variables in LabVIEW Project, I can't find those variables whose address were modified, so I can't access the correct variable in my program.
    I tried to change the variable path in Multiple Variable Editor, but it doesn't work either.
    Any suggestions on what I can try??

    First: Avoid the ODBC/JDBC Bridge if at all possible.
    It's the worst JDBC driver I've ever seen. It's buggy
    and a great hindrance both to learning and to
    producing usefull code.I agree that there might be problems with M$ Access, but there are problems with all databases, including MySQL (e.g., no referential integrity in free download version). It's capable enough for the query the OP is trying to execute.
    The problem is with his code, not Access or the bridge driver. He'll go through a lot of effort to switch databases and still have this problem. Better to understand what HE'S done wrong and fix it so he'll do it correctly for all databases, including Access.
    You just need to be more careful with your query, I'm sure.
    %

  • Access main stage from a symbol timeline?

    Can I access main stage  from a symbol timeline?
    Eg:
    I have a symbol called "ball" and its own time line. There is a close button at the end of ball's timeline,
    When close button pressed, I want to go back to main timeline.
    Thanks
    Phyle

    Thanks Hemanth.  I will try to explain.
    Open Edge animate. On the main stage I added a label called "home".
    I created circle, converted to symbol, renamed to "ball".
    Inside "ball" , I have a animation, at the end there is a button called "closeBt"
    When "closeBt" pressed, I want to go back to main stage "home"

  • Access variables in Package.

    Hi I have a apackage called share.server , in which I have defined
    Hashtable hash;
    i have another file in share package as Impl, here i want to call the "hash"
    how can i access the same "hash" in Impl.java from FilServer which is in share.server package.
    Please respond urgent, assignment is due soon.
    Thanks for any response.

    what?!
    variables belong to classes, not packages. If you want to access variables between classes you need to define some kind of public interface for them (getters and setters... ring any bells?). This is basic basic OOP, and is called encapsulation. First thing you need to do is get a basic 'OOP with java' type book and read it fully. We can't help you if you can't help yourself/

  • Access variables within a timer

    How can I access variables within a timer?
    I mean variables, that I can use in another class that extends applet i.e.?

    The Code can be compiled now with the Java Compiler.
    But the image won't move on the screen.
    import java.applet.*;
    import java.awt.*;
    import java.util.*;
    public class ChangingApplet extends Applet {
      private Image EricsBild;
      private int x,y;
      private TimerTask update;
      public void start() {
      EricsBild = getImage(getCodeBase(), "heuschrecke.gif");
      x=5;y=5;
        update = new TimerTask() {
          public void run() {
            if (x<300) x++;
            if (y<200) y++;
            if (x>3) x--;
            if (y>2) y--;
            repaint();
        Timer t = new Timer(false);
        t.schedule(update, 1000, 1000);
      public void stop() {
        update.cancel();
      public void paint(Graphics g) {
        g.drawImage(EricsBild,x,y,this);
    }

  • Accessing variable in main mxml from component

    I have the following problem, i have a main mxml and
    component mxml which i import in my main file. I need to access
    variable in main mxml file from that component but i don't know how
    to reference my main mxml from component? Can someone please help
    me with this?
    thanks in advance

    Try this
    this.parentApplication.main_mxml.variableID = 34;
    Rgds
    JFB
    "msabljic" <[email protected]> wrote in
    message
    news:fd2u5k$a17$[email protected]..
    >I have the following problem, i have a main mxml and
    component mxml which i
    > import in my main file. I need to access variable in
    main mxml file from
    > that
    > component but i don't know how to reference my main mxml
    from component?
    > Can
    > someone please help me with this?
    >
    > thanks in advance
    >

  • Apple TV2 can see my laptop but it can't access the files in on my laptop. Home sharing is turned on. I'm using Windows7 64bit. ATV2 can access the files on my other laptop and PC. I've updated my iTunes and ATV2. Any suggestions?

    Apple TV2 can see my laptop but it can't access the files on the laptop. ATV2 can access the files on my other laptop and PC.
    My PC can see the laptop in question but it can't access the files.
    I've updated iTunes to and ATV2 to the lastest version. My laptop is running Windows7 64bit.
    Any suggestions?

    Welcome to the Apple Community.
    I assume you taken the step of restarting the laptop.
    Have you checked your security software is allowing access for iTunes, which security software are you using.

  • PeopleSoft Query Access Services security problems, in other words does QAS

    PeopleSoft Query Access Services security problems, in other words does QAS bypass PeopleSoft?

    Rod,
    Can you please post the entire contents of the dataserver summary screen...thanks.
    Typically the "No suitable driver exists" error is due to trying to connect to an unsupported DB version with the driver.  For example using the MSSQL 2000 driver to connect to MSSQL 2005, be sure that you have downloaded both the MSSQL 2000 (una2000.jar) and 2005 jars and have the proper classpaths specified.
    Sam

  • I have a two sons that have ipod touch 4th gen. One has access to our wifi, the other can't get get our wifi connection. Any ideas???

    I  have two sons with ipod touch 4th gen. One has access to our wifi, the other does not. Any ideas????

    Try manually entering/searching for your wifi access point under the "Other" option. Also, if you have lots of devices connected to your wifi, you may have reached your limit. (e.g. the airport express has a max of 10 while the basestation may have 50. Check your packiging on whatever router you have, may help.)

  • Premiere Pro CC Feature Request: Shortcut for 'Close Other Timeline Panels'

    I'm about to post a feature request, but wanted to see if anyone else is interested in this request too. Adobe told me that getting support on the forum first is a good way to push the request through.
    Here's the very simple FR:
    *******Enhancement / FMR*********
    Brief title for your desired feature:
    Keyboard Shortcut for 'Close Other Timeline Panels'
    How would you like the feature to work?
    It was a great touch to add this contextual menu item to Premiere Pro CC, but it's a little clunky without being able to assign a keyboard shortcut to it.
    It's usage would simply close every other Timeline Panel except the active one upon pressing the shortcut.
    The default could be something not currently in use like Ctrl+Cmd+W (since CMD+W closes the active panel), but customisable in the Keyboard Shortcuts panel.
    Why is this feature important to you?
    This is something I have to do very frequently while editing, and since I (and many others) edit largely with the keyboard, a shortcut would be very useful and speed up workflow just a tiny bit.
    Anyone else interested in this (admittedly fairly boring) feature request, let me know!
    Thanks!

    Thanks for the support and video Kevin!
    cscooper2013: I totally agree with you, I can't see any reason why any action should be exluded from having a shortcut. I've submitted this simple request because I feel like it's more likely to get done on it's own.
    Maybe make a separate FR for that?

Maybe you are looking for

  • Error in process

    Hi all, When i am executing a process having BPM, I am getting a system error and channel not found error. In SXI_cache, BPM is active. The scenario is from sap to legacy system thru XI. There are only three steps start-receive and stop. BPM is recei

  • Jampack and keyboard connection questions

    2 questions: 1. I have just bought GB Jampack (the one with lots of extra loops), but can't seem to notice any difference. How do I know that the disc has downloaded OK? Can't remember how many loops were there in the first place! 2. I'm trying to co

  • ADF Calendar : scroll bar in specific date

    Dear all, By default, the ADF calendar component displays many events found in a specif day as "+2 more", "+3 more" or "+X more" . . . . and as we click on the link, we view them in the day view. Is there any way to display all the events under the s

  • Problem in Font when file is downloaded from query output

    Hi, We are facing a problem as we are not able to simulate a scenario at our end where a file is downloaded from a query. The snapshot of the file which is downloaded in excel is shown below. The name displayed below has special characters in it. The

  • Two iPhoto Issues

    I'm having two different iPhoto issues... I have no problem opening iPhoto, both occur when I try to open the picture or video. First, I have an issue with many of my photos that show up in the library as thumbnails but when I click on them to open a