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?

Similar Messages

  • 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();

  • 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 to target main timeline from within 3 mcs in a slidemenu?

    Hello there,
    I am trying to modify a slidemenu script but don't really
    know how to accomplish it. I have a series of buttons within three
    mcs. (this is necessary for the sliding script to work). In the
    original script, the button name is targeted to a label with the
    same name in a new scene.
    The code on the button is:
    on (release) {
    gotoAndStop("/:" add eval("..:text"));
    // THIS goes to the FRAME with the name of the button you
    just clicked on.
    The MC code is:
    // tmi=total menu items
    // dup=new movie duplicates
    // butn=original movie button
    // FIX original Button:
    butn:text = /:Menu0;
    while (Number(n)<Number((/:tmi*2)-1)) {
    n = Number(n)+1;
    dup = "butn" add n;
    duplicateMovieClip("butn", dup, n);
    setProperty(dup, _x, Number(getProperty(dup,
    _x))+Number(n*getProperty(dup, _width)));
    setProperty(dup add "/b", _x, getProperty (dup add "/b", _x)
    + (1));
    set(dup add ":n", n);
    // assign button name from variables
    if (Number(n)<Number(..:tmi)) {
    set(dup add ":text", eval("/:Menu" add n));
    } else {
    set(dup add ":text", eval("/:Menu" add (n-/:tmi)));
    The problem I am having is that I don't want to go to a new
    scene ( because I am only loading photos) but would like to target
    a label on the main menu. I have tried many ways including (my
    label is named "one"):
    on (release) {
    _root.gotoAndStop("Main" "one");
    on (release) {
    _root.gotoAndStop("one");
    on (release) {
    gotoAndStop("Main" "one");
    on (release) {
    _level0.gotoAndStop("one");
    But none of these work. There must be a way to do this no?
    Please someone enlighten me! I need all the help I can get.
    Thanks very much for your support,
    Niki

    Hi,
    i don't where you got this code but it looks like Ascript
    used in flash 4...
    and it's full of syntax errors...
    don't know if this is what you want want but why not try
    something like:
    nrOfBtns = 4;
    //position for each button
    // make button on the root like : myBtn. (mClip or Btn clip )
    buttonStep = myBtn._width+10 // or_height
    // for each button make click tag i.e. in an array is allways
    nice
    clickTag = new Array();
    clickTag[0] = "labelName 0";
    clickTag[1] = "labelName 1";
    clickTag[2] = "labelName 2";
    // create loop
    for (i=0; i<nrOfBtns; i++) {
    // gives you myBtn_0 _1 ,etc.
    duplicateMovieClip("myBtn", "myBtn_"+i, i);
    // places each button 0X150 = 0, 1X150 = 150 position etc.
    _root["myBtn_"+i]._x = i*_root.buttonStep;
    // add other things like click commands:
    // like wich label in the root to goto coming from the array
    _root["myBtn_"+i].clickTag = _root.clickTag
    _root["myBtn_"+i].onRelease = function() {
    _root.gotoAndPlay(this.clickTag);
    trace(this.clickTag);
    hope i could help
    ML

  • Export SWF to have all animation in main timeline?

    I have an animated logo (LOGO.SWF) and I have many instances of the same symbol that play outside the main timeline. I would like to export this SWF (LOGO.SWF) so that I can import it into another FLA (BANNERAD.FLA). But when I import it now into (BANNERAD.FLA) it does not play these symbols as they are not played in the Main Timeline of the original (LOGO.SWF). Is there a way to export the movie (LOGO.SWF) so that you can in a sense have all the animation be in the scene? Does that make sense?
    This will be a flash banner ad, so I cannot have it linked through AS.

    You should be able to make all the animations play the way you want by just switching from MC's to graphic symbols. Just make sure the parent timeline has enough frames to play all the frames in the graphic symbol.
    You could also probably load the swf into a Loader and it should play just fine.

  • 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

  • Remove child on the root timeline from within a movieclip

    Hi
    How do I remove a child from the root timeline from within a separate movieclip?
    I've tried
    MovieClip(parent).removeChild(mc1);
    But I get this error
    1120: Access of undefined property mc1.
    I could write a function in the root timeline that just removes child and then run that from within the movieclip but is there a better way?
    Thanks in advance.

    Thanks for replying.
    I asked on Kirupa but I couldn't access the site so I asked here.
    I guy answered with this
    MovieClip(parent).removeChild(MovieClip(parent).getChildByName("mc1"));
    It works fine, is this the best way to do it?
    Not sure if I understand what you meant?
    Just to be clear I have to movie clips on the stage mc1 and mc2 and i want to remove mc1 from within mc2's timeline.
    Thanks again

  • Attempt to move main timeline from inside a movie clip breaks menu buttons.

    I am attempting to have the main timeline move from a stopped position over a movie clip to frame 1, where my start menu is.
    The code I'm using does move the timeline but in doing so it somehow breaks the 4 buttons I have in frame 1.
    My code in the movie clip:
    stop()
    function replayMovie(event:MouseEvent):void
    MovieClip(parent).gotoAndStop(1);
    Menu.addEventListener(MouseEvent.CLICK, replayMovie);
    My code in frame 1 of the main timeline:
    stop();
    function bo(event:MouseEvent):void
    gotoAndPlay(21)
    SoundMixer.stopAll()
    espesp.addEventListener(MouseEvent.CLICK, bo);
    function ho(event:MouseEvent):void
    gotoAndPlay(31)
    SoundMixer.stopAll()
    espeng.addEventListener(MouseEvent.CLICK, ho);
    function yo(event:MouseEvent):void
    gotoAndPlay(41)
    SoundMixer.stopAll()
    engesp.addEventListener(MouseEvent.CLICK, yo);
    function go(event:MouseEvent):void
    gotoAndPlay(51)
    SoundMixer.stopAll()
    engeng.addEventListener(MouseEvent.CLICK, go);
    The error output when I use my Menu button at the end of the movie clip.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at SSubjunctiveProjNewgrounds_fla::MainTimeline/frame1()
    at flash.display::MovieClip/gotoAndStop()
    at SSubjunctiveProjNewgrounds_fla::Esp_5/replayMovie()
    Any help would be greatly appreciated.

    For the sake of space, I'll leave out all the package declarations and class declarations and just talk about the functions.
    First, the Game class, it has two functions.  The first one is the constructor function and it launches at the beginning of the game:  First the Game function:
    public function Game():void
    //Game code goes here
    }//Game
    We want to listen for someone to click the mouse on the MenuPage, so lets create a new MenuPage and add a listener to the button contiained within it.
    public function Game():void
    menuPage = new MenuPage;
    menuPage.startButton.addEventListener(MouseEvent.CLICK, startGame);
    addChild(menuPage);
    }//Game
    You will notice that before I declared a variable var menuPage:MenuPage, but that's all I did was declare it.  I didn't really make a new instance of it, I just set aside space for it.  In the first line within the Game function, I'm actually turning that variable into a new instance of a MenuPage.
    We don't have a picture of this imaginary menuPage instance, but lets' assume that in our MenuPage MovieClip in the library, we created a SimpleButton called startButton.  Here, I'm adding an EventListener that patiently waits for someone to click that button.  Once we receive that event, Flash is told to call the startGame function.
    As you get better at this, you'll get into custom events, and the eventListener for the button will exist in the MenuPage class file, or even in another class file that you create just for the button.  Something like StartButton.as  But for now, we can do it as above.
    Now the startGame function:
              public function startGame(evt:MouseEvent):void
    //Remove the start Page
    //Add the zombie
    //Add the gun
    }//startGame
    And we'll replace those comments with real code.  It follows along with what we just did above.
    public function startGame(evt:MouseEvent):void
    zombie = new Zombie;
    addChild(zombie);
    gun = new Gun;
    addChild(gun);
    And we also want to clean up some by removing the menuPage, and throwing out the eventListener.
    public function startGame(evt:MouseEvent):void
    zombie = new Zombie;
    addChild(zombie);
    gun = new Gun;
    addChild(gun);
    menuPage.startButton.removeEventListener(MouseEvent.Click,startGame);
    removeChild(menuPage);
    }//startGame
    Now our Game class is complete.
    The Zombie Class
    public function zombieWalk(evt:Event):void
    this.addEventListener(Event.ENTER_FRAME,zombieWalk);
    this.x = this.x + 10;
    }//zombieWalk
    Notice we've added a function to the Zombie Class.
    The first function adds an EventListener to the zombie.  We can use the word this and actionScript knows we're talking about the zombie that the class is written for.  This listener fires off every frame.  If our FLA file is set to 12fps, then 12 times every second it will call on the zombieWalk function.
    The zombie walk function moves the zombie 10 pixels to the right every time the function is called.
    On a more advanced level, you'll want to add animation in the MovieClip to move the zombie legs.  You'll also want to use Timer events to space out how often the funtion fires and not ENTER_FRAME events.  And you'll want to use a static constant to establish how far the zombie moves.  We have it now set to 10 pixels, but that can get irritating if we want to change that value later.  But again, baby steps.
    And finally, the Gun class
    public function Gun():void
    this.addEventListener(MouseEvent.CLICK, fireGun);
    }//function
    public function fireGun(evt:MouseEvent):void
    this.gotoAndPlay(2);
    }//fireGun
    First we add an EventListener for when someone clicks on the gun.  Once this happens, the listener calls on the fireGun function.
    The fireGun function takes advantage of the frames within the Gun MovieClip.  Say we have three frames in the Gun MovieClip.  The first is just a picture of the gun.  The second is the gun with a flash coming out of the nozzle.  And the third is the gun at rest again.  The line this.gotoAndPlay(2) sends the gun to the second frame with the flash graphic.
    For this to work, each frame in the Gun MovieClip has to have some stop and play commands.
    But.. you said no code on our timeline!! Liar!
    I know.  This is the exception.  You will need basic stop() commands and gotoAndPlay commands to loop animations.  Any MovieClip that has more than one frame will need something to control it.
    So our Gun MovieCLip has the following:
    Frame 1: stop();
    Frame 2: no actionScript... and I mean nothing, not even the words, "no actionScript"
    Frame 3: gotoAndStop(1);
    This will loop the gun to the beginning and wait for the next time the user clicks the gun.
    Advanced features of the Gun class might include a Bullet.as sub-class that creates a bullet MovieClip to fly across the screen.  Sound to play when the shooting takes place.  Object collision detection to see if the bullet hits the target.  And a means by which a custom event will tell the Game.as class that a zombie has been hit and it should be removed from the stage.
    As you go down the rabbit hole of ActionScript 3, you will find yourself at a point where it's just a matter of getting the syntax right for all the built in functions and classes.  Arrays, Loaders, casting variable types.. all that stuff will come.
    I hope this has been helfpul.  It's been on my to-do list for a long time.  When I first started out, no one could provide me with basic answers for how all these classes and whatnot worked.  After teaching myself AS3 for 2 years and reading a gabillion books, I think I've gotten to a point where I'm pretty comfortable with it all.

  • How to control main timeline from buttons in a movieclip - job in jeopardy!

    I am trying to do a simple thing in theory. In my main timeline I have a series of images with frame labels for each. In a movieclip (with its own labels & script) below the images, I have two panels of butttons that flop back and forth (to save space). The idea is to simply have the main timeline play the frame specified by the corresponding button in the movieclip. I tried the parent.child thing but either im doing it wrong or that isnt the solution. If anyone can help me I will be saved from certain death. If you think any other part of my project may be to blame, Ill be happy to provide anything that can help. Thanks in advance.
    Here is my script:
    ActionScript Code:
    function on1click(evt:MouseEvent):void {
        gotoAndPlay("pic1");
    thumbPanel.pic1_btn.addEventListener(MouseEvent.CLICK, on1click);
    this is the error: 
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at gallery_fla::MainTimeline/frame1()

    The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....
    - is not in the display list
    - doesn't have an instance name (or the instance name is mispelled)
    - does not exist in the frame where that code is trying to talk to it
    - is animated into place but is not assigned instance names in every keyframe for it
    - is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
    If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

  • Targeting main timeline from a button symbol

    I have been using Edge since it's inception. However I have not been using it over the last year as I have not had any contract work for HTML5 animation but I just got a contract to re create animations originally done in Flash. My Edge basics are pretty fresh but I have a hard time doing the following.
    I have a 2 state button up  down which was converted into a symbol with a mouseover to change the state. Now I need to have an onclick event play the main timeline which I cannot seem to grasp.
    Any help coding this?
    Thx
    RD

    Hi, RD-
    Try using sym.getParentSymbol() (if you're only one level down) or sym.getComposition().getStage() to get the main timeline, then call play().
    Hope that helps,
    -Elaine

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

  • 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

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

  • Play a frame in timeline from inside 2 movieclips.

    Hi. I have tried everything but it just isn't working.
    On my main timeline I have a MC called "rainbow." Inside "rainbow" I have a MC called "greenbow."
    Inside "greenbow" I have a MC called "meetbtn2"
    I want it to play frame 134 on the main timeline when you click "meetbtn2."
    my code inside greenbow is as follows:
    meetbtn2.onRelease = function () {
    _root.gotoAndPlay(134);
    however it doesn't work! is it because i am inside two MC's?
    I have also tried
    _root.rainbow.greenbow.meetbtn2.onRelease = function () {
    _root.gotoAndPlay(134);
    any help? Thanks!

    i believe you miss understood me. the actionscript and the MC are on the same frame on the same timeline.
    however
    on the main timeline: the MC "rainbow" doesn't appear til frame103
    inside "rainbow": the MC "greenbow" doesn't appear til frame 48
    inside "greenbow": the movieclip that acts as the button"meetbtn2" doesn't appear til frame 11
    however all instances have been named correctly and all actionscript is on the same frame-space as its objects....

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

Maybe you are looking for

  • External Hard drive won't read on iMac

    I recently got a new pc and I was using an external hard drive to transfer the files that I wanted from my mac to my pc. I put all the files on that I needed and when I went to copy them to my pc, apparently I did something I shouldn't have? I need t

  • Table of Contents Bug?

    I downloaded a trial of CS 6 recently and for the first time today I tried to make a table of contents. I've really never had trouble with this tool but in CS6 something strange keeps happening. I have styles applied correctly-I've double checked-but

  • Importing thousands of tapes

    We have thousands of tapes to import into final cut. We have 10 citidisk HD and 10 HDV vcrs. We tried to press play on the HDV VCR and record on the CITIDISK and it worked perfectly, but the file M2T produced by the CITIDISK seems unreadable by FCP.

  • Sender Channel getting problem "RFCSenderR3 "

    Hello friends, In my XI  QA env...there is one service "RFCSenderR3" which is not showing any messages like in message monitoring ,but if i check in Communication channel CC monitoring for that service it shows as following error : Error* Sender chan

  • What is the application "spnsrvmac"?

    I have recently upgraded to mavericks but now, on start up, I am asked: "Do you want the application "spnsrvmac" to accept incoming network connections?" I think it is related to the Sentinel Protection application, can anyone tell me what this does