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

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

  • 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

  • Controll the ROOT timeline from externally loaded movie clip?

    does anyone know how to controll the root timeline from an
    externally loaded movie clip?
    I have loaded a movie clip, which has buttons on it that I
    would like to controll the main original website timeline with.
    something like this.parent.parent?
    thanks a lot
    harky

    feedmeapples <[email protected]> wrote:
    > does anyone know how to controll the root timeline from
    an externally
    > loaded movie clip?
    >
    > I have loaded a movie clip, which has buttons on it that
    I would like
    > to controll the main original website timeline with.
    >
    > something like this.parent.parent?
    _root.doStuff;
    Freundliche Grüße,
    Franz Marksteiner

  • 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

  • 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 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 control the alternative payee from invoice postings

    hi,
    i have a requirement, we are useing the alternative payee for vandor payment, my client want to post only payments through alternative payee. some times by mistake users posted  invoices to alternative payee account. so here after i want to control the alternative payee from invoice postings. how to do the configuration.
    rgds
    gopal

    If I understand your question correctly, you are trying to prevent accidental invoice posting to altenative payee vendor instead of real vendor.
    If this is right, then block the alternate payee vendor in company code. Maintain Altenate payee in general data > Payment transactions data.
    Hope this helps.
    Regards
    Subodh

  • Using an mc to control the main timeline with multiple scenes

    OK, I have a main timeline that has 27 different scenes.  I have a movie clip that is an "on call" navigation menu for the main timeline.  I can call the menu once, and it will go to the first place I want it to go.  However, I cannot seem to figure out how to get it to go away to be able to call it again.  I get the "must be child of caller" error.  Any thoughts on how to get rid of it each time I use it?

    A button is clicked which calls the following AS3 code:
    MovieClip(this.root).addChild(myMenu);

  • How to close the main window  from Popup

    hello all,
    i need to close the main window from a popup, so i create a popup and after clicking on close button of this popup, should also the main window be closed.
    how can do this please?
    BR

    Hi
    Please go through this.. check thomas reply
    Re: Close Main Window directly on action on Pop up window
    also check this..
    how to close main window on click of a button on popup window
    cheers,
    Kris.
    Edited by: kissnas on May 12, 2011 5:06 PM

  • Referencing the main timeline from elsewhere

    From inside a movie clip (button) which is inside a display
    object (buttonSet), I want to gotoAndPlay a specific frame on the
    main timeline. I've tried stage.gotoAndPlay(thisFrame). I got
    closer with gotoAndPlay(stage.thisFrame). I still have something
    wrong.
    I have about 15 frames on the main timeline. Each frame
    contains a myriad of objects all doing different things. Most
    importantly they transition from frame to frame based on the
    current frame (last button clicked) and the next frame (the newly
    clicked button).
    Example: the last button that was clicked was button #4, the
    button I have just clicked is button #2. Based on this knowledge, I
    want the main timeline to gotoAndPlay frame #6.
    Thanks for the aid. :)

    the flash compiler (in strict mode) often has trouble
    "remembering" the class-type of objects/variables. "typing" those
    objects explicitly helps the compiler to overcome erroneous error
    messages.

  • How to play the main timeline after a movie clip is finished playing.

    Ok so here is the problem, I have the main time line with three layers: My actions layer, a music layer, and the movie clip layer.
    The movie clip is an actionscript movie which calls images from an external XML file and shows them as a slideshow. What i need to do is after the last image plays, stop the movie and move the main timeline to the next scene of the main movie. Everything logical in my brain is not working, and it may be that I have been staring at this project for too long but for the life of me i can't make this work.
    Any help or input would be greatly appreciated!
    Thanks in advance.
    Meghan

    better yet, here is the whole code. With your suggestion entered...
    import flash.display.BitmapData;
    import gs.*;
    import gs.easing.*;
    import gs.plugins.*;
    TweenPlugin.activate([BlurFilterPlugin]);
    OverwriteManager.init();
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    _root.xmlPath == undefined ? xml.load("jake.xml") : xml.load(_root.xmlPath);
    //when xml is loaded
    xml.onLoad = function(succes:Boolean) {
        if (succes) {
            //position the slideshow. remember size.
            __width = Number(xml.firstChild.attributes.width);
            __height = Number(xml.firstChild.attributes.height);
            mcMask._width = mcBlack._width=mcHyper._width=__width;
            mcMask._height = mcBlack._height=mcHyper._height=__height;
            //preloader
            mcPreloader._x = __width/2;
            mcPreloader._y = __height/2;
            (new Color(mcPreloader).setRGB(Number(xml.firstChild.attributes.preloaderColor)));
            //buttons
            var buttonLoader:MovieClipLoader = new MovieClipLoader();
            var buttonListener:Object = new Object();
            buttonListener.onLoadInit = function(cButton:MovieClip) {
                if (cButton._parent == btnNext) {
                    cButton._parent._x = __width-cButton._width;
                } else if (cButton._parent == btnPrev) {
                    cButton._parent._x = 0;
                } else {
                    cButton._parent._x = (__width-cButton._width)/2;
                cButton._parent._y = (__height-cButton._height)/2;
            buttonLoader.addListener(buttonListener);
            buttonLoader.loadClip(xml.firstChild.attributes.prevButton,btnPrev.holder);
            buttonLoader.loadClip(xml.firstChild.attributes.nextButton,btnNext.holder);
            buttonLoader.loadClip(xml.firstChild.attributes.playButton,btnPlay.holder);
            buttonLoader.loadClip(xml.firstChild.attributes.pauseButton,btnPause.holder);
            xml.firstChild.attributes.slideshowOn == "true" ? [_slideshow=true, btnPlay._visible=false] : [_slideshow=false, btnPause._visible=false];
            for (var i:Number = 0; i<xml.firstChild.childNodes.length; i++) {
                //create empty movieclip for each picture. create mask movieclip for each picture. save transition and ken burns settings for each picture. save other properties for each picture.
                mcTemp.createEmptyMovieClip("mcPhoto"+i,mcTemp.getNextHighestDepth());
                mcHolder.createEmptyMovieClip("mcPhoto"+i,mcHolder.getNextHighestDepth());
                mcHolder["mcPhoto"+i].createEmptyMovieClip("photo",mcHolder["mcPhoto"+i].getNextHighestDe pth());
                //attach text clip and set it up
                mcHolder.attachMovie("square2","mcBack",mcHolder.getNextHighestDepth());
                mcText.attachMovie("text","text"+i,mcText.getNextHighestDepth());
                mcText["text"+i].mcText._alpha = mcBack._alpha=0;
                mcBack._width = mcText["text"+i].mcText._width=__width;
                mcText["text"+i].mcText.autoSize = true;
                mcBack._height = 0;
                mcBack._y = __height;
                (new Color(mcBack).setRGB(Number(xml.firstChild.attributes.textBackColor)));
                mcHolder["mcPhoto"+i].transition = Number(xml.firstChild.childNodes[i].attributes.transition);
                var burns:Array = String(xml.firstChild.childNodes[i].attributes.kenBurns).split(";");
                mcHolder["mcPhoto"+i].burns = burns;
                mcHolder["mcPhoto"+i].time = Number(xml.firstChild.childNodes[i].attributes.time);
                mcHolder["mcPhoto"+i].src = String(xml.firstChild.childNodes[i].attributes.src);
                mcHolder["mcPhoto"+i].txt = String(xml.firstChild.childNodes[i].firstChild.nodeValue);
                mcHolder["mcPhoto"+i].url = String(xml.firstChild.childNodes[i].attributes.url);
                mcHolder["mcPhoto"+i].target = String(xml.firstChild.childNodes[i].attributes.target);
                //handle loading process. create loader objects. start "intelligent loading". set methods and actions for new newly loaded pictures.
                var photoLoader:MovieClipLoader = new MovieClipLoader();
                var photoListener:Object = new Object();
                photoListener.onLoadInit = function(cPhoto:MovieClip) {
                    //transform image to bitmap
                    cPhoto._visible = false;
                    var tempBitmap:BitmapData = new BitmapData(cPhoto._width, cPhoto._height);
                    tempBitmap.draw(cPhoto);
                    var cPhoto2:Object = mcHolder["mcPhoto"+_loaded].photo;
                    cPhoto2.attachBitmap(tempBitmap,1,"auto",true);
                    photoLoader.unloadClip(cPhoto);
                    removeMovieClip(cPhoto);
                    cPhoto2._parent._visible = false;
                    //remember original size
                    cPhoto2._parent.width2 = cPhoto2._parent._width;
                    cPhoto2._parent.height2 = cPhoto2._parent._height;
                    cPhoto2._alpha = 0;
                    _loaded++;
                    cPhoto2._parent.loaded = true;
                    if (_loaded<xml.firstChild.childNodes.length) {
                        //load next picture
                        photoLoader.loadClip(mcHolder["mcPhoto"+_loaded].src,mcTemp["mcPhoto"+_loaded]);
                    if (_loaded == _index+1) {
                        //show this picture
                        showPicture(cPhoto2._parent);
                photoLoader.addListener(photoListener);
            photoLoader.loadClip(mcHolder.mcPhoto0.src,mcTemp.mcPhoto0);
    //function that changes to the next photo(slideshow feature)
    function nextPhoto() {
        _index++;
        if (_index == xml.firstChild.childNodes.length) {
        //if picture is loaded, just show it. if not, wait until it loads                                                                           
        if (mcHolder["mcPhoto"+_index].loaded) {
            showPicture(mcHolder["mcPhoto"+_index]);
        } else {
            TweenLite.to(mcPreloader,.5,{_alpha:0});
            TweenLite.to(mcBlack,.5,{_alpha:100,onComplete:completeF});
    function completeF(){
    _root.gotoAndPlay("frame1_scene2");
    //function that changes to the previous photo
    function prevPhoto() {
        _index--;
        if (_index == -1) {
            _index = xml.firstChild.childNodes.length-1;
        //if picture is loaded, just show it. if not, wait until it loads                                                                           
        if (mcHolder["mcPhoto"+_index].loaded) {
            showPicture(mcHolder["mcPhoto"+_index]);
        } else {
            TweenLite.to(mcPreloader,.5,{_alpha:100});
            TweenLite.to(mcBlack,.5,{_alpha:80});
    //buttons - roll overs
    btnNext.onRollOver = btnPrev.onRollOver=btnPause.onRollOver=btnPlay.onRollOver=function () {
        TweenLite.to(this,1,{_alpha:70});
    btnNext.onRollOut = btnPrev.onRollOut=btnPause.onRollOut=btnPlay.onRollOut=btnNext.onReleaseOutside=btnPrev.o nReleaseOutside=btnPause.onReleaseOutside=btnPlay.onReleaseOutside=function () {
        TweenLite.to(this,1,{_alpha:100});
    //buttons - next
    btnNext.onPress = function() {
        if (!_transition) {
            clearTimeout(nextT);
            nextPhoto();
        } else {
            clearTimeout(nextT);
            nextT = setTimeout(nextPhoto, 500);
    //buttons - previous
    btnPrev.onPress = function() {
        if (!_transition) {
            clearTimeout(nextT);
            prevPhoto();
        } else {
            clearTimeout(nextT);
            nextT = setTimeout(prevPhoto, 500);
    //buttons - play
    btnPlay.onPress = function() {
        switchVisible(btnPlay);
        switchVisible(btnPause);
        _slideshow = true;
        if (!_transition) {
            clearTimeout(nextT);
            nextPhoto();
        } else {
            clearTimeout(nextT);
            nextT = setTimeout(nextPhoto, 500);
    //buttons - pause
    btnPause.onPress = function() {
        switchVisible(btnPlay);
        switchVisible(btnPause);
        _slideshow = false;
        clearTimeout(nextT);
    //function that animates text(html for each picture)
    function inText(cPhoto:Object) {
        if (cPhoto.txt != "undefined") {
            mcText["text"+_index].mcText.htmlText = cPhoto.txt;
            mcText["text"+_index].mcText._y = mcBack._y-mcText["text"+_index].mcText._height-4;
            TweenMax.to(mcText["text"+_index].mcText,0,{blurFilter:{blurX:15, blurY:15, quality:1}});
            TweenMax.to(mcText["text"+_index].mcText,Number(xml.firstChild.attributes.textSpeed),{blu rFilter:{blurX:0, blurY:0}, _alpha:100});
            TweenLite.to(mcBack,Number(xml.firstChild.attributes.textSpeed),{_alpha:Number(xml.firstC hild.attributes.textBackOpacity), _height:mcText["text"+_index].mcText._height+7});
        } else {
            mcText["text"+_index].mcText.htmlText = "";
            TweenLite.to(mcBack,Number(xml.firstChild.attributes.textSpeed),{_alpha:Number(xml.firstC hild.attributes.textBackOpacity), _height:0});
    function outText(cPhoto:Object) {
        TweenLite.to(mcBack,.5,{_alpha:0});
        TweenLite.to(mcText["text"+_index2].mcText,.5,{_alpha:0});
    //function that applies the ken burns effect to a specific photo
    function kenBurns(cPhoto:Object) {
        //reset size and position
        cPhoto.photo._xscale = cPhoto.photo._yscale=Number(cPhoto.burns[0]);
        cPhoto.photo._x = returnPosition(cPhoto.burns[2], cPhoto.photo._width, cPhoto.photo._height, mcMask._width, mcMask._height).__x;
        cPhoto.photo._y = returnPosition(cPhoto.burns[2], cPhoto.photo._width, cPhoto.photo._height, mcMask._width, mcMask._height).__y;
        //start effect
        TweenLite.to(cPhoto.photo,cPhoto.transition+Number(cPhoto.time)+1,{_xscale:Number(cPhoto. burns[1]), _yscale:Number(cPhoto.burns[1]), _x:returnPosition(cPhoto.burns[3], cPhoto.width2, cPhoto.height2, mcMask._width, mcMask._height).__x, _y:returnPosition(cPhoto.burns[3], cPhoto.width2, cPhoto.height2, mcMask._width, mcMask._height).__y, ease:Linear.easeNone});
    //function that shows a picture(transition function)
    function showPicture(cPhoto:Object) {
        for (var i:Number = 0; i<xml.firstChild.childNodes.length; i++) {
            if (i == _index || i == _index2) {
                mcHolder["mcPhoto"+i]._visible = true;
            }else{
                mcHolder["mcPhoto"+i]._visible = false;
        cPhoto.swapDepths(mcHolder.getNextHighestDepth());
        setTimeout(hideOld,cPhoto.transition*1000,mcHolder["mcPhoto"+_index2]);
        //text
        outText(mcHolder["mcPhoto"+_index2]);
        _index2 = _index;
        inText(cPhoto);
        kenBurns(cPhoto);
        TweenLite.to(mcPreloader,.5,{_alpha:0});
        TweenLite.to(mcBlack,.5,{_alpha:0});
        //transition variable
        _transition = true;
        clearTimeout(transT);
        transT = setTimeout(switchTransition, cPhoto.transition*1000);
        cPhoto.photo._alpha = 0;
        TweenLite.to(cPhoto.photo,cPhoto.transition,{_alpha:100});
        if (_slideshow) {
            //if slideshow is on
            nextT = setTimeout(nextPhoto, (cPhoto.transition+cPhoto.time)*1000);
    function hideOld(what:Object){
    //hyperlinks
    mcHyper.useHandCursor = true;
    mcHyper.onPress = function() {
        if (mcHolder["mcPhoto"+_index].url != "undefined") {
            getURL(mcHolder["mcPhoto"+_index].url, mcHolder["mcPhoto"+_index].target);
    //function that returns a number position from a given "compass position"(for the ken burns effect)
    function returnPosition(pos:String, __width:Number, __height:Number, __width2:Number, __height2:Number):Object {
        var returnObj:Object = new Object();
        switch (pos) {
            case "TL" :
                returnObj.__x = 0;
                returnObj.__y = 0;
                break;
            case "TC" :
                returnObj.__x = -(__width-__width2)/2;
                returnObj.__y = 0;
                break;
            case "TR" :
                returnObj.__x = -(__width-__width2);
                returnObj.__y = 0;
                break;
            case "ML" :
                returnObj.__x = 0;
                returnObj.__y = -(__height-__height2)/2;
                break;
            case "MC" :
                returnObj.__x = -(__width-__width2)/2;
                returnObj.__y = -(__height-__height2)/2;
                break;
            case "MR" :
                returnObj.__x = -(__width-__width2);
                returnObj.__y = -(__height-__height2)/2;
                break;
            case "BL" :
                returnObj.__x = 0;
                returnObj.__y = -(__height-__height2);
                break;
            case "BC" :
                returnObj.__x = -(__width-__width2)/2;
                returnObj.__y = -(__height-__height2);
                break;
            case "BR" :
                returnObj.__x = -(__width-__width2);
                returnObj.__y = -(__height-__height2);
                break;
        return returnObj;
    function switchTransition() {
        _transition == true ? _transition=false : _transition=true;
    function switchVisible(obj:Object) {
        obj._visible == true ? obj._visible=false : obj._visible=true;
    mcTemp._x = -10000;
    //mouse testing
    var mouse_dx:Number = _xmouse;
    var mouse_dy:Number = _ymouse;
    var mouseSpeed:Number = 1;
    function checkPosition(Void):Void {
        if (_xmouse<mouseSpeed || _xmouse>(Stage.width-mouseSpeed) || _ymouse<mouseSpeed || _ymouse>(Stage.height-mouseSpeed)) {
            //mouse outside - hide buttons
            TweenLite.to(btnPrev,.5,{_alpha:0});
            TweenLite.to(btnNext,.5,{_alpha:0});
            TweenLite.to(btnPlay,.5,{_alpha:0});
            TweenLite.to(btnPause,.5,{_alpha:0});
        } else {
            //mouse inside
            TweenLite.to(btnPrev,.5,{_alpha:100});
            TweenLite.to(btnNext,.5,{_alpha:100});
            TweenLite.to(btnPlay,.5,{_alpha:100});
            TweenLite.to(btnPause,.5,{_alpha:100});
    checkPosition(Void);
    var mouseListener:Object = new Object();
    mouseListener.onMouseMove = function():Void  {
        mouse_dx = Math.abs(mouse_dx-_xmouse);
        mouse_dy = Math.abs(mouse_dy-_ymouse);
        mouseSpeed = mouse_dx>mouse_dy ? mouse_dx : mouse_dy;
        mouseSpeed += 1;
        checkPosition(Void);
        mouse_dx = _xmouse;
        mouse_dy = _ymouse;
    Mouse.addListener(mouseListener);
    //global variables
    var this2:Object = this;
    var __width:Number;
    var __height:Number;
    var _index:Number = 0;
    var _index2:Number = -1;
    var _loaded:Number = 0;
    var nextT:Number;
    var transT:Number;
    var _slideshow:Boolean = true;
    var _transition:Boolean = false;
    Stage.scaleMode = "noScale";
    Stage.showMenu = false;
    Stage.align = "TL";

  • Load a MC on the main timeline from a MC.     AS3

    I have a movie clip (mc_menu) on that is on the main timeline.
    This movie clip has buttons that I want to use to display other movie clips on the main (parent) timeline.

    Start here:
    http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7e4e.html

  • 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

Maybe you are looking for

  • Network Shared Hard Drive Mac/PC

    Not really sure where to start this topic, but this seemed a good place to start. Like many of us out there, I have tons GB's of music, video, and pictures stored and backed-up. Well, after doing some research and some hard decision making I bought a

  • E-Mail Home!

    Hi! In this code to send e-mail from my app ... can I have the e-mail message be from a "log.txt" file on my computer? This code now reads text for the body of the e-mail from "This is the text sent in the E-Mail Message!" package AddRFSwitchPac; imp

  • Htree-Value of the parent's selected node

    Hi all! I have an htree in oracle forms10g and I would like to have the value of the parent selected node. There is a function to trap the value of the selected node but I also need the parent's value too. My tree is structured like this company--> d

  • Help! Invite "send a copy to me" functionality is filling up my inbox!

    So, I've been experimenting with InContext Editing the past couple hours and decided I had everything set up as needed to go ahead and invite another user to help me test things out. I followed the "send an invite" process and figured I would go ahea

  • Used Space vs. Free Space

    I am sure I am probably just missing something crucial, since I am almost completely computer illiterate...but, I have taken all of the songs off my iPod and its saying that I have used 3.12 GB and only 620.5 MB free. I only have 1.64 GB of songs in