AS3/AIR - for the loop is ignored but the rest of the function to run

This has left me speechless. It is either something really stupid on my part or part of the Flash. Here goes:

I have a function that accepts all simply a table of movieclip references, executes a loop to add them to a sprite container, then the container gives a background color. It works perfectly the first time. Now, when the program returns to this feature yet it completely ignores the loop but always adds the background color. Here's the function:

public void prepareContainer (sections): Sprite

{

trace ("prepareContainer called.");

trace ("cuts" + sections);

containerClips.splice(0,containerClips.length);

trace ("containerClips.length is" + containerClips.length);

for (var rs: int = 0; rs < sections.length; rs ++)

{

trace ("sections [" + rs + "] is" + [rs] sections);

}

var w: Number = 0;

var l:Number = 0;

for (var sx:int = 0; sx < sections.length; sx ++)

{

trace ("sx is" + sx);

section of the sections [sx] = var;

If (SX > 0)

{

section.y = sections [sx-1] there + .height sections [sx-1];

w = section.width;

l = l + section.height;

}

container.addChild (section);

}

container.graphics.beginFill (0xfafafa); Just for the background color in the container.

container.graphics.drawRect (0,0,w,l);

container.graphics.endFill ();

containerClips = sections;

for (var p:int = 0; p < containerClips.length; p ++)

{

trace ("containerClips [" + p + "] is" + containerClips [p]);

}

return the container;

}

You can also see that I have traces in the service to trace the content and the length of the incoming array.

It's track of the first time through:

called prepareContainer!

sections.length is [object ViewPrevTranClosed_AEM], [medicareHead_AEM object], [object NAMEsubscriberSection_AEM], [object SearchInformationSection_AEM]

containerClips.length is 0

sections [0] is [object ViewPrevTranClosed_AEM]

sections [1] is [object medicareHead_AEM]

sections [2] is [object NAMEsubscriberSection_AEM]

sections [3] is [object SearchInformationSection_AEM]

SX is 0

SX is 1

SX is 2

SX is 3

containerClips [0] is [object ViewPrevTranClosed_AEM]

containerClips [1] is [object medicareHead_AEM]

containerClips [2] is [object NAMEsubscriberSection_AEM]

containerClips [3] is [object SearchInformationSection_AEM]

============================================

As you can see, the traces in the loops went very well and the result is as expected. The container is filled with the movieclips. However, on the next time through the result is that the background color and none of the movieclips are added to the container. The following trace shows also that the loops did not stand even if the table is full and there is no condition that stop the loops. This is the inside track:

called prepareContainer!

sections.length is [object ViewPrevTranClosed_AEM], [medicareHead_AEM object], [object NAMEsubscriberSection_AEM], [object SearchInformationSection_AEM]

containerClips.length is 0

Any ideas on what is the cause?

You can have a circular reference. containerClips is the same table that the sections. Try this simple test:

array1 = [1,2,3,4] var;

var array2 = array1;

array1.splice(0,array1.) Length);

array1 = [];

trace (array2. Length);

I'm sure that you expect to see it trace 4, but it trace 0. Now try to use the line commented out instead. Now you get a record of 4.

If somewhere in your code you establish sections also point to the same table as containerClips, that you really wanted to duplicate a table, you can use the concat:

Var items = containerClips.concat ();

It would be either his own picture double and a pointer to the same table.

Tags: Adobe Animate

Similar Questions

  • Some sizes of icons are missing in the AIR for the android settings

    In the new CC animate, icons in 'AIR for iOs parameters' list have been updated (180, 60, 75, 87, 167 have been added), but the icons in the list in 'AIR for Android settings' is always the same...

    We need icons for 144px and 192px:

    < image144x144 >... < / image144x144 >

    < image192x192 >... < / image192x192 >

    For now, I have to add them manually whenever I opened the AIR for Android defining which reset the app descriptor file, it's really annoying.

    Is it possible to change this list somewhere in a config file, update animate IDE?

    Always on management of icons in flash/animated in the IDE.

    When go us for iOs AIR and AIR for Android, icons lists are reset every time and we have to choose each one icons again, is such a waste of time.

    Why the specifications of the icons are not stored for each platform?

    And a little more automatic to set these icons would be very great, a few ideas:

    • Double click directly in the list to open the Browse dialog box directly
    • Add the ability to directly select a directory map and automatic files icon in the list

    Hello

    We are currently working on adding the sizes of icons in the AIR for the Android settings dialog box. Will update you did once.

    I added your other suggestions related to the management of icon to our backlog of product for review.

    Thank you!

    Mohan

  • Input parameters for the function/procedures

    Hello

    I have an input parameter in varchar2 to a procedure and a function.

    Oracle says that you can pass to the maximum value of 32767 bytes inside a pl/sql block for a varchar2.

    But outside, it is limited to 4000 bytes.

    Here, there is a small suitcase of test
    create or replace procedure test_p(a in varchar2) as 
     begin
      null;
       commit;
         End;
    
    CREATE OR REPLACE FUNCTION str2tbText(p_str in varchar2) return varchar2
            IS
                      begin
                return null;
          END str2tbText;
    
    SQL> declare
      2  a varchar2(32767);
      3  b varchar2(32767);
      4  c varchar2(32767);
      5  begin
      6  for i in 1..4004 loop
      7  b:=b||'a,';
      8  end loop;
      9  test_p(b);
     10  --select str2tbtext(b) into c from dual;
     11  commit;
     12  end;
     13
     14  /
    
    PL/SQL procedure successfully completed.
    
    SQL> declare
      2  a varchar2(32767);
      3  b varchar2(32767);
      4  c varchar2(32767);
      5  begin
      6  for i in 1..4004 loop
      7  b:=b||'a,';
      8  end loop;
      9  --test_p(b);
     10  select str2tbtext(b) into c from dual;
     11  commit;
     12  end;
     13
     14  /
    declare
    *
    ERROR at line 1:
    ORA-01460: unimplemented or unreasonable conversion requested
    ORA-06512: at line 10
    IAM here to more than 4000 bytes as an input parameter for a function of years of proceedings,
    But it works for the procedure...
    For the function, it throws error

    No specific reason please...

    Kind regards
    Mohammed

    This means that you have found the answer you're looking for? Then you can close the thread...

  • Error - Rome: Total War did not find DirectX 9, which is required for the game to run. Please reinstall DirectX.

    Original title: problems running Vista on Bootcamp DirectX.

    I have browsed the web for the last little while and cannot find any solution.

    I am trying to run Rome Total War on Vista, on bootcamp on my iMac 27 ". However, every time I start the game is active an error message saying "Rome: Total War has not find DirectX 9, which is required for the game to run." Please reinstall DirectX.

    I've been searching the net and have used some DirectX downloads (9) on several trusted sites, but the error message always everytime that I try to run the game.

    I have 'Run' 'dxdiag' and on the 'system' tab is says I have DirectX 11, section 'Information System '.

    I do not know where to go from here, any help would be greatly appreciated

    Have you installed this installation?

  • error: implicit declaration of function 'GetActiveProcessorCount' is not valid in C99. Make sure that you include the prototype for the function.

    I get the following error:

    error: implicit declaration of function 'GetActiveProcessorCount' is not valid in C99. Make sure that you include the prototype for the function.

    I've included windows.h

    which includes winbase.h

    Winbase.h contains the prototype for the function in the above error message.

    If I disable 'Require the function prototypes' and 'Building with the C99 extensions', I get the following error:

    error: Undefined symbol "_GetActiveProcessorCount" referenced in "c:\Users\Public\Documents\National Instruments\CVI\HDLC\cvibuild. HDLC_RandD\Debug\HDLC_RandD.obj ".

    I work in the ICB 2013 SP2.

    Why I get this error.

    This function is only valid in Windows 7 and later versions. Because the ICB 2013 still supports Windows XP, this feature is excluded by default from Windows headers that are provided with CVI. If you do not need to worry about the versions of Windows prior to Windows 7, however, you can include it yourself, by adding the following macro in the dialog box options generation CVI (be sure to include for all configurations):

  • The doc for the function of the subset of the table shows the extensible function

    In LabView 2010 the doc for the function of the subset of the table shows that the function is expandable with indexes and multiple lengths. I can't expand the function for multiple indexes. How can I do this?

    Is the documentation for the function by mistake, or is there another function of a subset of the table somewhere that can do this?

    Subset of table details

    When wire you an array to the function, the function is automatically resized to display entries index for each dimension of the array. If wire you a table 1 d to the function, the function displays the index for an item entries. If wire you a 2D to function, the function table displays the entries index for a line and column, respectively. If wire you a 3D through the nD to the function, the function displays the index for a page entries.

  • A software says I need 4 MB of VM set aside for the program to run.

    Original title: virtual memory.

    How to set 4 MB of virtual memory in windows xp? A software says I need 4 MB of VM set aside for the program to run.

    Hi KennethBrasel,

    Welcome to the Microsoft community where you can find all the answers related to windows.

    According to the description provided, looks that you receive a virtual memory message when installing a program on Windows XP computer.

    By default, the virtual memory paging file that is created during installation is 1.5 times the physical RAM on your computer. Therefore, a computer that has 1 GB of RAM installed will have 1.5 GB of virtual memory.

    You can manually change the size of the swap file to make it larger or smaller. You can also optimize virtual memory use by dividing the space of files between multiple drives and by removing the disks slow or very open space.

    He would be grateful if you can answer this question in order to help you further.

    1. What is the size of your RAM memory?
    2 are. what program you referring?

    I suggest you try the following steps to change the virtual memory:

    a. Click Start, right click my computer and then click Properties.

    b. in the System Properties dialog box, click the Advanced tab.

    (c) in the results pane, click settings.

    d. in the performance Options dialog box, click the Advanced tab.

    e. in the virtual memory section, click on change.

    f. change the initial size value and the value of maximum size to a higher value, click on set and then click OK.

    g. click OK to close the performance Options dialog box and then click OK to close the System Properties dialog box.

    Note: With virtual memory, the computer can use the hard drive as memory (RAM) space. The computer uses virtual memory to increase the ordinary RAM that is installed on the computer. If you reduce the size of the pagefile, some the program may not start correctly or may not start at all. This problem may occur even if the computer has plenty of RAM.

    If you need Windows guru, do not hesitate to post your questions and we will be happy to help you.

  • What is the difference between DC of Acrobat Reader and Acrobat Standard DC? I'm looking for the function to extract pages of large documents.

    What is the difference between DC of Acrobat Reader and Acrobat Standard DC? I'm looking for the function to extract pages of large documents.

    Acrobat Reader is just a viewer/reader PDF; It cannot modify or create PDFs.

    You will need Acrobat Standard or Pro to extract pages from a PDF.

  • I want to create the function for the function create for ODD or EVEN (NUMBER)

    I want to create the function for the function create for ODD or EVEN (NUMBER) also
    If number is odd, multiply by 5
    If there is an even number, multiply it by 10;

    Not tested,

    create or replace function fnc_env_odd(p_number in number)
    return number as
    begin
     if p_number>0  -- Remove if you want to consider negative numbers also
       if mod(p_number,2)=0 --Means even
          return p_number*10;
       else                 --Means odd
          return p_number*5
       end if;
     end if;
    end;
    /
    

    G.

  • While loop, wait for the function and the stop button!

    Hello

    I have a while loop and a stop button. Inside my While loop - I have a 'Wait (x ms)' function. If I press the stop button, it does not block the program immediately, he expects ms x then stops the program. How can I get rid of this?

    Thanks in advance for the help!


  • Satellite A60 - need drivers for the function keys. Urgent!

    I installed Windows XP Pro on my laptop Toshiba Satellite A60, but after that I couldn't use the function key. I've been looking for driver but I haven't found yet, even in this Web site.
    Someone knows it please help me what to do. Thank you so :)

    Hello

    That fear I know, first I have to install Hotkey Utility.
    After that, please install all other tools & utilities. Try this and let me know if was successfully.

  • Heating problems Strain Gage; Wait for the function measurement of delay

    Hello

    I am able (using four 350 ohm gauges) of the strain using a NI 9237 module with a cDAQ in connection Full deck Type 3. My test is to measure the strain over long periods of time (~ 10 days). The NI 9237 measure strain at a rate of 2000 Hz (this is the slowest rate). The wheatstone bridge is currently powerd with the NI 9237 of 2.5 V. When I get my data permanently, I see the strain increases with time (which it shouldn't do my test), and I suspect it's because of free heating strain gauges. So, to overcome this problem, I think using "Wait (ms)" and ask the program to obtain data once every 5 min. Five minutes should be more than enough to dissipate any overheating of the gauge.

    My question is: if I use the function 'wait (ms)', is my sensor (extensometer) are constantly under tension during the time-out of 5 minutes? I think that the functions "queue" are used inside a loop to allow a VI to sleep during the prescribed period (correct me if I'm wrong). So, it means that the sensor is not powered during this time?

    Thank you

    SID

    I wouldn't use "wait" function for your timing... software you can use the time elapsed or other timing functions

  • Automated for the function name print OR-report

    Hello

    I use NEITHER-report, using the function NIReport_Print, I noticed that I still need to choose my file name.

    I want to put a var lets say:

    reportFileName Char [256];

    in the app, I'll put reportFileName and I want the report to save automatically to a folder using the file name, it is possible using EITHER report?

    I searched a function to do, as we have excellent report but I could not find...

    Hello

    I think you are trying to print to a PDF printer.

    In this case, it's the PDF printer asking for the directory and file name to save the PDF file, no report - NOR.

    NEITHER report could not save the report as a file by itself.

    You must find a PDF printer, which has a kind of automation.

    Personally, I use BullZip PDF Printer that allows you to change the settings via the command line parameters.

    Hope this helps,

  • Unable to browse the internet for the VPN (ASA5505 running 8.3)

    We have improved our ASA 5505 to 8.3 firmware image (2) and we have a working VPN configuration (customer VPN in Windows can connect and browse the network of the company as well as their local networks [split tunnel seems to work in this regard]).  However, some time connected they are unable to also browse the internet.  In our configuration of 8.2 (1) we have done 'something' to allow remote users to browse the internet at the same time, but apparently this is not transferred in the upgrade.

    I'm sure it's a simple nat our order routing, but it can't know.  I've gotta hit the road now but will post our config this afternoon if no one knows the "secret" to do.  Ideally, internet traffic to remote users out of their internet connection and not be achieved through the office.  We understand the risks associated with it.

    Hi Scott,.

    To the best of my knowledge, I don't think that l2tp over IPSec supports split tunneling. If you use the Cisco VPN client, you should be able to get this working.

    What we can do in this case is to set up turn on the SAA for these vpn clients. Please add the commands to run below:

    permit same-security-traffic intra-interface

    network of the NETWORK_OBJ_10.0.0.0_27 object

    dynamic NAT interface (outdoors, outdoor)

    Let me know if it helps!

    See you soon,.

    Assia

  • Is there a way where I don't have to use the "Fn" key for the function keys?

    If I use my computer hp laptop with Windows 7 that has the standard PS/2 keyboard. I'm just annoyed by the fact that I have to press the "Fn" with the function keys. I searched some of the settings to see if I could find a sort of toggle keys to function or something, but I couldn't find something that seems to help. If someone knows a solution, please answer. Thank you!

    Hello

    You should be able to change this in your menu of bios - see the link below for more details.

    http://support.HP.com/us-en/document/c02035108

    Kind regards

    DP - K

Maybe you are looking for

  • Disable Web sites to change my font

    Because of a visual impairment and the use of SuperNova, I need to do the following in Mozilla which has worked successfully on IE Open Internet Explorer, then on the menu, go to Tools - Options-Internet-security, then select Custom Level and setting

  • Windows 8 - default mail client

    I use windows 8 pro RTM.  Share in the selection of photos from the file manager, the option to e-mail tab is grayed out.  If I click with the right button on the photo and select send to - recipient of the message I get a message stating... "There a

  • When will be released Windows 7 SP1 via WSUS?

    I see that Windows 7 SP1 is available for download and also appear through Windows Update.  The update does not appear when I sync my WSUS server.  Anyone know when it will be available via WSUS? Thank you!

  • WAP4410 password

    We have a physically inaccessible WAP4410N because of its location on top of a large warehouse. It is online and functioning, but we have no record of the password to login and change the settings of the administrative apparatus. Is it possible to re

  • cant TX new hotsync to transfer former TX Info

    Can anyone help? I'm desperate. I'd be happy to call you if you would be easier to guide me this way. I can't get my new (2nd hand) TX synchronize in order to transfer all the info from the old, but I have no former synchronization problem. (the reas