Swapdepth inside movieclip(s)

I have a question about using Swapdepth.
I have three objects. Simple buttons.
When i'm using SwapDepth it works fine. All objects response
as wanted.
Question/Problem:
When i make one movieclip of all the buttons together, it
won't work anymore.
Buttons stay at the same level. What must i do to get this
work right?
Who can help me?
Greetings,
Peter Tollenaar
The Netherlands.

Hi,
Peter,
Try it
as you said , I create a movie clip named a , then i create 3
more movie clips under the movie clip a named b, c and d and using
this code on the seperate layer on the main time line . I found all
are working properly .
a.b.onPress=function(){
this.swapDepths(this.getNextHighestDepth());
a.c.onPress=function(){
this.swapDepths(this.getNextHighestDepth());
a.d.onPress=function(){
this.swapDepths(this.getNextHighestDepth());
Thanks,
Gunjan

Similar Messages

  • Change Stage Frame From Inside MovieClip?

    How Do I Change Stage Frame From Inside MovieClip?
    Heres my code so far:
    hh.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
    function fl_MouseClickHandler(event:MouseEvent):void
        gotoAndStop(2);
    i tried (root).gotoAndStop(2); but i got an error , #1061 ..
    Thanks in Advance...
    ASAP would be nice..

    well your a smart *** now arnt you   Haha..
    I missed 1 painful word in that line of code thanks heeps..

  • Draw inside movieclip/graphic with Actionscript

    Hi.
    How I can draw inside movieclip/graphic element with Actionscript?
    If i have example movieclip-element in my project and want to draw a single dot in its coordinate (10,10), how I can do that?
    ty m8s!

    The easiest way to draw inside a movieClip is the graphics class.
    You could do something like:
    this.graphics.lineStyle(1, 0x000000);
    this.graphics.moveTo(10, 10);
    this.graphics.lineTo(11, 11);
    This isn't perfect when drawing pixels, however - it only has methods for lines and shapes(circles, rectangles etc).
    If its important for you to draw a single pixel and accuracy is more important you may want to consider converting your Movieclip to a BitmapData class, which has methods for setting Pixels. Realistically though, if you didn't know about the graphics class, then that'll probably be what you're after.

  • Button inside MovieClip don't work...?!

    Hello,
    I\m traying to create AIR for Android app & I have 2 MovieClips in the main timeline the first in frame 35 and the second in frame 99 with the name of quary_mc. Inside the second movieclip there is a button with the name of sID_btn. When i addEventListener in frame 1 of the  main timeline it display:
    Error #1009: Cannot access a property or method of null object reference
    This is the code:
    quary_mc.sID_btn.addEventListener(MouseEvent.CLICK, displayData);
    function displayData(evt:MouseEvent):void
              trace("Hello");
    Regards,

    You will be unable to add the event listener to the button until frame 99 when it actually exists.
    Alternatively, you can just add the button on frame 1 at an alpha of 0 and then set it to 1 at frame 99. However, it will still get mouse input so you will need to set quary_mc.visible = false on frame 1 and quary_mc.visible = true on frame 99 to solve that issue.

  • Indexing instances of specific class inside MovieClip authored with Flash Pro

    Hi there.
    I'm writing a class that extends MovieClip and that is linked to the MovieClip Object authored via Flash Pro during development (Father object).
    The hierarchy of this MovieClip Object is hidden from me - everything I know is that it may contain instances of other Class that was authored during development and extends MovieClip in the same manner (Son objects).
    I have no information regarding names or hierarchical positions of these Son objects inside Father object.
    Now the question is: how to get them listed?
    So approach I've taken was to implement current events:
    public class Son extends MovieClip
         public static const INITIALIZED : String = "son_initialized";
         public function Son ()
              this.dispatchEvent (new Event (INITIALIZED));
    public class Father extends MovieClip
         public var son : Vector<Son>;
         public function Father ()
              son = new Vector<Son> ();
              this.addEventListener (Son.INITIALIZED, this.onSonInitialized);
         public function onSonInitialized (event : Event)
              this.son.push (event.target);
    Well, this code compiles with no errors whatsoever, but it turns out that onSonInitialized gets never called. I assume that's because children constructors are called ahead of their parent one.
    Is there any way to get them listed?
    Thanks in advance.

    kglad,
    I'm trying to get an array of references to Son objects (Son extends MovieClip), randomly located deep inside display list hierarchy of Father object (extends MovieClip too).
    The Father movieclip is authorized in Flash Professional and is a black box for me - I can only manipulate Father.as and Son.as.
    Since I can't know exactly their pathes and names (i.e. father.child1.child5OfChild1.son32 for example), I decided to make them self-aware, dispatching event during construction time, messaging everybody that this instance of Son exists:
    public function Son ()
         this.dispatchEvent (new Event (INITIALIZED));
    And then I attached a listener inside Father's constructor:
    public function Father ()
         this.addEventListener (Son.INITIALIZED, this.onSonInitialized);
    The idea was that this event listener should have been catching all the Sons, located inside Father. But it doesn't work that way - Father's constructor seems to be called after all constructors of its children, so this event listener catches nothing.
    I've worked this around by straightforward display list traversing - it works, but doesn't look so elegant. May be there is still a way to make it work through events?

  • TextInput inside MovieClip

    Hello,
    I am creating a game pretty much like jeopardy. What is
    happening is that you click on the number value you want, like 100
    for example. When it gets clicked on, there is a tween that occurs
    and then the question appears on the screen along with all of the
    contestant names.
    If one of the contestants knows the answer, the 'host' clicks
    on their name. I won't go any deeper than that. I can get the names
    to appear in as text, but it will not appear inside of a movieclip.
    Attached is my code.
    Any help would be greatly appreciated.
    Thanks
    Doug

    all your movieclips have the same instance name. fix that.
    and use the following to reference your textfields:

  • Dynamic text is inside movieClip

    I am working on flash & AS file, in flash file (main.fla) dynamic text is inside that movieClip (myButton) .I will like to send some text to that particular dynamic text field inside the movieClip (myButton) from AS file
    as file code is
    var myButton:Button;
    var myText:text;
    myButton.myText.text="Custom Msg";
    I import .as file in flash but it is not showing can anybody help me?

    This is working fine but my problem is that, in my another application I am importing the class from as file in that as file I have one loop
    if(errorCode == 0){
             trace("welcome ");
             mc.myText.text="Custom Msg";
              }else{
                 trace("Error loging in to Server Error Code : "+ errorCode)
    It will trace message properly
    my problem is that I will like to put "Custom Msg" in dynamic text which is in MovieClip (mc) of fla file, how could I go wtih this ?
    If I include same as file in flash It will shows as error
    1037: Packages cannot be nested. What the solution for this ?

  • Re: Swapdepth and movieclip(s)

    i think your button path changed.
    any_btn.swapDepths(someLayer) -->
    mcName.any_btn.swapDepths(someLayer)
    try this
    "Pemac30" <[email protected]> wrote in
    message
    news:eema71$6k3$[email protected]..
    >I have a question about using Swapdepth.
    >
    > I have three objects. Simple buttons.
    > When i'm using SwapDepth it works fine. All objects
    response as wanted.
    >
    > Question/Problem:
    > When i make one movieclip of all the buttons together,
    it won't work
    > anymore.
    > I mean Swapdepth.
    >
    > Who can help me on my way.
    >
    > Greetings,
    >
    > Peter Tollenaar
    > The Netherlands.
    >

    i think your button path changed.
    any_btn.swapDepths(someLayer) -->
    mcName.any_btn.swapDepths(someLayer)
    try this
    "Pemac30" <[email protected]> wrote in
    message
    news:eema71$6k3$[email protected]..
    >I have a question about using Swapdepth.
    >
    > I have three objects. Simple buttons.
    > When i'm using SwapDepth it works fine. All objects
    response as wanted.
    >
    > Question/Problem:
    > When i make one movieclip of all the buttons together,
    it won't work
    > anymore.
    > I mean Swapdepth.
    >
    > Who can help me on my way.
    >
    > Greetings,
    >
    > Peter Tollenaar
    > The Netherlands.
    >

  • Swapdepth and movieclip(s)

    I have a question about using Swapdepth.
    I have three objects. Simple buttons.
    When i'm using SwapDepth it works fine. All objects response
    as wanted.
    Question/Problem:
    When i make one movieclip of all the buttons together, it
    won't work anymore.
    I mean Swapdepth.
    Who can help me on my way.
    Greetings,
    Peter Tollenaar
    The Netherlands.

    i think your button path changed.
    any_btn.swapDepths(someLayer) -->
    mcName.any_btn.swapDepths(someLayer)
    try this
    "Pemac30" <[email protected]> wrote in
    message
    news:eema71$6k3$[email protected]..
    >I have a question about using Swapdepth.
    >
    > I have three objects. Simple buttons.
    > When i'm using SwapDepth it works fine. All objects
    response as wanted.
    >
    > Question/Problem:
    > When i make one movieclip of all the buttons together,
    it won't work
    > anymore.
    > I mean Swapdepth.
    >
    > Who can help me on my way.
    >
    > Greetings,
    >
    > Peter Tollenaar
    > The Netherlands.
    >

  • Class Inside MovieClip Giving Runtime Error

    Hey guys.
    I'm trying to place an instance of a movieclip (instance
    name: tehMovieClip) from the library within another movieclip
    (instance name: parentMovieClip) on the stage. tehMovieClip, the
    movieclip going inside another movieclip, belongs to a class called
    CollisonDetection (linkage properties, class:CollisonDetection,
    Base Class: flash.display.MovieClip). When I put tehMovieClip
    inside parentMovieClip, I get this runtime error:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    If I just place tehMovieClip on the stage by itself, it works
    fine but I need it to be inside parentMovieClip. So what should I
    do?
    Just for your information, CollisonDetection extends the
    project's DocumentClass which extends MovieClip.
    Thanks in advanced!

    Thanks for that buddy.
    quote:
    Originally posted by:
    SwapnilVJ
    Is the movie clip your are placing linked from library to a
    class?
    The movieclip in question (the one I am placing inside
    another movieclip) is linked to a class.
    quote:
    Originally posted by:
    SwapnilVJ
    If yes. Is the Class linked to the movieclip have a
    Constructor method with parameters?
    Well this is my current constructor:
    public function CollisonDetection() {
    playerRefFromCollisonDetection.x = 600;
    Now that you've said that, I deleted that middle line and it
    seemed to work
    quote:
    Originally posted by:
    SwapnilVJ
    If Yes. you found the problem.
    And solution will be to update the class' constructor to have
    no parameters.
    Thanks buddy, but what if I need to have statements inside
    the constructor such as triggering methods/functions inside the
    class?

  • Loaded video inside movieclip

    Hi everybody,
    I'm working with several videos each inside their own movieclips. When I click my forward button to jump to the next video I get the second
    video playing over the first one especially towards the end part of the first video. I can play and stop the movies just fine but it's the gotoAndPlay that's causing me problems right now with forwarding and rewinding clips.
    Hope my explanation was clear cause I'm just starting out with AS3
    Here's the code if it can be useful,
    Any help would be appreciated.
    import fl.video.*;
    navbar.visible = true;
    navbar.addEventListener(MouseEvent.MOUSE_OVER, showmenu);
    function showmenu(e:MouseEvent):void{
            navbar.alpha = 1;
    navbar.addEventListener(MouseEvent.MOUSE_OUT, hidemenu);
    function hidemenu(e:MouseEvent):void{
            navbar.alpha = 0;
    navbar.next_btn.addEventListener(MouseEvent.CLICK, nextButtonClick);
    navbar.prev_btn.addEventListener(MouseEvent.CLICK, previousButtonClick);
    navbar.play_btn.addEventListener(MouseEvent.CLICK, playButtonClick);
    navbar.stop_btn.addEventListener(MouseEvent.CLICK, stopButtonClick);
    navbar.menu_btn.addEventListener(MouseEvent.CLICK, menuButtonClick);
    function stopButtonClick(e:MouseEvent):void
    if(delay1)
    delay1.VidDesign1.stop();
    delay1.stop();
    else if (delay2)
    delay2.Video2.stop();
    delay2.stop();
    else if (delay3)
    delay3.VidDesign3.stop();
    delay3.stop();
    else if (delay4)
    delay4.VidDesign4.stop();
    delay4.stop();
    else if (analysis1)
    analysis1.VidDesign5.stop();
    analysis1.stop();
    else if (analysis2)
    analysis2.VidDesign6.stop();
    analysis2.stop();
    else if (analysis3)
    analysis3.VidDesign7.stop();
    analysis3.stop();
    stop();
    function playButtonClick(e:MouseEvent):void
    if(delay1)
    delay1.VidDesign1.play();
    delay1.play();
    else if(delay2)
    delay2.VidDesign2.play();
    delay2.play();
    else if(delay3)
    delay3.VidDesign3.play();
    delay3.play();
    else if(delay4)
    delay4.VidDesign4.play();
    delay4.play();
    else if (analysis1)
    analysis1.VidDesign5.play();
    analysis1.play();
    else if (analysis2)
    analysis2.VidDesign6.play();
    analysis2.play();
    else if (analysis3)
    analysis3.VidDesign7.play();
    analysis3.play();
    play();
    function previousButtonClick(e:MouseEvent):void
    if(delay1)
    delay1.VidDesign1.stop();
    delay1.stop();
    else if (delay2)
    delay2.Video2.stop();
    delay2.stop();
    gotoAndPlay("delay1");
    else if (delay3)
    delay3.VidDesign3.stop();
    delay3.stop();
    gotoAndPlay("delay2");
    else if (delay4)
    delay4.VidDesign4.stop();
    delay4.stop();
    gotoAndPlay("delay3");
    else if (analysis1)
    analysis1.VidDesign6.stop();
    analysis1.play();
    else if (analysis2)
    analysis2.VidDesign7.play();
    analysis2.play();
    gotoAndPlay("analysis1");
    else if (analysis3)
    analysis3.VidDesign7.stop();
    analysis3.stop();
    gotoAndPlay("analysis2");
    gotoAndStop(currentFrame - 250);
    function nextButtonClick(e:MouseEvent):void
    if(delay1)
    delay1.VidDesign1.stop();
    delay1.stop();
    gotoAndPlay("delay2");
    else if(delay2)
    delay2.VidDesign2.stop();
    delay2.stop();
    gotoAndPlay("delay3");
    else if (delay3)
    delay3.VidDesign3.stop();
    delay3.stop();
    gotoAndPlay("delay4");
    else if (delay4)
    delay4.VidDesign4.stop();
    delay4.stop();
    else if (analysis1)
    analysis1.VidDesign5.stop();
    analysis1.stop();
    gotoAndPlay("analysis2");
    else if (analysis2)
    analysis2.VidDesign6.stop();
    analysis2.stop();
    gotoAndPlay("analysis3");
    else if (analysis3)
    analysis3.VidDesign7.stop();
    gotoAndStop(currentFrame + 250);     
    function menuButtonClick(e:MouseEvent):void
    if(delay1)
    delay1.stop();
    else if (delay2)
    delay2.stop();
    else if (delay3)
    delay3.stop();
    else if (delay4)
    delay4.stop();
    else if (analysis1)
    VidDesign5.stop();
    else if (analysis2)
    VidDesign6.stop();
    else if (analysis3)
    VidDesign7.stop();
    gotoAndPlay(1);

    if the videos are removed from the stage when you change frames you can use a removed_from_stage listener to stop each video.

  • ActionScript inside Movieclip is SOMETIMES ignored

    Hi,
    I am working on something similar to a slideshow where
    buttons are used to move forward and backward in the time line.
    On one of these "slides" there is another button, a MovieClip
    with a few frames inside (i.e. the rollover and mousedown states
    etc.) and ActionScript in Frame 1 that make the button work
    (rollovers and the like).
    If I play forward in this slideshow, everything works.
    If I play backwards to the frame that has this button, then
    all ActionScript inside this button is completely ignored
    (including trace), and the button will endlessly cycle through the
    frames inside (even though I tried various STOP commands from
    inside and outside the movieclip).
    The interesting thing is that I have a very similar slideshow
    with a similar button that does NOT have this issue. If I
    copy/paste the working button to replace the bad one, the same
    thing happens to this button, so it somehow is local to this one
    file.
    There are no error messages coming up, and I don't even know
    if there IS any code that would disable script inside a movieclip.
    I checked the code inside the MovieClip and found nothing
    wrong - it only has the stop command, a few addevenlisteners and
    their corresponding functions in frame 1.
    I just don't get why it works in one file but not in this one
    - the best part is that whenever I create a new slideshow, I simply
    create a copy of the last slideshow file, so the basics of all
    these files should be identical...
    Another thing that completely throws me for a loop is that
    when I add any random shape (e.g. a square) into the frame that has
    the BACK button that brings me to the broken button, then it works!
    So I have a workaround, but I would really like to know what
    causes this - I'd prefer a fix to a workaround that might break
    some day, too.
    Any idea what could possibly cause something like this and
    what I can do about this?
    Thanks!

    you probably have a corrupt swf.
    to test, copy all the assets to new swf and see if the problem persists.

  • Inside movieclip script?

    Hey, I am wondering how I can use a script inside a movieclip outside the movieclip, for an example. The first frame in the movie clip:
    var RoXYZ
    RoXYZ = 3.14;
    And outside the movieclip it's:
    circle._visible = true;
    RoXYZ = 3.1415926535
    if(RoXYZ == 3.14){
    circle._visible = false;
    What i am trying to do is that if the movieclip reaches a specific frame a script is triggered. Is this possible?

    From inside a movieclip you can talk to the _parent object/timeline using "_parent" to target it.  So if you wanted to tell the _parent to move to a certain frame, inside the movieclip you could use...
    _parent.gotoAndStop(some frame);
    Or if there was a function in the _parent you could use...
    _parent.someFunction();
    or maybe...
    _parent.someFunction(RoXYZ); // passing the RoXYZ variable as an argument
    And if you needed to target the main timeline from inside some buried movieclip, you can use _root instead of _parent.

  • Accessing Button inside Movieclip/ScrollPane

    Hello all,
    I'm trying to understand how to build a button inside a movieclip.  I have a template that has movieclips within movieclips, and when I create a button (all using AS2) the button will work if I test the scene, but in the whole flash movie it does not work.  I also have some buttons located inside a ScrollPane that also do not call correctly.
    For my button I am using this code:
    facebookbtn.on (release) {
    getURL("http://www.facebook.com/","_blank","GET");
    ^ This is placed on the button "facebookbtn". I also tried using: _root.bgPages.pg1.facebookbtn.on (release), to no avail.
    For the one inside a ScrollPane I am attempting to call a javascript function:
    on(release){
         import flash.external.ExternalInterface;
         ExternalInterface.call("GroupDelegate","dayone1");
    ^ This also does not work, with or without the button name before on(release).
    I'm putting the FLA file here so that if anyone has the time, could help me with this quick problem. Thanks!
    FLA: Download FLA

    Do not place code inside objects with code on(blah2x). It will lead to unpredictable behaviors and besides it is bad practice. Centralize all your code on one frame in the timeline. Use this format on the main timeline:
    import mx.utils.Delegate; //declare at top only ONCE
    YourButton.onRelease = Delegate.create(this, YourFunctionCall);
    or
    YourButton.onRelease = function()
       //do your stuff here
    Do the same thing with the ExternalInterface. You can put the import at the top along with Delegate.

  • StageWebViewBridge from inside MovieClip [HELP]

    I'm trying to implement stageWebViewBridge from inside of a movieclip ..   It's generating this issue because stage is null.     Does anyone know how to implement this inside a movieclip ?
    Error: StageWebViewDisk.initialize( stage ) :: You must provide a valid stage instance
    // this is our main view
    var view:StageWebViewBridge;
    //**** STAGE WEBVIEW BRIDGE
    /* init the disk filesystem */
    StageWebViewDisk.addEventListener(StageWebviewDiskEvent.END_DISK_PARSING, onInit );
    StageWebViewDisk.setDebugMode( true );
    StageWebViewDisk.initialize(stage);

    well your a smart *** now arnt you   Haha..
    I missed 1 painful word in that line of code thanks heeps..

Maybe you are looking for