Please help understand a fundamental notion of script

Hi, I'm reading the book of learning ActionScript 3.0 and have difficulties to understand some basics of programming due to my total lack of knowledge of prior programming.

For example now I am interested in this script of the book that traces a list of all the objects to display on the stage and their children:

function showChildren(dispObj:DisplayObject):void {
     for (var i:int = 0; i< dispObj.numChildren; i++) {
          var obj:DisplayObject = dispObj.getChildAt(i);
          if (obj is DisplayObjectContainer) {
               trace(obj.name, obj);
               showChildren(obj);
          } else {
               trace(obj);
          }
     }
}
showChildren(stage);

I understand everything except one thing. When there is an object with children (DisplayObjectContainer), the function redraws the object but is not moving forward and calls itself to go anywhere this time analyze the first child of the object. And if the child also having children himself list will branch out until there is an object without children.

What I don't understand is how the function knows at this point how to return to the last object parent and continue to analyze her other children, if any.

For example when the function analysis the scene of a scene with the following content how function knows to continue the child0 analysis. For me, looking at the code, I would expect the service leave after listing [StaticText object]. I have hard time to understand what makes the function return to largeContainer and continues with its child0 and so on.

ROOT1 [object MainTimeline]
largeContainer [object largeContainer_1]
[object, form]
smallContainer [object smallContainer_2]
[object, form]
Child2 [object MovieClip]
[object, form]
[StaticText object]
child0 [object MovieClip]
[Shape object

Child1 [object MovieClip]
[object, form]

Having said all that the book about which isn't enough for me to understand this process:

... the function calls itself again. by passing the object currently
to inspect. This concept is called recursion. A function that calls itself can
seem redundant, but it can be very useful. In this case, each time that the function
is called, it receives a new display object to analyze, so the reports function
the content of this specific display object. The result is a complete walkthrough
to view all objects, regardless of the number of children each can have.

If you feel that you can explain this, please help. I'd greatly appreciate it.

It can be a little difficult to explain (I would not this place in the base category), but it helps to realize the programs have a good memory.  Each call to the function showChildren has a list of things to go through and will go through the list from beginning to end.  Is ago temporarily recursive calls to him, recursive calls are essentially the instances of this function and they have their own lists, and it can go further inland as required.  If you want to consider that each list knows where it is and where to pick them up when he returned to... and the list hierarchy is not forgotten. While each subroster is complete, the proposed happening to his agenda.

Tags: Adobe Animate

Similar Questions

  • Please help understand the mappings between PS &amp; tables tables of data warehouse

    Hello
    We have OBIEE 11 g with OLIVIER 7.9.6.3 (HR Analytics) installation with Informatica PowerCenter SE 9.01 HF2. We use PeopleSoft HRMS 9.1 system source.
    Can you please help me how to understand the flow of data from end to end (or data model with relationship) between the PeopleSoft Tables and tables of data warehouse? Y at - it none available who liaises between the PeopleSoft HRMS tables and tables of data warehouse?

    PS We are new to Informatica workflow maps to find it very difficult to understand each mapping for each table.

    You can use the guide to table HR analytics on metalink. Here's the note:

    HR Analytics, Oracle Business Intelligence - Source tables uses [ID 1328607.1]

    This will show you the use of the main table. If you need the full line, you can use the data lineage Guide.

    If it helps, please mark as correct.

  • Please help, 3D animation play button Java Script

    The U3D file embedded in the PDF file contains 3 procedure animations

    I would like to add a play button to each procedure.

    But I do not see the objects of Animation in the pdf model tree and I don't know how to connect to these animations

    with JavaScript.

    I tried without success:

    var _anim = scene.animations.getByIndex (0);

    scene.activateAnimation (_anim);

    _anim. CurrentTime = 0;

    Runtime.Play ();

    Please show me how this is done with Java Script on a button.

    Thank you

    If you are controlling the 3D animation by a button on the PDF page you need to talk to the correct API.

    The best way to do (that is to integrate a function in the annotation 3D using a text .js file) and then call including the operation of your button.

    for example in the 3D script, use this:

    function playAnimation (i) {}

    var _anim = scene.animations.getByIndex (i);

    scene.activateAnimation (_anim);

    _anim. CurrentTime = 0;

    Runtime.Play ();

    }

    Then on your button, use this:

    getAnnots3D (pageNum) [0].context3D.playAnimation (0);

    then the same thing for (1) and (2) your other buttons.

  • can you please help me understand this regexp

    Dear experts,

    I got the code of the Web site only.

    But I am not able to understand.

    I know its very basic question and I need to us in the form of documentation.

    Please help understand this code

    
    
    with data_cell as (
                       select  q'~[{"id":"1666","issueId":"ezsats:10000:1418145284747","sapId":"1101854","name":"INDIRA DEVU MD PC","createdBy":"Someone, Adam","dateAdded":"2014/12/09"},  {"id":"1667","issueId":"ezsats:10000:1418145284747","sapId":"1125031","name":"IL INDIRA DEVU MD PC","createdBy":"Someone, Adam","dateAdded":"2014/12/09"}]~' cell
                         from  dual
                      )
    select  rtrim(regexp_replace(cell,'.*?"name":"([^"]*).*?}.','\1;'),';')
      from  data_cell
    /
    
    
    () The subexpression (a.k.a. a submatch or group) 
     and subexpressions may be nested to any depth.
     Parentheses (subexpresions) also capture the matched element into a variable that may be used as 
     a backreference. 
      (aka grouping or submatching) and their use as backreferences.
    The following is a set of iteration metacharacters (a.k.a. quantifiers) that can control the number of times the preceding character is found in our searches. 
    The iteration meta characters can also be used in conjunction with parenthesis meta characters.
    . The . (period) means any character(s) in this position, for example, ton. will find tons, tone and tonneau but not wanton because it has no following character.
    ? The ? (question mark) matches when the preceding character occurs 0 or 1 times only, for example, colou?r will find both color (u is found 0 times) and colour (u is found 1 time).
    * The * (asterisk or star) matches when the preceding character occurs 0 or more times, for example, tre* will find tree (e is found 2 times) and tread (e is found 1 time) and trough (e is found 0 times).
    + The + (plus) matches when the preceding character occurs 1 or more times, for example, tre+ will find tree (e is found 2 times) and tread (e is found 1 time) but NOT trough (0 times).
    

    Hello

    Like John said, if you want to talk about the suggestion of someone, then it makes more sense to respond to this proposal in the same thread.

    Try to split the term complicated part smaller, easier to understand, like this:

    Select rtrim (regexp_replace (cell

    , '.*?'        || -any text (as low as possibble)

    "« nom » : »" ||

    '('          || -- \1 is ...

    '[^"]*'  || -0 or more characters, but without quotes

    ')'          || -end \1

    '.*?'        || -any text (as low as possibble)

    '}.'            -a hug right, followed by any 1 character

    , '\1;'

    )

    , ';'

    )

    of data_cell

    ;

    This makes it more clear what you first do replaces

    x 1 "name": "y' 'x 2}.   with a little

    There

    where x 1 and x 2 can be anything, except that you do not want 'something' to include another instance of the model that you are replacing.  That's why you should use

    .*?  instead of simply

    .*

    The '?' after ' *' makes No greedy, i.e. when there is a game of choice, as little as possible.  (The default value for the regular expressions must be greedy, or match as much as possible.)

    Note that this solution assumes there is exactly 1 "name" element in each set of braces.  For example, if you have a string like:

    "[{'name': 'A', 'name': 'B', 'name': 'C', 'name': 'D'}, {'foo': 'bar'}]' he returned.

    ' ONE; [{'foo': 'bar'}] "The solution more complicated that I posted in response on the original thread #3 returns

    ' ONE; B; D"

    Note also that none of them not what you asked.

  • I'm trying to restore my bookmarks from a json file, but I get "WARNING: script is not responding - Script: chrome://browser/content/browser.js:3580 ' message - please help

    I have no idea why will not restore my favorites. I am convinced that I even tried to reconstitute their at the time of the creation of the JSON to make sure they worked, and after that I was confident I left for a month or two then tried to recover, but it does not at all. I get the Script: chrome://browser/content/browser.js:3580 (script error unresponsive GSM) and if I click on continue or stop the bookmarks do not change their script. Please help - there are many favorites it I was counting on.

    I tried all the suggestions several times and nothing worked. I don't know if it's me or FF.
    Since none of the new backups worked, I went to my computer corrupted and copied the backup file of bookmark on a USB key. Then I stuck on my desktop. Went to 'restore backups', then to choose the file, then on the desktop. Fact. All bookmarks are copied in half a second.
    Problem solved, and I know what to do if it happens again. Trick is to remember.

    Lynn

  • I try to get an update of the software update, but he kept saying ' this phone (Iphone 5 s) is not onger connected to the internet while I am using internet.» Please help me understand why.

    I'm trying to get a software update IOS 9.3 as reminded me. He repeated that "impossible because you are no longer connected to the internet while I am on the internet. Please help me understand why. I did it many times, but it's really annoying

    The iOS 9.3 update was pulled for iPhone 5s and older iPhones because of activation problems. He will be unavailable for the next few days.

  • Please help me understand how to install updates with the following error updated Message__The following have not been installed: __Security update for Microsoft XP KB 2289162

    Please help me understand how to install updates with the following error Message

    The following updates were not installed:

    Security for Microsoft XP KB 2289162 update

    See the section "How to get help" of http://support.microsoft.com/kb/2289162

    For individuals, please visit the Microsoft Solution Center and antivirus security for resources and tools to keep your PC safe and healthy.  If you have problems with the installation of the update itself, visit the Microsoft Update Support for resources and tools to keep your PC updated with the latest updates.

    Buying to meet problems installing Microsoft security updates also can visit the following page for assistance: https://consumersecuritysupport.microsoft.com/

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • Im getting this error code: 80080005 and dt000 but I do not understand why or how he got that way please help?

    Original title: help please if you can

    Im getting this error code: 80080005 and dt000 but I do not understand why or how he got that way please help?

    Hi LesaW,

    ·         Exactly when you receive this error code?

    Microsoft has released a new "Fix it" solution that should automatically solve your problems with Windows Update. Click on the link below and follow the instructions.

    How to reset the Windows Update components?

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

    I hope this helps.

  • Please help improve the JavaScript script

    Please help improve the JavaScript scriptA.JPG

    Hello

    to increase or decrease the height of a subform, you use the following syntax in the click of + and - button

    cmdAdd::JavaScript

    _Row1.addInstance (1);

    var b is parseFloat (Subform3.h) - 6.5;.

    If (b<>

    b = 0;

    }

    Subform3.h = b + "mm";

    cmdRemove::JavaScript

    If (_Row1.count > 1) {}

    var b is parseFloat (Subform3.h) + 6.5.;

    Subform3.h = b + "mm";

    _Row1.removeInstance (this.parent.index);

    }

    This should do the trick, I hope this will help you

  • Hello, I bought a monthly license paid for indesign last night and I do not understand how to play with it? When I opened the window of creative cloud, they suggested me to buy indesign (but I bought it already...) Please, help me... It's easy to al amend

    Hello, I bought a monthly license paid for indesign last night and I do not understand how to play with it? When I opened the window of creative cloud, they suggested me to buy indesign (but I bought it already...) Please, help me... This is our easy to understand for beginners like me at all

    FAQ: What should I do if I have a subscription, but my application acts as if I had a trial?

    https://forums.Adobe.com/thread/1962238

    Download/install the desktop application, connect and install applications subscription.

    https://helpx.Adobe.com/creative-cloud/help/download-install-app.html

    Creative cloud to desktop

    https://helpx.Adobe.com/creative-cloud/help/creative-cloud-desktop.html

    Sign out, sign in | Creative office cloud app

    http://helpx.Adobe.com/creative-cloud/KB/sign-in-out-creative-cloud-desktop-app.html

    Install, update, or uninstall applications

    http://helpx.Adobe.com/creative-cloud/help/install-apps.html

  • I lost some of the folders in the library.  They exist in the Explorer solutions, but somehow got removed from the library.  I can bring them back in but I'm afraid it will happen again in LR.  Please help me understand what happened and how can I prevent

    I lost some of the folders in the library.  They exist in the Explorer solutions, but somehow got removed from the library.  I can bring them back in but I'm afraid it will happen again in LR.  Please help me understand what happened and how can I prevent the recurrence. I use Win7.

    A few possibilities:

    1 > you click with the right button on the files and chose to remove them from Lightroom.

    2 > you have created a new catalog, and records that are not part of another catalog.

    Each of these scenarios seem like they could be a possibility?

  • Hi, I have a problem whit Creative Suite application installer. Friday I bought adobe package, but at the time of the installation tells me that your trial period has expired, when he asks license me I understand that I have a subscription... Please help

    Hi, I have a problem whit Creative Suite application installer. Friday I bought adobe package, but at the time of the installation tells me that your trial period has expired, when he asks license me I understand that I have a subscription... Please help me PS sorry for my English by Martina Faccia

    Hello

    Please see errors in connection with creative cloud and Creative Suite applications, activation and connection Solutions and Creative Cloud applications unexpectedly back in the test mode. CCM, CS6

    Hope that helps!

    Kind regards

    Sheena

  • I really need someone to help me. I tried to figure out how to select a PDF to convert a Word doc. When I go to select a PDF file, all that comes is the WORD documents. doesn't show ANY of my PDF files... Please help me understand wh

    I really need someone to help me. I tried to figure out how to select a PDF to convert a Word doc. When I go to select a PDF file, all that comes is the WORD documents. doesn't show ANY of my PDF files... Please help me understand what is happening? We put it on automatic renewal so I know it's not that we have not renewed this subscription, because we pay automatically.

    Hi olivias,.

    Looks like there may be some confusion on your system which application should be associated with PDF files. You can reset the file name associations by following the steps described in these articles (depending on your operating system):

    How to change the default application for a file type. Macworld

    http://Windows.Microsoft.com/en-us/Windows/change-default-programs#1TC=Windows-7

    Please let us know if you have any additional questions.

    Best,

    Sara

  • Please help me fix the script

    I try to write a script by my slef but not work

    app.findGrepPreferencest = firstLineIndent:8, leftIndent:8;

    app.changeGrepPreferences = firstLineIndent:8, leftIndent:16;

    app.changeGrep ();

    app.findGrepPreferences = app.changeGrepPreferences = null;

    Can someone please help me fix the script, please.

    Hello

    Try this.

    app.findGrepPreferences = app.changeGrepPreferences = null;

    app.findGrepPreferences.firstLineIndent = '8 ';

    app.findGrepPreferences.leftIndent = '8 ';

    app.changeGrepPreferences.firstLineIndent = '8 ';

    app.changeGrepPreferences.leftIndent = "16pt;

    app.changeGrep ();

    app.findGrepPreferences = app.changeGrepPreferences = null;

    Kind regards

    Cognet

  • Please help me fix my script!

    Please help me fix my script

    I use this script that copy from the adobe forum:

    app.findGrepPreferences.findWhat = "\\r";

    app.changeGrepPreferences.changeTo = "\\r\\r";

    app.changeGrep ();

    app.findGrepPreferences = app.changeGrepPreferences = null;

    to change my back one or two, but it will always change all my documents.

    How can I tell the script that I only want to change the selection?

    Hello

    Note the syntax ==> target changeGrep()

    If the target is app ==> it runs through the entire application of the ways each open document

    If the target is doc ==> it runs through all doc

    It can be called for textFrame, story, paragraph..., any text object.

    In your use case

    App.Selection [0] .changeGrep ();

    or browse the selection and appeal

    App.Selection [i] .changeGrep ();

    Jarek

Maybe you are looking for

  • Suspicious stops on my Satellite A100-881

    Hi, I bought a new Satellite A100 881 since autumn, and fine... I play my favorite games (World of warcraft, europa universalis 3) very well... but I lived 3 stops, first in January, last a few minutes ago. I thought it was overheating, classic behav

  • Windows update failure: 2007 Microsoft Office Suite Service Pack (SP1) and 967912 KB

    Windows Update automatic updates have been lacking on my laptop since October 11 (there were 15 updates, lack of each stop). I found a thread that stated that I could download and install the updates manually and was able to do this for all the updat

  • Reinstall windows xp but used the installation of 2nd hand disc

    How can I get a license my windows when I used a 2nd hand windows xp disk that I borrow? I thought I could use my key # my label to reinstall my windows when the computer crashed on me... i a presario v5000 compaq...

  • Restoring a deleted user

    I deleted a restricted user account (after put the files on a memory stick), now without the existing user I can't access them, can restore the user or someone he knows a way to get the files from the memory stick?

  • DMZ at lan w / NAT - config?

    customer premises requires access to our network. requirements: provide internet access restrict access to different servers nat addresses y at - it a config there that helps with dmz lan access? Thanks for any help.