How to access symbol on main timeline from nested symbol

I did read the the edge JSAPI but still no way to make it work.
Very simple use: you click on a button, a window appears. the button that makes the window appear is supposed to hide some elements which it does. HOWEVER when I want to use a close button within the symbol (window) to make these symbols appear again, it doesnt work.
From inside the symbol I tried:
sym.getComposition().getStage().getSymbol("openTabButtBlack").show();
Doesnt work.

sym.getComposition().getStage().$("openTabButtBlack").show();

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 elements in main.mxml from ActionScript file?

    I am having difficulties creating a panel using the Extension Builder SDK. It seems that all the examples explain how to control a CS5 document using a panel, but I have not found any examples of how to control the elements of the panel via the ActionScript.   By the way we are using CS Extension Builder SDK with Flash Builder 4.  Here is a simple example of were I am getting stuck.
    I create a Extension builder project for a PS panel named: "CSExtensionTest".  In the main.mxml file a create a button with id="btnPSCode".
    File:
    main.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" historyManagementEnabled="false">
    <mx:Script>
                 <![CDATA[
    Bindable]
                        private var hostName:String = HostObject.mainExtension;
                 ]]>
          </mx:Script>
    <mx:VBox height="100%" width="100%" verticalAlign="middle" horizontalAlign="center">
    <mx:Button id="btnPSCode" label="Run PS code" click="CSExtensionTestPhotoshop.run()" enabled="{hostName.indexOf('photoshop') > -1}"/>
    <mx:Button id="btnJSXCode" label="Run JSX code" click="CSExtensionTestJSX.run()"/>
    </mx:VBox>
    </mx:Application>
    How can i get access to the properties of this element in the CSExtensionTesJSX.as file?
    File:  
    CSExtensionTesJSX.as
    package
    import com.adobe.csxs.core.CSXSInterface;
    import com.adobe.csxs.core.csxs_internal;
    import com.adobe.csxs.types.SyncRequestResult;
    import mx.binding.utils.BindingUtils;
    import mx.core.ButtonAsset;
    import mx.core.mx_internal;
    import mx.utils.object_proxy;
    public class CSExtensionTestJSX
    public static function run():void
    var myCSXS:CSXSInterface = CSXSInterface.getInstance();
    var result:SyncRequestResult = CSXSInterface.instance.evalScript("jsxFunction");
                        btnPSCode.enabled = false;   
    I'm getting this error:
    I had originally written a panel using a Flex Project and was able to access the properties of the elements of the main.mxml file directly.  It seems I can't do that anymore.  Am I missing something in the code?  Am I missing some type of library?  I'm sorry I am not very experienced in Adobe development, but we are trying to get more involved in developing plugins and extensions for CS5.  Any help will be greatly appreciated.

    Opps... My fault.  Just figured out waht was missing.
    I forgot to enter the following on the funciton line.
    public static function run(m:main):void
    Again Thank you.

  • Access var on main timeline from class

    Hello,
    Currently working on some expanding media that has class files for all of the various action functions, then a separate class file for all of the var that sets the graphics, tracking, copy / content and whatnot.
    The final part that's driving me nutty - how to set a var per .swf that will concatenate with the tracking.  Ideally I'd like to get this as automated as possible so if I pass off the files to other designers they can update it quickly with minimal effort.
    Assets:
    unit 1a
    300x250 banner
    728x500 expanded larger content area
    unit 1b
    728x90 banner
    728x90 expanded larger content area (that is a duplicate of the 300x250 content .swf).
    So with tracking, each banner and expanded area would have individual tracking pixels.  Currently I can get all of the pixels to fire properly per unit however I have to have separate functions so there's no overlap and a number of duplicate naming.  Druthers-wise what I would have is the type of unit passed when the pixel function is triggered for the larger expanded sizes.  For example =
    User clicks on unit 1b button, this triggers the buttonClickTracking(); function (which is in the actions class file, shared by both unit 1a and unit 1b)..  unit 1b would have some var in the timeline so that when that function is called, the pixel will have "unit1b" + tracking.pixel;
    To sum it up, I need to set some var on the timeline for each expanded unit so the unit label (id) is called when any of the various tracking functions are initiated.  Right now getting that ID from each of the larger content .swf eludes me so any suggestions would be greatly appreciated!

    i could not understand what you're trying describe.

  • How do I set a variable on the main timeline from within a symbol?

    Just getting started with Animate and coming to it from Flash, as may be apparent from my question. How do you set a variable to the main timeline from within a symbol?
    I have 24 pairs of clickable elements, each in their own symbols, and all 24 of those symbols sit inside another symbol. I want all 24 to be able to set the same global variable when clicked. I can't find that this question is addressed anywhere, which makes me think I may be stuck in a Flash mindset and approaching the task in the wrong way. (There are however MANY discussions of how to address objects at different levels in the hierarchy. That's well covered.)
    Relatedly, how do you access a function on the main timeline from within a symbol?
    Adobe should consider putting together a support page (or pages) just for folks migrating form Flash. In the materials I've encountered so far there seems to be a studied effort to refrain from mentioning Flash in any way. I imagine there are a lot of people out there like me who have a deep background in Flash coding, but are just getting started with Animate. We don't need help with most of the basic concepts, but we may still have some pretty basic questions about how to accomplish some things in Animate because our Flash knowledge is getting in the way.

    Hi Bill,
    There are plenty of threads on here about scope, but here's one way to create a global variable:
    // code on Stage.compositionReady
    sym.myGlobalVar = 1;
    Then, anywhere in your project, you can check/set that var like so:
    sym.getComposition().getStage().myGlobalVar = 2;
    And here's one way to create a global function:
    // code on Stage.compositionReady
    sym.myGlobalFunction = function(){
              console.log('myGlobalFunction');
    Then, anywhere in your project, you can call that function like so:
    sym.getComposition().getStage().myGlobalFunction();

  • Controlling a Movie Clip on the Main Timeline from a loaded SWF?

    Is it possible to control a MovieClip on the main timelne from another loaded clip?
    I see posts that control loaded clips, but most are all from the loader in the main timeline.  I have a moviclip on the main timeline that I want to make visible or invisible depending on what keyframe is playing in another loaded swf.
    If I try to call the movieClip from the loaded SWF I get "error #1119.  Access of possibly undefined property...." because it doesn't exist in the loaded SWF, just the main timeline. 
    The old AS2 way just used "_root".  Since "_root" doesn't exist any more, how do you control items on the main TimeLine from a loaded SWF?

    I am not clear what you mean because you are saying you are trying to target a movieclip that does not exist where you are trying to target it.
    Try using a trace to see what you are targeting when you you target the MovieClip(parent.parent)....
    trace(MovieClip(parent.parent));
    The other approach I mentioned earlier is the more OOP-correct approach if you would rather try that way.  Here's a rough outline of it...
    AS3 - Dispatch Event
    http://forums.adobe.com/thread/470135?tstart=120
    Example:
    Add something to trigger the event in the child (your loaded swf):
    dispatchEvent(new Event("eventTriggered")); (
    if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
    In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo.  In the complete event handler, add a listener for the event on the loaded swf.
    // event handler triggered when external swf is loaded
    function loaderCompleteHandler(event:Event) {
        MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
    function eventHandler(event:Event):void {
        trace("event dispatched in loaded swf");
       // this is where your main file can set the visible property of your movieclip

  • Call function in main timeline from class file

    Hi all, How can a function in main timeline be called from class file?

    Hi all, How can a function in main timeline be called from class file?
    You can, but you really shouldn't.
    Classes shouldn't "talk" to the outside directly.
    Use Event dispatching to get things done.
    "root" (i just threw up by just typing that word) should be avoided at all cost, especially in AS3.

  • Play animation on main timeline from within a mc

    this is probably the most basic question of the day, but how
    do you get the main timeline to play from within a mc?
    say I have a mc called jolly_mc and within it is an action on
    it's timeline at keyframe 10. That action needs to jump to a
    certain frame on the main timeline and play.
    I've tried
    _level0.gotoAndPlay(492);
    _root.gotoAndPlay(492);
    _level0.gotoAndPlay("animation");
    _root.gotoAndPlay("animation");
    and non of these work, can anyone clear the haze in my day :)
    thanks in advance.

    _root.mainText = "Obtain 0.2 grams of Ascorbic Acid using the
    Spattula.";
    This line is fine. It's fine to have full-stops inside a
    string. It doesn't effect the code.
    this._root.bkg.gotoAndStop(3);
    Your pathing is a little strange in this line. As you can't
    go any further up the hierarchical tree than _root, if you're
    referencing objects via the root, it should be the first object in
    the target. So if you want to refer to your target using an
    absolute reference(ie by using root) then your line should read:
    _root.bkg.gotoAndStop(3);
    alternatively, since your AS is in a movieclip inside bkg,
    you can refer to your target using a relative reference like so:
    this._parent.gotoAndStop(3);
    this._level0.bkg.power.powerOne.gotoAndStop(2);
    similar story here. _level0 is the highest up you can go, so
    putting this before it is a little strange. Fixing this using
    absolute referencing:
    _level0.bkg.power.powerOne.gotoAndStop(2);
    or:
    _root.bkg.power.powerOne.gotoAndStop(2);
    or relative referencing(assuming the movieclip where the AS
    is is not power):
    this._parent.power.powerOne.gotoAndStop(2);
    if it is power then you could have simply written:
    powerOne.gotoAndStop(2);
    yes, the syntax you suggested for trace is correct.
    but anyway, i don't think that any of this advice is helping
    you with your problem. sorry i can't see the solution with the
    information you've provided. maybe upload?
    how'd you go with sourcing a flash book?

  • How To Access PAGE ITEM (single row) from HTML source

    Hi Guys,
    I have a page Item that return a string.
    I would like to show this string
    How To Access PAGE ITEM (single row) from HTML source?
    My desire final output is
    <marquee>:P1_PAGE_ITEM</marquee>
    Can please help me
    Thanks

    Hi,
    You can refer the page items in your page header as &itemname. For example, if I have page item P15_TEST, I will add the following in header:
    <marquee>
       &P15_TEST.
    </marquee>But make sure that you have a process before header to populate the value in your page item. Otherwise, there will be a null scrolling (which you can't see!) :)
    Regards,
    Zahid

  • How to access a view object under a nested appmodule in servlet

    Hi,
    Can anyone tell me how to access a view object under a nested appmodule in a servlet?
    I know that I can use
    ApplicationModule app = Configuration.createRootApplicationModule(amDef, config);
    ViewObject vo = app.findViewObject(viewObjectName);
    to get hold of an appmodule and view object.
    But in a nested appmodule, for example, I have am0 as root, am1 as child, and voZ within am1, what should I use for this amDef? config? and viewObjectName?
    Your help would be much appreciated.

    Hi,
    http://radio.weblogs.com/0118231/stories/2005/07/19/nestedApplicationModules.html
    Frank

  • How to control the main timeline from within a symbol?

    I have a small world map as a symbol called "verden" and I want the user to click Europe, Asia, or Africa and jump to named labels in the main timeline.
    http://www.dagbladet.no/grafikk/neshorn/neshorn.html
    On the main timeline a have the label "intro" with a Stop action and the label "europa". At label "europa" I have a symbol also called "europa" which has a display of None at label "intro" and On at the label "europa".
    The animation never goes to label "europa"
    I have this code on europa in the symbol "verden" :
    // insert code for mouse click here
    sym.getComposition().getStage().getSymbol("europa").play("europa");
    The files are on Dropbox here
    Update, now it works:
    sym.getComposition().getStage().play("europa");

    Hi Bill,
    There are plenty of threads on here about scope, but here's one way to create a global variable:
    // code on Stage.compositionReady
    sym.myGlobalVar = 1;
    Then, anywhere in your project, you can check/set that var like so:
    sym.getComposition().getStage().myGlobalVar = 2;
    And here's one way to create a global function:
    // code on Stage.compositionReady
    sym.myGlobalFunction = function(){
              console.log('myGlobalFunction');
    Then, anywhere in your project, you can call that function like so:
    sym.getComposition().getStage().myGlobalFunction();

  • How do I recerence Movie Clips on the Main Timeline from inside a class?

    Hey everyone, this might be a stupid question but I thought
    I'd ask cause it's making me nuts. I'm all of 2 days into AS3
    (coming from not using Flash at all in YEARS) so feel free to
    consider me ignorant. I do have plenty of application development
    experience in other areas though.
    I can't seem to create a class that can reference an instance
    of a movie clip on my main timeline. I'd post code of what I've
    tried but I've gone through so many desperate edits & wild
    guesses that it was just garbled junk before I deleted it all.
    Basically here's how I figured Flash could work, though maybe
    it doesn't work this way at all.
    I'm assuming that with AS 3 being so big on being a true
    object oriented environment, I wouldn't need to mix my code and
    interface together. Preferably I'd be using the Flash authoring
    tools just to design my interface. Create a button... place it
    somewhere... give it an instance name. Roughly the equivilant of
    Apple's InterfaceBuilder for those of you that might be familiar
    with Cocoa development. I can see maybe having to put a few lines
    of ActionScript onto frame 1 (though really I'm hoping Flash would
    have a better method of kicking off the application at this point
    that using code tied to frames) to load my classes & such, but
    after that I'd like all of my code to be held in external class
    files.
    So maybe I've got:
    Interface.fla - My interface
    Button_1
    Button_2
    TextField_1
    Main.as - My main controller class using to handle all of my
    applications behavior
    SomeClass.as - Some helper Class
    SomeOtherClass.as - Some helper Class
    Main.as would have instructions in its initialization method
    to go ahead & attach events to buttons & initialize
    anything else that needs to happen when the application starts.
    From there on it would all be objects communicating back &
    forth. Button_1 would get clicked with would fire
    Main.someMethod(). Main.someMethod() would then do it's thing and
    set the value of TextField_1. All very clean & code is very
    separated from interface.
    Unfortunately I can't for the life of me figure out how AS3
    classes reference each other like that. There doesn't seem to be
    any kind of a global 'root' or '_root' I can use to locate any
    movie clips on the stage. I've searched the help & the web for
    any kind of simple tutorial but to no avail. My job has tasked me
    with building a flash app for a project but I'd really rather not
    have a tone of ActionScript just shoved into frame 1. That just
    seems... ugh! (::shudder::)
    Can someone maybe point me in the right direction here? I'm
    really willing to do my homework but I can't seem to locate the
    info I need to get started. Also, is there an ActionScript IRC
    channel or something maybe?
    Thanks,
    Cliff

    I worked with the problem last night and the solution I
    started coming to involved creating my own custom document class
    based off which extends MovieClip. My thought is that way I have
    access to the initialization routine of the timeline itself and
    that all of the elements on the main timeline should be
    "properties" of my custom class.
    Is this correct? Is there a down side to doing this & if
    so what is it & why?
    Also, just for my reference, the last time I did anything
    with ActionScript I think I was using '_root' to target the main
    timeline. WHat are the global variable names in AS 3? Is it just
    'root' & 'stage' or 'Root' & 'Stage' or what?

  • How to access symbol from different stage

    Hi everyone,
    I'm really new at Edge, so I still have a lot to learn and I need your help with something..
    I want to know how to access a symbol from another stage, here's what I've and what I want to do..
    I've the main index page with symbol named "content", in content I load other composition (page). called "page2".
    all I want to do is when I click a symbol "XX" inside "page2". The "content" symbol loads other composition called "page3".
    I don't know how to access "Content" from "page2", so I could load "page3" ..  that's it
    I feel like it's simple, but I just couldn't know how to do it, I',m sorry for bothering you for such a question, but I've searched a lot and I got nothing.
    Thanks
    I thought I could use something like this
    var comp = Edge.getComposition("EDGE-638329");  
    var stage = comp.getStage(); 
    var symp= comp.stage.getSymbol("content");
    EC.loadComposition("assets/units/stage1/s1_3/s1_3.html",symp);
    but it's still not working, could someone please tell me what I'm doing wrong?

    I have multiple compositions, where I need to go from one to another.
    I use click scripts in an element to do this, using identical pages with different animations on each page.:
    Click script:
    AdobeEdge.goLoc(url); //url is the URL of an identical new html page with a different animation
    Then I have a custom .js page that I use that has the function:
    AdobeEdge.goLoc = function(url) {
    location=url;
    Peter Small

  • How do you reference the main timeline of swf1 from swf2 when swf2 is loaded into swf1?

    on this link          http://kb2.adobe.com/community/publishing/918/cpsid_91887.html
    I found this script, but I can not use it can anyone help me
    // create a variable to reference swf1's main timeline
    var swf1Main_mc:MovieClip;  // this assumes that swf1 is a movieclip.
    // create your listener to ensure this loaded swf has been added to the display list and can therefore obtain a
    // reference to its main timeline (which is always the main timeline of the loading swf).
    this.addEventListener(Event.ADDED_TO_STAGE, initF);
    function initF(e:Event):void{
        swf1Main_mc = MovieClip(this.root);

    You don't make it clear what event finish is for. But let's assume that your MC is being loaded from the clip that you're referring to as root. In the main Document Class of that swf, you'd have
    protected var customSwf:CustomSwf;//customSwf is the Class that defines your functionInSwf1protected function someFunction():void {
         var loader:Loader = new loader();
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE onLoaderLoaded);
         //rest of your loader loading code here
    protected function onLoaderLoaded(e:Event):void {
          //add to display list (you already know how to do, so I'm not writing the code)
         EventDispatcher(e.target).removeEventListener(Event.Complete, onLoaderLoaded);
         //if you had a legitimate need for path (which you don't) in mcExternal, you'd set it like this:
         this.mcExternal.path = LoaderInfo(e.target).content as MovieClip;
          //this is what you actually need to care about to do this correctly
          customSwf = LoaderInfo(e.target).content as CustomSwf;
    Now, the Class that you apply to the library symbol you're using for mcExternal should have code similar to this:
    protected function fEvent(e:Event):void {
         dispatchEvent(new Event('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', true));
    back in your main document Class:
    //should probably call from the constructor or somewhere early in the process
    protected function init():void {
         //use your real event name--your code isn't expressive enough I could guess a good name
         addEventListener('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', onEventHappened);
    protected function onEventHappened(e:Event):void {
         customSwf.customFunctioninSwf1();
         customSwf.changeVisualState();//let custom swf change alpha and change the frame #
    To the untrained I, this looks like about the same amount of code and slightly more trouble, but changing the design like this will make it much more tolerant of the changes that nearly all clients will want after you've built version 1. mcExternal's code doesn't have to change at all if swf1 changes, and your root Class already knows abotu swf1 anyway, since it's doing the loading, so having it work with it a little more doesn't hurt.
    Moving the change of visual state into your custom swf means that changes in that swf won't affect your main document Class, though you will probably have to recompile the main document unless you go to using an Interface (a topic for another day).

  • Toolkit for CreateJS: How to control the main timeline from outside the canvas.

    Hey Everyone,
    I'm currently trying to do something simple, but my animation breaks whenever I attempt to change my code. I have created a basic animation in Flash where an object moves from the left side of the canvas, to the right, and then loops from the last frame to the first frame. Nothing else. The animation is simply put on the main timeline. I exported the animation with Toolkit for CreateJS through Flash's extension and the animation runs as it should. I am trying to start and stop (restarting from the first frame) the animation with mouse over and mouse off events. I want the events to fire when moused over/off a div OUTSIDE the animation's canvas tag. Is this possible with CreateJS? I'm trying to figure out how to control the main timeline without being inside the canvas tag.
    Example HTML:
    http://www.thephotoncore.com/testing/example_test.html
    Example Code:
    <section id="container">
      <canvas id="canvas" width="550" height="400" style="background-color:#cccccc"></canvas>
      <section id="animation_control">
        <p>Roll over to start and stop animation.</p>
      </section>
    </section>
    Thanks again for the help!
    -DJ

    Hi DjPhantasy5,
    All movieclips on the stage are children of the stage,
    So on the "mouseover" all movieclips on the stage could be stopped with stop and on the "mouseout" all children could be restarted with gotoAndPlay like this:
    function Stop()
              if (stage && stage.children)
                        var i, l = stage.children.length;
                        for (i = 0; i < l; i++)
                                  var child = stage.children[i];
                                  if ("stop" in child)
                                            child.stop();
    function Restart()
              if (stage && stage.children)
                        var i, l = stage.children.length;
                        for (i = 0; i < l; i++)
                                  var child = stage.children[i];
                                  if ("gotoAndPlay" in child)
                                            child.gotoAndPlay(0);
    See http://www.liauw.nl/forums/adobe/djfantasy5/index.html
    But it is also possible to expose "ball1", for example, by adding it to the document.
    This can be done by adding code to "ball1" like so:
    /* js
    document.ball1 = this;
    Then the stopping of the animation would look like:
    function Stop()
         if ("ball1" in document)
              document.ball1.stop();
    etc.
    Have fun!
    Ronald

Maybe you are looking for