Button inside an external MC to unload itself

Hi everyone,
The title is pretty self explanatory. I know this subject I've been previously covered but it still unclear with the code I'm using. Please help.
This is the code I put on the main movie clip to load it:
var request:URLRequest = new URLRequest("externalMC.swf");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);
and this is the code inside the externalMC that contains a button called closeButt
closeButt.addEventListener(MouseEvent.CLICK,closeT );
function closeT(e:Event):void{
  this.parent.removeChild(this);
I'm doing something wrong obviously but I know I'm not far from the answer, just can't get it...
Thanks

if publishing for fp10 or better, use:
closeButt.addEventListener(MouseEvent.CLICK,closeT );
function closeT(e:Event):void{
  Loader(this.parent).unloadAndStop();

Similar Messages

  • Unloading a loaded external SWF with a close button on the external SWF to unload

    I have found some discussion on this topic but I am still having trouble getting it to work and was hoping to get some help here.
    Here I have a file: http://www.dril-quip.com/test/main.swf
    I have: main.swf (a menu) and I have module.swf (content)
    If you navigate to Subsea Wellhead Systems/SS-15 BigBore II and click on that I have it load an external swf which covers most of the parent.
    So far so good. My problem is unloading the loaded 'Child' swf with the button provided on the loaded 'Child' swf.
    below is the code I used to load the file but I cant, for the life of me, find a way to unload it.
    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
    function bigborecontent(event:MouseEvent):void{
    var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
    bigboreLoader.load(bigboreRequest);
    stage.addChild(bigboreLoader);
    I am certain it requires the Child to communicate with the parent somehow but I am at a loss. If I could get a bit of advice or a link to something deal with this, it would be a big help. I just need to have my links load my modules and the remove them when the close buttong is hit on the loaded swf. I promise I have done searches and I admit I have found asnwers but still they are not working. I found the code below:
    Main FLA:
    function removeF() {
    removeChild(bigboreLoader);
    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
    function bigborecontent(event:MouseEvent):void{
    var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
    bigboreLoader.load(bigboreRequest);
    stage.addChild(bigboreLoader);
    EXTERNAL FLA:
    btnClose2.addEventListener(MouseEvent.CLICK, bigborecontent);
    function bigborecontent(myevent:MouseEvent):void {
    MovieClip(parent.parent).removeF();
    I think I have a misunderstanding of the code. Thanks for any help you might be able to provide.

    This was the original code I got:
    Main FLA: (on AS layer inside DropDownButton Movie Object)
    function removeF() {
    removeChild(myLoader);
    var myLoader:Loader=new Loader ();
    page1_mc.addEventListener(MouseEvent.CLICK, page1content);
    function page1content(myevent:MouseEvent):void {
    var myURL:URLRequest=new URLRequest("page1.swf");
    myLoader.load(myURL);
    addChild(myLoader);
    EXTERNAL FLA: (on main time line of this file)
    close_mc.addEventListener(MouseEvent.CLICK, closeMC);
    function closeMC(myevent:MouseEvent):void {
    MovieClip(parent.parent).removeF();
    Main.FLA
    myLoader=bigboreLoader (my new loader)
    page1_mc=btnbb2 (the button who event will call external swf)
    page1content = bigborecontent (name given to SWF being loaded???)
    myURL=bigboreRequest (my new URLrequest for bigbore)
    page1.swf=moduletemplate.swf (actual address of what I am loading)
    External.FLA
    close_mc=button that will close external swf
    closeMC=movie clip to close?

  • Making a swf unload itself

    Ill try to explain as clearly as I can but forgive me if I'm
    not too clear.
    I am loading a swf into a movie clip which resides on my main
    time line. I am using a MovieClipLoader object along with loadClip
    that loads the swf when a button is clicked. It works great with no
    problems.
    truckMC.onRelease = function():Void {
    MyMovieClipLoader.loadClip("external.swf",
    "myMovieClipHolder");
    My issue: there is a button inside my external.swf and when
    clicked I would like for it to make itself(the external.swf) unload
    itself... I don't want to make it's alpha 0 or visibility false. I
    want the swf to actually "unload" itself and go away. I know the
    button inside the external.swf works as I have used a trace
    statement to confirm it. I just don't seem to know the exact term
    to use to get the entire swf to vanish.
    (button inside the external.swf)
    closeExternalSWF.onRelease = function():Void {
    trace("its been pressed");
    Inside the button's onRelease function I have tried unload,
    Ive also tried unloadClip but non of those worked for me.
    Can someone give me some direction as to what I should use
    for this?
    Thanks in advance.

    It works perfectly! Thank you Thank you Thank you!!

  • Problems with button inside draggable movie clip

    I am building a click through presentation that has some small text in it. To maintain the design and allow for readability, I have added a zoom feature.
    Here is the structure of the movie,
    Stage - contains pages movie clip and forward/reverse click buttons for changing pages
         pages_mc - contains 24 frames, one page per frame and buttons
    There is a button at the _root level that uses a tweener to scale the pages_mc up to 170%. When this is clicked, it allows the pages to be dragged around the screen so you can look at different sections. When you click the button again, it returns the pages back to their original size stops drag.
    My problem is, on the pages, there are buttons with links to external sites. Once startDrag has been invoked, I cannot touch the buttons inside the movie clip. Is there a way to make these buttons work?
    I need the finished quickly so any assistance is welcome.
    Code below
    magUp_btn.onRelease = function() {
    this._visible = false;
    TweenLite.to(pages_mc, .25, {_x:-250, _y:-193, _xscale:170, _yscale:170});
    TweenLite.to(magUp_mc, .75, {_alpha:0});
    TweenLite.to(magDown_mc, .75, {_alpha:25});
    magDown_btn._visible = true;
    pages_mc.onPress = function(){
    this.startDrag();
    pages_mc.onRelease = function(){
    this.stopDrag();
    pages_mc.onReleaseOutside = function(){
    this.stopDrag();
    pages_mc.useHandCursor = false;
    TweenLite.to(instr_mc, 1, {_alpha:100});
    magDown_btn.onRelease = function() {
    TweenLite.to(pages_mc, .25, {_x:0, _y:0, _xscale:100, _yscale:100});
    TweenLite.to(magUp_mc, .75, {_alpha:25});
    TweenLite.to(magDown_mc, .75, {_alpha:0});
    this._visible = false;
    magUp_btn._visible = true;
    pages_mc.onPress = function(){
    this.stopDrag();
    TweenLite.to(instr_mc, 1, {_alpha:0});
    I don't know how to turn drag off when I zoom out without using the onPress command, but I know that this is probably what is getting in the way of the button working?
    Thanks!

    One option is to make the background of the pages be the draggable parts rather than the movieclips that contain the pages and buttons.  That way, the buttons could be atop the background and not have their access blocked.
    Instead of coding the pages_mc, you would essentially have the background coded for the drag...
    pages_mc.bkgnd.onPress = function(){
        startDrag(this._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.

  • MovieClip buttons inside a MovieClip button inside another MovieClip button

    I am trying to make a Portfolio of my study abroad experience and can get something right about the movie clip buttons inside each other. I have a button to click on titled "travel" and a window shows up with more movieclip buttons to organize different locations of pictures. I can click on the button to have to slide of pictures but nothing happens. I have the "turnOffAllButtons"  coding and  also have the coding for stay clicked, but I can't get the 3rd set to show up. what am i not doing?
    I don't have any errors or output comments showing up

    I have it working now. what I did, I make a slideshow setup (gotoAndStop(1);) in a specific frame and the code I put in for the next, didnt work.
    this is was I have now, without the "turnOffAllButtons" coding:
    Main Button (actions Layer):
    stop();
    travelButton_mc.buttonMode=true;
    travelButton_mc.addEventListener(MouseEvent.ROLL_OVER, colorizetravelButton);
    function colorizetravelButton(givenEvent:MouseEvent){
      if (givenEvent.currentTarget.currentFrame != 50)
      travelButton_mc.gotoAndPlay(2);
    travelButton_mc.addEventListener(MouseEvent.ROLL_OUT, decolorizetravelButton);
    function decolorizetravelButton(givenEvent:MouseEvent){
      if (givenEvent.currentTarget.currentFrame != 50)
      travelButton_mc.gotoAndPlay(21);
    travelButton_mc.addEventListener(MouseEvent.CLICK, loadtravelLocations);
    function loadtravelLocations(givenEvent:MouseEvent){
      travelButton_mc.gotoAndStop(50);
      travelLocations_mc.gotoAndPlay(1);
    Inside the travelLocations_mc I have currently one button to show a slide of pictures, this is the second layer of buttoncode:
    stop();
    scotlandButton_mc.buttonMode=true;
    scotlandButton_mc.addEventListener(MouseEvent.ROLL_OVER, colorizescotlandButton);
    function colorizescotlandButton(givenEvent:MouseEvent){
      if (givenEvent.currentTarget.currentFrame != 50)
      scotlandButton_mc.gotoAndPlay(2);
    scotlandButton_mc.addEventListener(MouseEvent.ROLL_OUT, decolorizescotlandButton);
    function decolorizescotlandButton(givenEvent:MouseEvent){
      if (givenEvent.currentTarget.currentFrame != 50)
      scotlandButton_mc.gotoAndPlay(21);
    scotlandButton_mc.addEventListener(MouseEvent.CLICK, loadscotlandInfoPage);
    function loadscotlandInfoPage(givenEvent:MouseEvent){
      scotlandButton_mc.gotoAndStop(50);
      scotlandInfoPage_mc.gotoAndPlay(1);
    I turned the alpha up so you can see the mc that loads
    I currently have a keyframe at 60 with a code of stop(); so the travelLocations_mc will still
    does this make sense?

  • PayPal buttons inside table scramble Design View in DW CS5.5

    I developed my web site using Dreamweaver 8:
    http://www.harmonize.com/hatleymusic/classic.html
    As  you see, I have PayPal buttons inside table cells.  I did this using  Design View, putting the insertion point in the table cell, going to  code view, and pasting the PayPal button code at the insertion point.   This all worked fine.
    I just upgraded to DW CS5.5. and now  when I try to use the same procedure, the Design View image gets  scrambled  after I paste the button code in code view.  The table format  is no longer in place, and I can no longer see where the cells of the  table are.  However, when I go to Live View, everything looks fine  including the table and the buttons.
    Can anyone tell me  how to overcome this problem?  As it stands, I cannot use DW to work on  my web site, which is a major problem for me.
    Thanks.

    How do I get someone to respond to my question here?
    Let me try again.
    With DW CS5.5 when I try to insert a PayPal button into a table (which I always did with DW8) the table in Design View gets scrambled, making it unusable.  Please would one of you out there who is much more knowledgeable about DW than me try it and see if there is a solution?  If you create a new HTML page in Design view, create a table in it, place the insertion point inside one of the table cells, go to the code view and locate the insertion point there, then paste the PayPal button code at that point. Here's the code:
    <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="XSXQ9CUMUVLQC">
    <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </form>
    Now go back to Design view and see how it looks.  If it acts the way it does for me, the table is no longer visible, but if you go to Live View everything looks fine with the table and the button inside it.  Of course, I can't design in Live View.
    PLEASE can someone out there help me.
    Many thanks.

  • Button inside a movie clip

    Ok, i'm new at action script so i have a problem
    I have a sound inside a movie clip (sound_MC) in the main
    timeline, and i have another movie clip with a button inside, and I
    need that button to control that sound movie clip
    on (release) {
    gotoAndStop("off_radio"); // this goes to another frame in
    the movieclip with the button (works fine)
    on (release) {
    _root.gotoAndPlay("stop_loop"); // this goes to another
    frame of the sound MC (doesn't work)
    // i have this in the stop button
    on (release) {
    gotoAndStop("on_radio");
    on (release) {
    _root.gotoAndPlay("start_loop");
    // and this for the play button
    whats the code for that ?
    what should i do?

    i solve the problem !! :-D
    but now i hold like to now how i make a fade out sound
    command when i enter a frame and a fade in when i enter in another
    frame
    here are the examples:
    http://tubo_centeno.web.simplesnet.pt/problem/problem.html
    http://tubo_centeno.web.simplesnet.pt/problem/problem.fla
    can anyone help me?

  • Buttons inside moveiclip not accessible

    Hi,
    I am making this website, which contains a load file, which contains a movieclip holder, which holds all the different parts of the website.
    Now within the portfolio.swf, which is within mcholdr, inside load.swf, there are several images, which are buttons. On clicking one image, I have code which dims, i.e. reduces _alpha for all the buttons and disables them. Now when I test portfolio.swf alone, this code works, but when I access portfolio.swf through load.swf, the code is not working.
    The code within each image button inside portfolio.swf is:
    while (i<=29) {
            _root.folioholdermc["img"+i]._alpha = 20;
            _root.folioholdermc["img"+i].enabled = false;
            i++;
    img1 to img20 are the image buttons. They are placed within folioholdermc, which in inside portfolio.swf.
    Structure with portfolio.swf alone : Main timeline ------> folioholdermc -------> img1 to img20
    Now through load.swf is : Main timeline --------> mc_load -----------> portfolio.swf (loaded with MovieClipLoader)
    I tried everything from
    _root.mc_load.folioholdermc[img....
    folioholdermc[img.....
    Nothing works. Is this a path problem??? How do I access these buttons?? I want to use the loop, as there are many buttons, so a simple img1._alpha will not work, as I will have to type this out for each button. How can I get the same effect using the loop??
    Thanks

    If I'm interpretting your posting correctly, it ilikely you have an issue using _root references.  Unless specified otherwise, if you load an swf file that uses _root references, those _root references will target the main file's _root.  To get around this you probably need to implement _lockroot in the files that you are loading.    Look it up in the AS2 help files.  In your case it may be as simple as adding the following to the main timeline of the file(s) you load...
    this._lockroot = true;

  • Button inside movieclip on stage

    What do I have to do to get the button to work? I view the swf and there is no active button.
    I need the button inside the clip to be active. I can't find the answer. Thank you.

    no i put a button from the library inside the clip to see if i could access a button once movie played and i couldnt see the states of that library version if I viewed the scene I could.
    I was going to create my own button, which I will, but I don't think I will be able to get to it once publised and I'm frustrated.
    I think I have run into this before, it's been a while. Is it an enable thing?

  • Target a button inside of a Movie Clip

    I am trying to target a button inside a dynamically loaded
    movieclip, such as the following (but is not working):
    clipAnswerYesNo: Movieclip
    testbutton: embeded button
    Script is on main timeline.
    _root.clipAnswerYesNo.testbutton.onRelease = function() {
    trace(userAnswer);
    D

    ensure both the movieClip and the button have instance names.
    also, maybe change your trace to:
    trace("hit button"+userAnswer);
    it is possible that the trace and therefore the button is
    working, it's just the path to userAnswer is incorrect...

  • AS3 Putting Buttons Inside Movie Clip

    I am practicing AS3 (after years of AS2) and am having trouble having a button inside a movie clip talk to another movie clip on the main timeline. Here is the code:
    OneButton.addEventListener(MouseEvent.CLICK, OneButtonClicked);
    function OneButtonClicked(event:MouseEvent):void
    MovieTarget.gotoAndStop(1);
    MovieDescription.gotoAndStop("One");
    TwoButton.addEventListener(MouseEvent.CLICK, TwoButtonClicked);
    function TwoButtonClicked(event:MouseEvent):void
    MovieTarget.gotoAndStop(2);
    MovieDescription.gotoAndStop("Two");
    The code above works, but if I put OneButton and TwoButton inside a movie clip, I know longer can target MovieTarget and MovieDescription. The reason I want to put OneButton and TwoButton inside it's own MC is so I can dim each button after it is clicked by toggling the playhead inside that MC. Help? Thanks!

    Start over from the begining
    press  f8 and chose movieClip then draw your untoggled button call the movie button then create another movie and create your toggled button or greyed out button and call it greyedButton.  Go to main stage add 2 button instances and 2 greyedButton instances( just drag from library).  you have 4 instances on stage.  give call instance names and place one them on top of each other so u can only see 2 buttons on stage.  put the greyed button under the button.
    now with action script
    button1.addEventListener(MouseEvent.CLICK, OneButtonClicked);
    function OneButtonClicked(event:MouseEvent):void
    MovieTarget.gotoAndStop(1);
    MovieDescription.gotoAndStop("One");
    button1.visible = false; //  here the greyed button will show
    button2.addEventListener(MouseEvent.CLICK, TwoButtonClicked);
    function TwoButtonClicked(event:MouseEvent):void
    MovieTarget.gotoAndStop(2);
    MovieDescription.gotoAndStop("Two");
    button1.visible = true; // here button1 will go back to its orignal state
    button2.visible = false // here the greyed button will show

  • Command button inside header column in ADF table

    Hi all,
    I want to insert two command buttons inside the header column of an ADF table.
    In my mind these buttons should replace the two default buttons (small triangles) to sort the column in ascending order or descending order.
    Do you know any solution ?? Because it is 2 days that i am trying , but no way .
    Thanks in advance
    Stefano

    Use as mentioned below:
    <af:table value="#{bindings.AllEmployees.collectionModel}" var="row"
    rows="#{bindings.AllEmployees.rangeSize}"
    emptyText="#{bindings.AllEmployees.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.AllEmployees.rangeSize}" rowBandingInterval="0"
    selectedRowKeys="#{bindings.AllEmployees.collectionModel.selectedRow}"
    selectionListener="#{bindings.AllEmployees.collectionModel.makeCurrent}" rowSelection="single"
    id="t1">
    <af:column sortProperty="#{bindings.AllEmployees.hints.EmployeeId.name}" sortable="true"
    headerText="#{bindings.AllEmployees.hints.EmployeeId.label}" id="c1">
    <af:outputText value="#{row.EmployeeId}" id="ot1">
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.AllEmployees.hints.EmployeeId.format}"/>
    </af:outputText>
    </af:column>
    *<af:column id="c2">*
    *<f:facet name="header">*
    *<af:group id="g1">*
    *<af:panelGroupLayout id="pgl1" layout="horizontal">*
    *<af:commandButton text="Ascending" id="cb1" icon="" iconPosition="trailing"/>*
    *<af:commandButton text="Descending" id="cb2" icon="" iconPosition="trailing"/>*
    *</af:panelGroupLayout>*
    *</af:group>*
    *</f:facet>*
    *<af:outputText value="#{row.FirstName}" id="ot2"/>*
    *</af:column>*
    </af:table>
    Thanks,
    Navaneeth

  • How can I bring my photo library from my desktop or external HDrive into aperture itself

    Good morning,
    How can I bring my photolibrary from the desctop or external harddrive into Aperture itself?

    Marcus,
    is the Aperture version on your new Mac Aperture 3.5.1?
    the contents of aperture on to a external drive
    Is that your old Aperture library? Does it look like this?
    If it is an Aperture library, that you copied to your Desktop, click it to open it in Aperture. Aperture should update/upgrade it to your current Aperture version. What happens, when you try?
    If it is not an Aperture library, but a folder of referenced images files, search for your old Aperture library and transfer that to your new mac.
    Do you already have an Aperture library on your new mac and want to import/ merge your old library into it? Then You first need to let Aperture upgrade the old library to your current Aperture  version, before you can import and merge the library with "File > Import > LIbrary".
    Could you perhaps post a screen capture of what you are now having on your Desktop? And any exact error messages that you might get, when you are trying to open your Aperture library?

  • Add a button inside textfeild

    We use Forms 6i. Can I make a bean that "extends vTextField" and add a button inside the textfield? So that when I add the bean in implemenation class of a textfield, I can have a small button inside and after I click it, I can do what I want.
    Thx

    Hi Francois,
    Thx for your information. Because there are tons of forms (and each each forms may contain tons of tab page), we, if possible, would like to make minimum effort to do so. Do you think adding a button next to the text field is the best approach to achieve our goal? Is there any other opinions?
    Thx again!
    Gary

Maybe you are looking for

  • Manual price change on Sales Order line

    Hi everyone, Say I have a product A and have entered this in the price list Product A = USD 100 per unit. I create the order and process the order, do ship confirm, but at the time of creating the invoice, I want to change the price to 97. or 95 or w

  • Lost CD for Acrobat X Standard

    How do I replace or download a replacement Cd for Acrobat X Standard?

  • ITunes - Can´t change Cover

    Hey guys. I´m from Germany and i searched an answer for my problem on nearly every german apple-fan-page. So you´re my last hope. A few days ago I imported many songs from my old laptop to my new MacBook. After that, i started adding Covers to the Al

  • MacBook Pro won't start in normal mode and won't open in safe mode.

    My Mac suddenly won't open in normal mode. It just stays on the apple logo and won't continue. Then, I tried going on Safe Mode. Unfortunately, it only loads up to the Apple Logo with the progress bar below it. I would load one-third the bar and shut

  • IPhone security measurement

    I know Apple has implemented security features with iOS 7 via iCloud but my only concern is that ejecting the SIM card will instantly allow the thief to stop me from tracking him/her down. Since I have seen that Apple products is the most stolen devi