Hierarchy with as3 coding and to remove children

To give a brief overview of what's going on here.  I'm building a personal site where I have a navigation, and I have other subnavs inside some pages.  Such as if I'm going to 'work' inside job I 'motion', 'web' and 'print '.  Some examples of code to a button on the navigation:

nav_mc.personalbtn_mc.addEventListener (MouseEvent.CLICK, buttonClick2);

function buttonClick2(event:MouseEvent):void {}

gotoAndStop ("personal");

function workss_mcExists (): void {}

if {(workss_mc.stage!=null)}

trace ("YES workss does exist");

removeChild (workss_mc);

{ } else {}

trace ("NO workss does not exist");

}

}

workss_mcExists();

function motionss_mcExists (): void {}

if {(motionss_mc.stage!=null)}

trace ("YESdudemar");

removeChild (motionss_mc);

} else {

trace ("NO");

}

}

motionss_mcExists();

function workExists (): void {}

if {(work_mc.stage!=null)}

trace ("YES");

removeChild (work_mc);

} else {

trace ("NO");

}

}

workExists();

function objectExists (): void {}

if {(workss_mc.stage!=null)}

trace ("YES");

removeChild (workss_mc);

} else {

trace ("NO");

}

}

objectExists();

function home_mcExists (): void {}

if {(home_mc.stage!=null)}

trace ("YESdudemar");

removeChild (home_mc);

} else {

trace ("NO");

}

}

home_mcExists();

function workpersonalExists (): void {}

if {(workpersonalss_mc.stage!=null)}

trace ("YES");

removeChild (workpersonalss_mc);

} else {

trace ("NO");

}

}

workpersonalExists();

}

It seems to me that actionscript will read all the way down to the bottom when looking for objects.  For example: the first if statement where she asked if workss_mc exists or not, which works if it is upstairs, but if I move it to the bottom, it won't work.  Does anyone have any idea how to fix this or bypass?

Thanks in advance!

This is the correct code, but if you goto a frame whereunimetal_homeref_mc doesn't exist, you'll still get an error message.

to remedy this, you could declare all your clips as part of this code and then check if the object is null:

pistolwreck wrote:

var unimetal_homeref_mc:MovieClip;

unimetal_homeref_mcnav_mc.workbtn_mc.addEventListener(MouseEvent.CLICK, buttonClick1);

function buttonClick1(event:MotionEvent):void {     gotoAndStop("work");     stage.invalidate();     stage.addEventListener(Event.RENDER,renderedF);}

function renderedF(e:Event) {     unimetal_homeref_mcExists();}

function unimetal_homeref_mcExists():void {if(unimetal_homeref_mc!=null){     if (unimetal_homeref_mc.stage!=null) {          trace("YESdudemar unimetalhomeref exists");          removeChild(unimetal_homeref_mc);     } else {          trace("NO home ref does not exist");     }}}

Tags: Adobe Animate

Similar Questions

  • I'm covering a bottle of wine with a label and to remove the date on it. I deleted the date, but how to restore the color to the same color as the label? Essentially, I want to wipe this number on my tag without altering the color

    Help!

    Victor,

    If a raster image, it is much better to do it in Photoshop.

    If it is a vehicle for work on top of a color, you should be able to simply select the live/outline Type object and delete it. If this is a carving, you should be able to select the routes involved and the Pathfinder > unit. Or something else.

  • How to remove children lines with removal of multi line?

    Hello!

    I have a DSM process that removes the selected lines of the report, but it gives an error if the line have a child row in another table, so I have to go to this report and remove these first.

    Just add somewhere in the DSM process something then it removes children lines too, or I have to create new process for this?

    Hi EgaSega,

    DELETE will work if there is no foreign key constraints that refer to the line to remove.

    If you don't have foreign key constraints, you can change them to 'ON DELETE CASCADE '. This way, if you DELETE a row in a parent table, all child rows will be auotmatically DELETED, too.

    There are also "ON DELETE SET NULL', which allows you to DELETE the parent rows with children. When you DELETE a parent, child rows are not automatically DELETED, but the columns that pointed to the DELETED parent are automatically changed to null.

    Check out this old thread of discussion forum SQL and PL/SQL for more details:Delete record based on the ID of the main table

    Hope this helps you,

    Kind regards

    Jitendra

  • Parental and child control with AS3

    Hello

    I am new to AS3 and although I can see some good practices and functionality, I'm constantly stuck and can still do the things I would do if easily with AS2 - I almost it relearn from scratch!. I would still appreciate little help and advice on this...

    I did a class that creates a "sort" menu with data from an XML file, and basically is what he does when he is called to create an emptyMC (a container), add a childMC (a square) and add another child (a text label). When I create the container, I am trying to add a MouseEvent that can act on each instance of container, but all I can get is a MouseEvent on the object that contains all the MCs added. The code follows.

    Can someone enlight me with that issue or explain what I am doing wrong.

    I do not understand the parental dynamics with AS3 and the absence of the use of instance names and parenting dot does not help.

    Thanks in advance.

    Note to Adobe: previous versions of Flash and as a reference Help files were far more useful than in CS4!

    In the timeline:

    Import assets.myDynMenu;

    var theMenu:myDynMenu = new myDynMenu ("menu.xml");
    stage.addChild (theMenu)

    Stop();

    In the class:

    package assets

    {

    import flash.display. *;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    flash.net import. *;

    public class myDynMenu extends Sprite {}

    LOADING EXTERNAL INIT DATA

    public void myDynMenu (theData) {}

    LOADS MENU DATA FROM PREFORMATTED XML
    var loader: URLLoader = new URLLoader();
    var url: URLRequest = new URLRequest (theData);
    loader.addEventListener (Event.COMPLETE, buildTheMenu);
    Loader.Load (URL);
    }

    FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN

    public void buildTheMenu(event:Event):void {}

    var xml = new XML (event.target.data);

    for (var i = 0; I < xml.menuData.menuItem.length (); i ++) {}

    ADDS A CONTAINER

    var itemContainer:MovieClip = new MovieClip();
    itemContainer.name = "menu" + i;
    //

    THE NEXT LINE IS NOT DO WHAT I WANTED?
    IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDREN

    itemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    //

    itemContainer.x = 100 * i;
    itemContainer.y = 0;
    itemContainer.mouseEnabled = true;
    itemContainer.mouseChildren = false;
    addChild (itemContainer);

    ADDS A CHILD OF CONTAINER (a square)

    var itemBase:MovieClip = new MovieClip();
    itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
    itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mConfig.mainIt emH);
    itemBase.graphics.endFill ();
    itemBase.name = "basic" + i;
    itemBase.mouseEnabled = false;
    itemBase.mouseChildren = false;
    itemContainer.addChild (itemBase);

    ADDS a CHILD OTHER to CONTAINER (a text label)

    var theLabel:TextField = new TextField();
    theLabel.x = 5;
    theLabel.y = 5;
    theLabel.selectable = false;
    theLabel.mouseEnabled = false;
    theLabel.border = true;
    theLabel.text = xml.menuData.menuItem [i] .mName;
    itemContainer.addChild (theLabel);

    }

    }

    It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
    private void onMouseOver(event:MouseEvent):void {}

    event.stopPropagation ();
    trace ("you're on" + myIdName);
    }


    }

    }

    use:

    package assets

    {

    import flash.display. *;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    flash.net import. *;

    public class myDynMenu extends Sprite {}

    LOADING EXTERNAL INIT DATA

    public void myDynMenu (theData) {}

    LOADS MENU DATA FROM PREFORMATTED XML


    var loader: URLLoader = new URLLoader();
    var url: URLRequest = new URLRequest (theData);
    loader.addEventListener (Event.COMPLETE, buildTheMenu);
    Loader.Load (URL);
    }

    FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN

    public void buildTheMenu(event:Event):void {}

    var xml = new XML (event.target.data);

    for (var i = 0; i)

    ADDS A CONTAINER

    var itemContainer:MovieClip = new MovieClip();
    itemContainer.name = "menu" + i;
    //

    THE NEXT LINE IS NOT DO WHAT I WANTED?
    IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDREN

    itemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    //

    itemContainer.x = 100 * i;
    itemContainer.y = 0;
    itemContainer.mouseEnabled = true;
    itemContainer.mouseChildren = false;
    addChild (itemContainer);

    ADDS A CHILD OF CONTAINER (a square)

    var itemBase:MovieClip = new MovieClip();
    itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
    itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mCon fig.mainItemH);
    itemBase.graphics.endFill ();
    itemBase.name = "basic" + i;
    itemBase.mouseEnabled = false;
    itemBase.mouseChildren = false;
    itemContainer.addChild (itemBase);

    ADDS a CHILD OTHER to CONTAINER (a text label)

    var theLabel:TextField = new TextField();
    theLabel.x = 5;
    theLabel.y = 5;
    theLabel.selectable = false;
    theLabel.mouseEnabled = false;
    theLabel.border = true;
    theLabel.text = xml.menuData.menuItem [i] .mName;
    itemContainer.addChild (theLabel);

    }
      
    }

    It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
    private void onMouseOver(event:MouseEvent):void {}

    event.stopPropagation ();
             trace ("you're on" + event.currentTarget.name);
    }

    }

    }

  • How to remove an old version of MSN (with the butterfly) and messages inside?

    I always use an msn address.  My desk top still shows an older version (with the butterfly) and when you click on this old old messages are there.  How to remove this version and messages.

    Hello

    Please refer to this article.

    How to uninstall the MSN Explorer software for my computer?

    http://answers.MSN.com/solution.aspx?SolutionID=115dc6c5-4ae7-4e38-8e0b-3eac07d020fa

    If you still have any questions, then contact msn support

    How to contact MSN customer service

    http://support.Microsoft.com/kb/940784

    I hope this helps.

  • Is it possible to buy a new computer with Windows XP or buy one with Windows 7 and remove it and install Windows XP? I have

    I now have a computer with Windows XP and wanted to buy a new computer.  All new computers come with Windows 7.  Is it possible to buy a new computer with Windows XP (or buy one with Windows 7 and remove it and install Windows XP)?   I like XP and have talked to people who are not really happy with Windows7 and holds XP back.  AND I also discovered that my printer is not compatible with Windows 7 - it is not that I love him and want to keep it.  I can't afford to buy a new computer AND printer, since I have been unemployed for more than 2-1/2 years.   I would like to use XP on a new computer!   I would appreciate it if you could let me know what is possible or if I'm stuck with my old computer.  Thank you very much!

    Probably not, you will find a computer with XP on it.

    If you buy a computer with Windows 7, you will first need to know if it would be compatible with Windows XP. Probably not, because they are not designed for XP and drivers are not available.

    Unless you want to spend the time, you're stuck with your old computer.

  • WHAT DID YOU DO WITH MY FILES AND EMAIL NOT OPEN? Email removed for privacy. Answer NOW.

    WHAT DID YOU DO WITH MY FILES AND EMAIL NOT OPEN.  E-mail address is removed from the privacy *.  Answer NOW.

    It is just a forum for helping hand in hand. Nobody here touched your records or by mail.

    A question of Hotmail or Windows Live Mail?
    http://social.answers.Microsoft.com/forums/en-us/xpnetwork/thread/00015cf4-4654-4296-8aa6-b88ae3bcbde1

    Bruce Hagen
    MS - MVP October 1, 2004 ~ September 30, 2010
    Imperial Beach, CA

  • Try to delete junk mail in my account hotmail with windows 8 and after having clicked on delete and it comes right off. Does anyone know how to remove it?

    Try to delete junk e-mail with my account hotmail with windows 8, and after clicking on remove the spam is well again. If I go to my email using the icon on the desktop I am able to remove everything. It is only with the icon of mail on the splash screen that I can't remove. Does anyone know hot to delete?

    Hello

    I'm happy to help you with your concern about the removal of junk e-mail.

    Please clarify your statement "it is only with the icon of mail on the splash screen that I can't remove.

    Are you referring to a Mail or Windows Live Mail application?

    We look forward to your response.

    Thank you

  • I opened my photos of my SDCard with File Explorer, select them all, then I select move to fill after that I saw the bar of loading with the green line. After that all my photos from my computer disappered and were removed from my SD card. Please, he

    I opened my photos of my SDCard with File Explorer, select them all, then I select move to fill after that I saw the bar of loading with the green line. After that all my photos from my computer disappered and were removed from my SD card. Help, please

    I looked everywere in my computer, but they are not found

    I bet that you have selected the folder Adobe Bridge CC or CS6, and it would be in there under Program Files/Adobe/or Program Files (x 86) / Adobe /.

    Move to... in the file Explorer apply only to records not the bridge program.

    You open Bridge and Photo Downloader allows you to move pictures from your SD card in the deck (also called import)

    Gene

  • Hi I bought a new Mac book with el capitan and can not install my 4 C? My old computer was stolen and I can't remove the program from the old mac book

    Hi I bought a new Mac book with el capitan and can not install my 4 C? My old computer was stolen and I can't remove the program from the old mac book

    If you see an anomaly of counting activation, contact adobe for hourly pst support by clicking here and, when available, click on "still need help," https://helpx.adobe.com/contact.html and ask a county of activation reset.

    Otherwise, How to open third-party developers not identified in Mac OS X applications ' Mac Tips .

  • I had someone to help me with a computer problem and they removed my editions CC2014 for the PS, Illustrator, InDesign and Acrobat. How can I reinstall?

    I had someone to help me with a computer problem and they removed my editions CC2014 for the PS, Illustrator, InDesign and Acrobat. How can I reinstall?

    Refer

    Using creative cloud | Install, update, or uninstall applications

    If previously produced was not uninstalled properly then you can required to run CC cleaner once the tool and remove them

    Use the CC cleaning tool to resolve installation problems. CC, CS3 - CS6

  • After the upgrade Lightroom on a mac. Remove the old version with old catalogs and files?

    Can I remove the old version with old catalogs and files? and what is the best way to go about this? Thanks :))

    Uninstall manually and then manually uninstall Lightroom

  • How to validate and save the values to a combo box and two text boxes in flex4 mxml application with as3

    helllo all,.

    I'm working on the application web flex4 with as3.

    I have a doubt, I've created a mxml it has two text boxes, except the button and a combo box that is has two option as a percentage and the amount.

    my needs are I gave here.

    need 1: when I choose option amount that two text boxes does not have to be editable.when I select text tat box two percentage option will be editable.

    need 2: when I select the percentage in combox option and two text boxes are empty, and then click the button Save-> I want to display warning msg

    need 3: when I select the option amount combox and the two boxes are emptu click the button Save-> I don't want any warning messages.

    How to validate it and how to write backup for this function.

    any suggession or extract code is welcome.

    Thanks in advance,

    B.Venkatesan

    Looks like you are trying to do too much at once. Try to hang the events correctly

    The close event of the comboBox can do something like this

    protected function toggleTextEditing(event:DropDownEvent):void

    {

    If (this.optionCmb.selectedItem.label is "Percentage")

    {

    This.Text1.editable = true;

    This.Text2.editable = true;

    }

    Else if (this.optionCmb.selectedItem.label == "Number")

    {

    This.Text1.editable = false;

    This.Text2.editable = false;

    }

    }

    The button's click event can do something like

    protected function save(event:MouseEvent):void

    {

    If (this.optionCmb.selectedItem.label is "Percentage")

    {

    If (this.text1.text == "" & this.text2.text == "")

    {

    Alert.Show ("text is empty");

    return;

    }

    on the other

    {

    }

    }

    Else if (this.optionCmb.selectedItem.label == "Number")

    {

    }

    }

    If you can put in your entire code, maybe I can have a look to see if I can find something wrong with that.

    -Pramod

    http://www.flexmycode.com

  • FlexUnit with AS3 AIR does not work?

    Recently, I tried to take a shot at TDD (Test Driven Development), as I'm sure many of you know.  To do this I tried to use FlexUnit 4 of in Flash Builder 4.

    If I create a project as follows:

    1. New--> Flex project
    2. Next, Next
    3. (The main Application file) Replace .mxml, .as
    4. Finishing

    Then when I try to use FlexUnit in the ordinary way, it fails to generates an adequate FlexUnitApplication.mxml.  The content of this file is:

    
    
    package_declaration
    {
    class_declaration
    {
    class_body
    }
    }
    

    Therefore, there is a compile error that I can not move:

    Content is not allowed in prolog.
    

    However:

    If I followed the same process as above, without changing the .mxml to .as tests run correctly.

    Things, I tried to work around the error:

    • FlexUnit to 4.1 update
    • Pressing refresh in the FlexUnitsResults window
    • Creating a project with .mxml and thereafter remove this mxml and its replacement with an actionscript class
    • Bump on my desk.

    None of them have worked.

    Did anyone here successfully FlexUnit FlashBuilder 4 for an AS3 AIR project all?  If not, can anyone suggest another Test package?

    Thank you

    ~ Nick.

    I found a solution at least provisional.  I restarted FlashBuilder and despite the error marked under issues here and it worked.

    I think that restart Flashbuilder maybe erases a previously stored properly compiled build.  (Maybe Clean could also do this?).  in any case, at the time of compilation, the mxml file was generated correctly and all is well.

  • Choose several folders with choosing menu and empty their contents

    Hi all

    new to applescript and want to create a file menu choose where I can choose several folders and empty their content. There will be a dialog box at the end let me know that the files have been purged. The script I'm working for an individual file:

    say application 'Finder '.

    Close each window of

    Open (choose folder with prompt "including one or more folders should purge?" multiple selections allowed location 'True' by default ' / users/bryceratops / ')

    Set an to front Finder window

    move each agenda a in the trash

    Close front The Finder window

    end say

    say application 'Finder '.

    display the dialog box buttons "purged records." {"ok"}

    end say


    But Im having this script to open, purge and close every finder window, if I selected several files in the menu choose a wire installation difficult.


    Any ideas?


    See you soon

    Hello

    Put the output of the command 'choose folder' in a variable (no need to open these folders).

    ----

    the tFolders value (choose a folder with default location "including one or more folders should purge?" guest "/ users/bryceratops / ' with multiple selections allowed)

    Tell application "Finder".

    Repeat with thisDir in tFolders

    remove items from thisDir - trash

    end repeat

    tell the end

    activate

    display the dialog buttons "purged records." {"ok"}

    ---

Maybe you are looking for

  • I am not provided with drivers for my dell inspiron 1520, please tell me if the drivers will be provided later

    I use windows 8 (excerpt from developres of windows). I am not as much with the graphics drivers for my dell inspiron 1520 please tell me if I will be provided later or should I reintall windows7 in my system.

  • Operating system installed not?

    I am currently hunting for a computer on eBay and most of the computers I want to buy do not have the operating system installed on them. What does it mean when they do not have the operating system on them? Also, most of them come with the sticker C

  • PIX IDS signatures

    Does anyone know the PIX IDS signatures to block Ping scans and Port scans? Do the substitution of signatures IDS ACL defined previously? For example; I want to allow people to ping - me (I allowed icmp echo in my ACL), but I want to drop Ping Sweeps

  • Customize the Action menu in the interactive report

    To change the word 'Action' in the menu of the interactive report.Apex 4, we had the 'Image of the Action menu' option, but the Apex 5 this option disappeared.This isn't in known issues in the Apex 5!Someone knows how to set an image or other text to

  • I have a problem with Windows 8 regenerate.

    Windows 8 will not let me "Refresh." I'm trying to get my Windows Office and store as they disappeared. I have no 'settings' at all when I slide right etc... and cannot get the link update through Action Center. But he won't let me not refresh when y