Buttons in nested MovieClips

Forum,
I'm making a zoomable and panable graphic and I have used
four nested MCs as follows:
main_mc->zoom_mc->pan_mc->content_mc. Main is top level
and contains everything, zooming is done on zoom_mc, panning on
pan_mc and my content is in content_mc. The zooming and panning
works perfectly. The trouble I run into is that the buttons in
content_mc do not respond and this I believe is because they are
shadowed by the events on the higher MCs. I need them in this MC
because I want the buttons to pan and zoom too. What is the
mechanism here and is there any way of dealing with this? I live my
buttons to respond when I rollover and click them and also be able
to pan and zoom using the other MCs. I would not mind being able to
switch the panning/zooming on and off to enable the buttons to work
when needed. Is this asking too much of it? Any ideas
appreciated.

You'd be correct.
MC1 Zoom / MC2 Pan
MC3 MC with buttons
Because MC1 and 2 have actions attached to them, any actions
associated with the MC3, will effectively be ignored or rather, be
inaccessible. The way to handle this is checking for bounds on the
same level as the MC1 and 2 and delete their handlers so that MC3s
handlers become accessible. When you're done with the handlers
(outside the bounds of being able to do so) you just recreate the
pan and zoom handlers. There is a tutorial at gotoandlearn.com that
can show you exactly how something like this is done with a
thumbnail scroller. try that if it is at all possible in your
setup

Similar Messages

  • How to stop and resume the animations of nested movieclips

    Hi
    I have many nested movieclips  in different positions of the main timeline.
    I have 2 buttons, play_btn and pause_btn.
    I'd like when the user click pause_btn, the animations on the main timeline and in nested movieclips stop.
    Whe he click play_btn the animations resume in both the main timeline and nested movieclips.
    I have created array of nested movieclips on the main timeline.
    var arr:Array = new Array(mc1, mc2, mc3, mc4, mc5);
    play_btn.addEventListener(MouseEvent.CLICK, on_play_btn);
    pause_btn.addEventListener(MouseEvent.CLICK, on_pause_btn);
    function on_play_btn(e:MouseEvent):void
         gotoAndPlay(currentFrame);
         for(var i:Number = 0; i < arr.length; i++)
             if(arr[i] != null)
                 arr[i].play();
    function on_pause_btn(e:MouseEvent):void
         gotoAndStop(currentFrame);
         for(var k:Number = 0; k < arr.length; k++)
             if(arr[k] != null)
                 arr[k].stop();
    but it only stops the animations on the main timeline and dosen't stop the animations in the nested movieclips.
    Help me Please.

    I'm having the same issue.I have a main timeline, which has nested movieclips with there own timelines and motion tweens. Using the new motion tween, and not the classic tween, which may or may not be the problem.
    Was having a similar issue with stopping the timeline, the main timeline would stop, but the nested movieclips would keep going. Found this blog post that helped.
    http://blog.nobien.net/2009/02/05/as3-stopping-all-timeline-animations/
    Used the code below to stop everything by passing the stage as the displayObject. Worked great, but now i'm having the reverse issue. When I resume play, the nested movieclip timeline stays exactly where I stopped it, and the main timeline resumes play. If there are a 100 frames in the nested movieclip, once it reaches the 101st frame, the main timeline kicks in again.
    function stopAllChildMovieClips(displayObject:DisplayObjectContainer):void{
            var numChildren:int = displayObject.numChildren;
            for (var i:int = 0; i < numChildren; i++) {
                var child:DisplayObject = displayObject.getChildAt(i);
                if (child is DisplayObjectContainer) {
                    if (child is MovieClip) {
                        MovieClip(child).stop();
                        stopAllChildMovieClips(DisplayObjectContainer(child));

  • Events and nested movieclips issue

    Hi,
    I am having the following issue with this navigation I am building. I am trying to build a 3 tear drop down navigation, where each buttons sub menu is placed inside that button. My buttons are actually just movieclips, so I have nested movieclips structured something like this:
    Button_1
        -> Button_1_1
        -> Button_1_2
               --> Button_1_2_1
               --> Button_1_2_2
        -> Button_1_3
    Button_2
    Button_3
    Each one of the buttons has their own class with it's event listenerens inside it. What happens now, is that when I click for example Button_1_2_1, I get it's event, but also, the event for Button_1_2 and Button_1. Initially, I fixed this, by attaching the events to a hitArea inside that movieclip, but now I am running into other issues and was wondering if there was a way to turn this off, so if movieclip for Button_1_2_1 is clicked, I only get the event for that one, not it's parents?
    Thanks a lot for any help!

    you're welcome.
    p.s.  in the future, please mark helpful/correct answers.

  • Nested MovieClips

    I have a problem that I think is a simple one but I cannot seem to figure it out, and it has been 2 days of fighting wiht it so I am here to plea for help from the collective experts. Here is the issue.
    I have created a movieClip which is just a rectangle shape that has an interior timeline which object tweens from a 2x200 pixel to a 200x200 pixel shape.
    This movieClip has an instance name of menu_2.
    After the tween happens inside menu_2, on the stop(); frame I have placed another movieClip with an instance name of mi_1. This clip is 100 x 35 pixels and site floating inside the menu_2 MovieClip. Inside this movieClip there is a timeline where there are a "the_start" and a "the_end" label on either end of the timeline each with stop(); comands and some graphics which change opacity.
    What I cannot seem to get to happen is to activate the timeline inside the mi_1 MovieClip. What I would like to happen is that when the user mouses over the mi_1 movieClip, it triggers a number of events, along with triggering playing the timeline inside of mi_2.
    Here is the code I have tried on the main (scene 1) timeline. None of which have worked.
    menu_2.mi_1.onRollOver = function() {
         menu_2.mi_1.gotoAndStop("the_end");
    mi_1.onRollOver = function() {
         mi_1.gotoAndStop("the_end");
    menu_2.onRollOver = function() {
         mi_1.gotoAndStop("the_end");
    menu_2.onRollOver = function() {
    this. mi_1.play();
    Here is the code I have tried inside the menu_2 MovieClip on the same frame as the mi_1 has been placed;
    this.onRollOver = function() {
         mi_1.gotoAndStop("the_end");
    mi_1.onRollOver = function() {
         gotoAndStop("the_end");
    this.onRollOver = function() {
         this.gotoAndStop("the_end");
    Nothing seems to be working.
    I'll send anyone the FLA willing to help...
    Help!
    Forrest

    That's what I thought too Ned. All the reseach I did, tells me that is how you access a nested movieClip in another MovieClip.
    Your visible code works as it should, but I still cannot get the nested MovieClip to be affected by a call to action on the main timeline.
    menu_2.mi_1.onRollOver = function() {
         menu_2.mi_1.gotoAndStop("the_end");
    Did not do anything. I would have just used a button with roll over effects, but a button also seems to be masked inside the menu_2 mc.
    aarrrg.

  • Is there any way to save an image from a nested movieclip as a .png using PNGEncoder

    Hello all,
    I am new to AIR and AS3 and I am developing a small AIR desktop application in Flash CS5 that saves a user generated image locally to their computer. 
    The image is generated from a series of user choices based on .png files that are loaded dynamically into a series of nested movieclips via XML.  The final image is constructed by a series of these "user choices".
    Sourcing alot of code examples from here and there, I have managed to build a "working" example of the application.  I am able to "draw" the parent movieclip to which all the other dynamic movieclips reside and can then encode it using PNGEncoder.  The problem is that the images loaded dynamically into the nested movieclips show as blank in the final .png generated by the user.
    Is there a way to "draw" and encode these nested movieclips or do I need to find another way?  I can provide my clumsy code if required but would like to know if this concept is viable before moving any further.....
    Thanks in advance....

    Thanks for the files.......
    Yeah I'm doing it in Flash but importing the images via an xml document.  The problem isn't in being able to view the eyes (based on the selection of the user) its when I go to save the resulting image as a .png.  When I open up the saved .png the eyes are blank even though they are visible in the swf
    Even when the user clicks on the option to copy the image to the clipboard, it works as intended.
    My only guess is there is an issue with the way my xml is loading (but this appears to work fine) or when the file is converted and saved.....
    As I said I'm still learning but surely there must be a simple answer to this....
    I have included the xml code I am using and also the save code to see if anyone spots an issue..... (I hope I copied it all)
    // XML
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    var xmlRequest:URLRequest = new URLRequest("imageData.xml");
    var xmlLoader:URLLoader = new URLLoader(xmlRequest);
    var imgData:XML;
    var imageLoader:Loader;
    var imgNum:Number = 0;
    var numberOfChildren:Number;
    function packaged():void
    rawImage = imgData.image[imgNum].imgURL;
    numberOfChildren = imgData.*.length();
    imageLoader = new Loader  ;
    imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedImage);
    imageLoader.load(new URLRequest(rawImage));
    faceBG_mc.Eyes.addChild(imageLoader);
    function loadedImage(event:Event):void
    imageLoader.x = -186;
    imageLoader.y = -94;
    imageLoader.width = 373;
    imageLoader.height = 186;
    //  Clipboard
    btn_Copy.addEventListener(MouseEvent.CLICK, onCopyClick);
    function onCopyClick(event:MouseEvent):void
    var bd:BitmapData = renderBitmapData();
    Clipboard.generalClipboard.setData(ClipboardFormats.BITMAP_FORMAT, bd);
    function renderBitmapData():BitmapData
    var bd:BitmapData = new BitmapData(faceBG_mc.width,faceBG_mc.height);
    bd.draw(faceBG_mc);
    return bd;
    // Save faceBG_mc as .png 
    var fileRef:FileReference = new FileReference();
    var myBitmapData:BitmapData = new BitmapData (faceBG_mc.width,faceBG_mc.height, true, 0);
    myBitmapData.draw(faceBG_mc);
    var myPNG:ByteArray = PNGEncoder.encode(myBitmapData);
    function onSaveClickPNG(e:Event)
    fileRef.save(myPNG, "myPNG.png");
    So my problem is....
    The final image is copied to the clipboard with the eyes visible - yes
    The eyes appear in the image in the swf as intended - yes
    When the image is saved as a .png and is meant to include the eyes, they are blank (see picture above)
    I hope this helps.....
    Thanks in advance

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

  • Buttons in a movieclip react too slow (AIR all versions - in Android: impossible to use)

    Hi to all,
    I'm just correcting the title (or subject) of this post:
    http://forums.adobe.com/message/3438581#3438581
    ("adobe? seems there is a bug in buttons behaviour!! (not really air only)")
    Adobe team, please give some feedback. Can't go on with Android app.
    or maybe somebody knows a workaround?
    (similar problems with buttons created with movieclips via actionscript.. project stalled)

    to troubleshooting the bug (seems not to be just a bug; seems to be something worst at low level of AIR kernel at movieclips mechanism):
    with an android device (I'm using Sambsung Galaxy Tab - 7" display resolution) go to Android Market, search for 'mc2labs' and select 'Mc2labs Realpad debug version'.
    NB please note: 'DEBUG VERSION' only helps to debug:
    two standard "Enter" buttons:
    the left one is on main timeline, the right one is on a movieclip (on main timeline). note the difference on the black board on the left:
    mouse events for "on main timeline"  button works fine
    mouse events for "on mc" button doest NOT work fine

  • Buttons "Hidden" Behind Movieclip?

    Is there a way to make buttons BEHIND a movieclip "hidden"? I
    don't want to completely disable the buttons. I just need for the
    buttons not to work behind the movieclip that is in the front. I'd
    like for what's not covered up of the buttons to still work once
    you mouseoff the movieclip. Is this possible?

    msmith29212,
    > Is there a way to make buttons BEHIND a movieclip
    > "hidden"? I don't want to completely disable the
    > buttons. I just need for the buttons not to work behind
    > the movieclip that is in the front.
    Honestly, disabling is the easiest way to go, here. Have you
    experimented with the Button.enabled property on any of those
    button
    instances? You could handle the MovieClip.onRollOver event to
    set the
    buttons' enabled property to false, then back to true for
    MovieClip.onRollOut.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Buttons inside a movieclips won't work...

    I have a movieclip that has several buttons inside it. When I use this code:
    mc.onRollOver = function()
         // do stuff
    The buttons won't work anymore..

    Hello there Mr. Ned Murphy,
    Is there any other way to make buttons inside a movieclip work?
    The scenario of my project is having a panel for control buttons, progress bar, sound buttons(on/off). When the cursor is rollover the panel, it will animate going up to reveal buttons which hidden below, for the shortcut of every scenes.
    This is what I got.
    control_panel_mc->2 frames w/ stop(); on each->2 layers->1st layer(bottom)panel contains buttons->2nd layer(contains button w/ a "swapdepths very important")
    and on the 2nd frame 2nd layer theres no button w/ a swapdepths and on the actionscript I have that code: mc.onRollOut = function{ //do something };
    Any other suggestion please...
    Thanks and more power,

  • Stop all nested movieclips

    Hello,
    I made a series of nested movieclips, and to stop all motion i wrote this code:
    on (press) {
    MCinMCinMC.stop();
    MCinMCinMC.MCinMC.stop();
    MCinMCinMC.MCinMC.MC.stop();
    MCinMCinMC.MCinMC1.stop();
    MCinMCinMC.MCinMC1.MC.stop();
    MCinMCinMC.MCinMC2.stop();
    MCinMCinMC.MCinMC2.MC.stop();
    MCinMCinMC1.stop();
    MCinMCinMC1.MCinMC.stop();
    MCinMCinMC1.MCinMC.MC.stop();
    MCinMCinMC1.MCinMC1.stop();
    MCinMCinMC1.MCinMC1.MC.stop();
    MCinMCinMC1.MCinMC2.stop();
    MCinMCinMC1.MCinMC2.MC.stop();
    MCinMCinMC2.stop();
    MCinMCinMC2.MCinMC.stop();
    MCinMCinMC2.MCinMC.MC.stop();
    MCinMCinMC2.MCinMC1.stop();
    MCinMCinMC2.MCinMC1.MC.stop();
    MCinMCinMC2.MCinMC2.stop();
    MCinMCinMC2.MCinMC2.MC.stop();
    This code works fine, but can somebody explain how to write this in a more compact way?

    Thank you very much!  This will save me an awful lot of typing.
    The thing with me and actionscript is, when i read it, i understand what it does, but i have a lot of trouble writing it.

  • Buttons with nested movies clips...

    Hi guys
    I'm a flash newb. Have just read some tutorials on creating
    flash buttons that contain nested movie clips for the different
    states. So I went and made 5 of them for my site, all seems great
    the rollover effects are just as planned, and I thought I could add
    URL link to them in Dreamweaver but thats not working out. Been
    googling my *** off to add URL via actionscript (of which I
    understand VERY little) , found some code (add the following to key
    frame :on(release) {
    getURL('
    http://www.generic.com',
    '_parent');
    Major problem is, when I try to add AS to the frame/button,
    I'm getting told I 'current selection cannot have actions applied
    to it' If I persist and add the script anyway, funnily enough it
    doesn't work.
    I did an experimental button, consisting of diff coloured
    boxes, and AS will apply to that no problem.
    I'm tearing my hair out, as I already posted the flash links
    on my site and have had to add a note for visitors to use static
    links in the interim.
    I would love to post the .fla file but I don't see an option
    anywhere here to do so.
    If some wise soul can help my dumb *** out of this bind it
    would be greatly appreciated.

    You were using AS2 code, which will not work in AS3. That
    particular code is placed on an object, which AS3 does not allow
    for, which is why it wouldn't let you... all code in AS3 goes into
    timeline frames.
    For mouse interctive objects (buttons, movieclips, etc) you
    assign event listeners to the object. Let's say your button has an
    instance name of "btn", here's a variety of the possible event
    listeners avaiable, and I've assigned them to the button....
    btn.addEventListener(MouseEvent.CLICK, clickHandler);
    btn.addEventListener(MouseEvent.DOUBLE_CLICK,
    doubleClickHandler);
    btn.addEventListener(MouseEvent.MOUSE_DOWN,
    mouseDownHandler);
    btn.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
    btn.addEventListener(MouseEvent.MOUSE_OVER,
    mouseOverHandler);
    btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    btn.addEventListener(MouseEvent.MOUSE_WHEEL,
    mouseWheelHandler);
    All of those "...Handler" things at the end are the names of
    functions you create to take action when the listener hears
    something it's assigned for... you can name them anything you want,
    and here's and example of how the function might look for the CLICK
    event...
    function clickHandler(event:MouseEvent):void {
    trace("clickHandler");
    Again, you can name the function anything you want, and the
    code within the function can be whatever you need done when the
    button is clicked... just be sure to include the argument
    "event:MouseEvent" because the listeners throws an argument to the
    function and the function needs to expect it. The "event" part of
    that is a variable name, so you can name it whatever you like, such
    as "e", which is commonly done. The MouseEvent defines the class,
    and should be exactly what it is.... a MouseEvent, caps and
    all.

  • Access a button inside a movieclip

    Hey...
    Im pretty new to flash, I have a problem that have taken hours, only not to getting sorted out, so i'll try my luck here...
    I've basicly made a rollover menu which is nested inside a movieclip. the movieclip is put on 1 st. frame on the main timeline and I want the buttons inside the movie clip to take the user to a different frame on the main timeline, but no matter what I do it's just not working...
    here is some of he solutions i have tried to do:
    function work1(e:Event)
    //MovieClip(parent.parent).gotoAndStop("work1")
    //gotoAndStop("work1")
    //this.gotoAndStop("work1")
    //parent(gotoAndStop("work1"))
    //MovieClip(this.parent).gotoAndStop("work1")
    //MovieClip(parent.gotoAndStop("work1"))
    //this(gotoAndStop("work1"))
    //main.gotoAndStop("work1")
    //root.gotoAndStop("work1")
    //MovieClip(root).gotoAndPlay("work1")
    //MovieClip(stage).gotoAndPlay("work1")
    //MovieClip(root.parent.parent).gotoAndStop("work1");
    work1_btn.addEventListener(MouseEvent.CLICK, work1);
    hope someone can help...

    sure, there are a zillion ways, that timeout function was more to demonstrate the problem than offer a valid solution...
    Personally, with what you're doing, here's my first inclination for handling it:
    Just add this bit, dumping that other stuff:
    stage.addEventListener(MouseEvent.CLICK, clickHandler);
    function clickHandler(event:MouseEvent):void{
         if (event.target is SimpleButton&&event.target.name!=null){
              gotoAndPlay(event.target.name);
    That assumes you've given those buttons the same name as the frame you want them to go to. In your example, rename that first button as work1, and that code will send you to the frame with that name on click. That code will handle all the buttons, assuming you name the frame and button instances the same (like button work2 would take you to a frame named work2 etc).
    Since it's a stage click handler, it can handle any click. Here's the breakdown:
    //adding a global click listener.
    stage.addEventListener(MouseEvent.CLICK, clickHandler);
    //what to do with the click
    function clickHandler(event:MouseEvent):void{
         //here we're just checking to see what's clicked (from your example, they are SimpleButtons)
         //and then the && means 'and'  we're making sure that button has a name.
         if (event.target is SimpleButton&&event.target.name!=null){
              //goto the frame with the same name as the button
              gotoAndPlay(event.target.name);
    HTH,
    -Ted

  • How do you run loop functions on specific frames of nested Movieclips?

    I'm still pretty new to AS3 and I've run into a problem that I never had with AS2.  I have a project where the 1st frame of the main timeline is the loading screen and the second frame has buttons and a title bar that I want to be on every "page" of my project.  There are 7 buttons that take the user between 7 different "pages", which consist of 7 frames of a movieclip I have filling the content area on frame 2 of my main timeline.  I'll call this movieclip "pages_mc".
    The problem is that frame 6 of the pages_mc movieclip has the following code:
    var moving = 0;
    var xmoved;
    var xbegin = pano_cont.pano_image.x;
    parts_mc.addEventListener(Event.ENTER_FRAME, moveImage); // constantly moves the image 1 pixel left or right depending on the button pressed
    btn_left.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft); //changes the variable "moving" to 2 on mouse down
    btn_right.addEventListener(MouseEvent.MOUSE_DOWN, moveRight); //changes the variable "moving" to 1 on mouse down
    btn_left.addEventListener(MouseEvent.MOUSE_UP, stopMoveLeft); //changes the variable "moving" to 0 on mouse up
    btn_right.addEventListener(MouseEvent.MOUSE_UP, stopMoveRight); //changes the variable "moving" to 0 on mouse up
    function moveImage(e.Event):void{
    xmoved = xbegin - pano_cont.pano_image.x;
        if(moving == 1)
            pano_cont.pano_image.x -= 1;
        if(moving == 2)
            pano_cont.pano_image.x += 1;
        if(xmoved < -(pano_cont.pano_image.width/2)+180)
            pano_cont.pano_image.x = -2538;
        if(xmoved > (pano_cont.pano_image.width/2)- 180)
            pano_cont.pano_image.x = -2178;
    function moveRight (e:MouseEvent):void
        btn_right.gotoAndStop("down");
        moving = 1;
    function moveLeft (e:MouseEvent):void
        btn_left.gotoAndStop("down");
        moving = 2;
    function stopMoveLeft (e:MouseEvent):void
        moving = 0;
        btn_left.gotoAndStop("active");
    function stopMoveRight (e:MouseEvent):void
        moving = 0;
        btn_right.gotoAndStop("active");
    This is all just some code to allow users to move a panaromic image around on the screen.  But when I navigate to a different page from of my pages_mc movieclip I get the following output message:
    TypeError: Error #1099: Cannot access a property or method of a null object reference.
         at SampleProject_fla::Content_MC_1/moveImage()
    I'm thinking this is happening because the "parts_mc" movieclip I referenced for the ENTER_FRAME event listener no longer exists (unless you go back to frame 6 of pages_mc).  I'm not sure how to remove this event listener when the user moves to another frame of pages_mc.
    Any help would be greatly appreciated.

    kglad wrote:
    what's parts_mc.parts_mc???
    Not sure where you see that.  I see pages_mc.parts_mc which is just because the parts_mc movieclip is nested on the 6th frame of the pages_mc movieclip.
    At any rate, I was able to get it working by moving all the code onto frame 2 of the main timline and declaring all of my vairables on frame 1 of the main timeline.  I then added an ENTER_FRAME event listener onto one of my movieclip buttons (main_btn) on the main timeline and had it check what frame the pages_mc movieclip was on.  If it was frame 6, I then executed the moveImage function and had it remove the event listener from the main_btn movieclip if the frame changed away from frame 6.
    Seems to be working so far.
    Here's the code:
    Frame 1
    /* Declaring variables. */
    var pagenumber:Number;
    var moving:Number = 0;
    var firstTime:Number = 0;
    var xmoved:Number;
    var xbegin:Number;
    Frame 2
    pages_mc.addEventListener(Event.ENTER_FRAME, pageNum);
    pages_mc.addEventListener(Event.ENTER_FRAME, BtnSelParts);
    /* Keeps track of current page. */
    function pageNum(e:Event):void
        pagenumber = pages_mc.currentFrame;
        title_bar.gotoAndStop(pages_mc.currentFrame);
    function BtnSelParts(e:Event):void
        if(pagenumber == 6)
            btn_parts.gotoAndStop("current");
            if(firstTime == 0)
                btn_main.addEventListener(Event.ENTER_FRAME, moveImage); //moves the panorama image left or right
        else
            if(btn_parts.currentFrame == 32)
                btn_parts.gotoAndStop(1);
    function moveImage(e:Event):void
        if(pagenumber==6)
            if(firstTime == 0)
                pages_mc.btn_left.addEventListener(MouseEvent.MOUSE_OVER, overLeft); //animates left arrow button on rollover
                pages_mc.btn_right.addEventListener(MouseEvent.MOUSE_OVER, overRight); //animates right arrow button on rollover
                pages_mc.btn_left.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft); //changes the variable "moving" to 2 on mouse down
                pages_mc.btn_right.addEventListener(MouseEvent.MOUSE_DOWN, moveRight); //changes the variable "moving" to 1 on mouse down
                pages_mc.btn_left.addEventListener(MouseEvent.MOUSE_UP, stopMoveLeft); //changes the variable "moving" to 0 on mouse up
                pages_mc.btn_right.addEventListener(MouseEvent.MOUSE_UP, stopMoveRight); //changes the variable "moving" to 0 on mouse up
                pages_mc.btn_left.addEventListener(MouseEvent.MOUSE_OUT, rollOutLeft); //animates left arrow button on rollout
                pages_mc.btn_right.addEventListener(MouseEvent.MOUSE_OUT, rollOutRight); //animates right arrow button on rollout
                xbegin = pages_mc.parts_mc.pano_image.x;
                firstTime = 1;
            xmoved = xbegin - pages_mc.parts_mc.pano_image.x;
            if(moving == 1)
                pages_mc.parts_mc.pano_image.x -= 1;
            if(moving == 2)
                pages_mc.parts_mc.pano_image.x += 1;
            if(xmoved < -(pages_mc.parts_mc.pano_image.width/2)+180)
                pages_mc.parts_mc.pano_image.x = -2538;
            if(xmoved > (pages_mc.parts_mc.pano_image.width/2)- 180)
                pages_mc.parts_mc.pano_image.x = -2178;
            if(pages_mc.parts_mc.pano_image.pano1.currentFrame == 1)
                pages_mc.btn_sel.gotoAndStop(1);
            if(pages_mc.parts_mc.pano_image.pano1.currentFrame == 2)
                pages_mc.btn_sel.gotoAndStop(2);
            if(pages_mc.parts_mc.pano_image.pano1.currentFrame == 3)
                pages_mc.btn_sel.gotoAndStop(3);
        else
            btn_main.removeEventListener(Event.ENTER_FRAME, moveImage);
            firstTime = 0;
    } // controlls the panaromas
    Let me know if you see any problems with this.
    Thanks again.

  • Problem accessing nested MovieClips

    Hi I'm trying to add an event Listener to a button that is nested inside a movieclip, and that movieclip is nested inside another movieclip, but I get a null object reference error where I add the event listener:
    public function OptionsClass(model:GameModel, stage:Object) {
                                  // constructor code
                                  _gameModel = model;
                                  _stage = stage;
                                  _optionsClip = new Options();
                                  _optionsClip.gotoAndStop(1);
                                  addChild(_optionsClip);
                                  _optionsClip.optionsMC.controlsBtn.addEventListener(MouseEvent.MOUSE_DOWN, onControlsBtnDown); -->ERROR
                                  _optionsClip.optionsMC.backBtn.addEventListener(MouseEvent.MOUSE_DOWN, onBackBtnDown);
    all the instances are named correctly on the movieclips so I don't know what the problem is. If anyone knows what I'm doing wrong please let me know, thank you.

    NEVERMIND I FIXED IT, I HAD THE LABELS WRONG, SORRY

  • How do I use a button within a movieclip to go to the root?

    Hi there, I am new to flash and AS3 and need some help
    getting my buttons to work.
    I made a script for the file that i am working with that has
    buttons located within 2 movieclips. I want that button to load and
    image into a UILoader (problemLoader_mc) that I placed on the stage
    on the main timeline (the timeline that contains WeekBar_mc). The
    problem is that I don't know how to get to the root of the file to
    start a new directory to tell my function to load the image i want.
    I have tried multiple approaches including:
    MovieClip(root).problemLoader_mc.source = problemArray[0]
    MovieClip(parent).problemLoader_mc.source = problemArray[0]
    root.problemLoader_mc.source = problemArray[0]
    parent.problemLoader_mc.source = problemArray[0]
    (root as MovieClip).problemLoader_mc.source = problemArray[0]
    If anyone can help me out with this, I would greatly
    appreciate it, I am banging my head against a wall at the moment.
    (Also, please excuse my vague descriptions, I am still learning the
    official terms.)
    Here is the code that I have written that pertains to this
    problem:

    I have a mental block for reasoning things out as far as
    assigning the listener to an object two mc's away from the main
    timeline while having the function in the main timeline, so I may
    play with that on my own for awhile. One thing you didn't do
    though, was to pay the same attention to the problemArray[0]
    assignment in that function, which I assume also lives in the root.
    But here's what I'd do for the moment.
    Take all that code except the array and plant it in the
    timeline where WEEK1btn lives, modifying it as follows....
    WEEK1_btn.addEventListener(MouseEvent.CLICK, pload1);
    function pload1(event:Event)
    MovieClip(this.parent.parent).problemLoader_mc.source =
    MovieClip(this.parent.parent).problemArray[0];
    I haven't utlized root myself yet, so I am not comfortable
    offering you a solution that attempts it.

Maybe you are looking for

  • How do I seperate a single page out of an InDesign Document?

    I've created an 8 page catalog in InDesign- now a sales rep. wants just two of the pages singly as PDF files.  What is the best way to do this?  I know I can export the whole thing as a PDF, then use Acrobat to separate the pages, or I can print to A

  • How to learn webdynpro for java/ABAP

    hI Experts, i am new to webdynpro technology. and i am having the knowlgedge on Portal contenet development&administration,and having the strong knowledge on Visual composer7.0,7.1 and also trined in ABAP(currently i am not useing it). now i wants to

  • Weather and Stocks Widgets Offline, wifi proxy the cause?

    While connected to a wifi network with a proxy server, weather and stocks in the notification center indicate offline.  The network has a proxy auto-config which is set up for the network.  The weather and stock apps have no issue while connected to

  • Error with Update Rule Formula

    I have the following formula in an update rule CALMONTH_FISCPER( Calendar Year/Month, 'SO', 1 ) and get the error (below) when loading data to the cube (loads ok to PSA).  I have checked ROUTINE_0001 via the Generated Program and it is referring to a

  • My ipad deleted everything

    I downloaded iTunes onto my laptop. Then I connected my iPad to the laptop and it was syncing for a while. When I came to my iPad, everything had been deleted! Is there a way to recover all my music, apps, and photos? I don't have anything on my iTun