Can't duplicate movieclips as an array within an array

Hello.
I have an animation that loads an xml into it and traces back
an array within an array. I have tried to apply this to duplicated
movieclips thereby creating a structured set of links. What I am
trying to do is this:
Chicken Nuggets
__Compression
__Texture
__Disgust
Mega Warhead
__Taste
__Hardness
__Pain
This traces fine but I can't seem to get the duplicated
movieclips to assemble in this fashion.
The code for the XML is as follows:
var controlArray:Array;
var variable:Array;
var testTopic = new Array ();
var test = new Array ();
var controlsXML:XML = new XML();
controlsXML.ignoreWhite = true;
controlsXML.onLoad = function(success:Boolean){
if (success){
var mainnode:XMLNode = controlsXML.firstChild;
var controlNodes:Array =
controlsXML.firstChild.firstChild.firstChild.firstChild.childNodes;
var list:Array = new Array();
for (var i:Number = 0; i < controlNodes.length; i++) {
var personnode:XMLNode = controlNodes
.attributes.Name;
trace(personnode);
testTopic.push (new struct (personnode));
var specificNode:Array = controlNodes.childNodes;
for (var j:Number = 0; j < specificNode.length; j++){
var itemnode:XMLNode = specificNode[j].attributes.Variable;
trace(itemnode);
test.push (new struct2 (itemnode));
printer ();
printer2 ();
} else {
trace('error reading XML');
controlsXML.load ("controls3.xml");
The code for the movieclip duplication is as follows:
x = 50;
function printer ()
for (m = 0; m < testTopic.length; m++)
duplicateMovieClip ( slotTopic, "slotTopic" + m, m );
slotTopic = eval ( "slotTopic" + m );
slotTopic._y += x;
slotTopic.slotTopicContent.text = testTopic[m].personnode;
function printer2 ()
for (k = 0; k < test.length; k++)
duplicateMovieClip ( slot, "slot" + k, k );
slot = eval ( "slot" + k );
slot._y += x;
slot.slotContent.text = test[k].itemnode;
function struct (personnode)
this.personnode = personnode;
function struct2 (itemnode)
this.itemnode = itemnode;
On the stage are two movieclips, titled "slotTopic" and
"slot". Within those are dynamic text boxes titled respectively
"slotTopicContent" and "slotContent". When I preview this file it
only displays the text within the "slot" movieclip and it lists all
six of the subtopics with no break. So, there are two dilemmas:
1) The movieclips won't duplicate into the structured set of
links that I want.
2) "slotTopic" is not displaying text at all.
If anyone has any advice, I'd really appreciate it.
Thx!

ok, I'm sorry but there are quite a few things wrong here.
first though, when posting code please use the 'attach code'
button.
1) i can't imagine that you have a XML structure as deep as
your calling to or the need for it with the limited amount of
infomation your pulling, in addition your storing the info in
attributes, so I can't see how this would work, it may 'trace' out
the right text (somehow) but it's not getting into the arrays
properly.
2) you do not assign an attribute value to a XMLNode, and
then try to push it into an array.
3) you do not call a method (struct or struct2) using the
'new' operator. this is how you envoke a new 'class' instance.
4) do not use 'x' as a variable name as it is a reserved var
in flash, assigned to an Object instance.
5) the duplicateMovieClip() method needs to be called upon
the existing clip as in:
slotTopic.duplicateMovieClip('slotTopic'+m, m);
additionally you can pass the _y placement within the
initObject.
6) you do not need to use eval, it isn't doing anything here,
you will gain the correct path by calling duplicateMovieClip
correctly.
7) the reason why slotTopic is not being displayed at all is
because of the second loop, you are duplicating the clips
(incorrectly) into the same depths thereby replacing all of the
contents of the slotTopic depths previously constructed.
the solution to this problem is to construct both items with
the same loop but increament one of the depth assignments by a
specific number, in other words at depths much higher or at least
different, than that of the first element, as in:
slotTopic.duplicateMovieClip('slotTopic'+m, m, {_y:50});
slot.duplicateMovieClip('slot'+(m+100), m+100, {_y:50});
again I'm sorry man, but it will take some work to sort this
out.

Similar Messages

  • How to add an Array within an array?

    Hi friends can any body guides me how to add array within array.
    Actually i am getting Array from server side and i have to append one more node(Array) in same array and send it back to them.
    here is the structure of my array that i am getting from server side.
    temp = Array (@4445e09)   
        [0] = mx.utils.ObjectProxy (@4314821)   
            Mylanguages = Array (@4445b69)   
                [0] = Object (@449ac91)   
                    Mylanguage = "English"   
                    Mylanguage_code = "EN"   
                    Mylanguage_id = "1"   
                    selected = "Y"   
                length = 1   
            currentpage = "1"   
            definition_id = "20"   
            delete_record = "Y"   
            edit_record = "Y"   
            insert_record = "Y"   
            numberofpages = "1"   
            numberofrecords = "1"   
            object = Object (@4432449)   
            productgroups = Array (@43cea51)   
            type = null   
            uid = "111111"   
        length = 1
    I have to add an array similar to like Mylanguages  containing object which contain some info like some ids. and my array becomes
    ttemp = Array (@4445e09)   
        [0] = mx.utils.ObjectProxy (@4314821)   
            Mylanguages = Array (@4445b69)   
                [0] = Object (@449ac91)   
                    Mylanguage = "English"   
                    Mylanguage_code = "EN"   
                    Mylanguage_id = "1"   
                    selected = "Y"   
                length = 1   
            currentpage = "1"   
            definition_id = "20"   
            delete_record = "Y"   
            edit_record = "Y"   
            insert_record = "Y"   
            numberofpages = "1"   
            numberofrecords = "1"   
            object = Object (@4432449)   
            productgroups = Array (@43cea51)
           AddedNOde= Array (@4445b69)   
                [0] = Object (@449ac91)   
                    id= "10"   
                    tempId= "100"   
                    Mylanguage_id = "1"   
                length = 1           
            type = null   
            uid = "111111"   
        length = 1   
    please tell me how it possible.
    Thanks in Advance
    Regards
    Vineet osho

    Hi Vineet,
    You can simply add another Array as shown below:
    for each(var obj:Object in temp)
         obj.AddedNOde = YourNewArray;
    By doing above NewArray is added to  all the objects of temp Array.
    Thanks,
    Bhasker
    Message was edited by: BhaskerChari

  • Using an array within an array, and exporting to CSV

    I am gathering data about an AD user, including group membership and I want to output that to a CSV. Easy enough right? Not so much :) I am successfully generating 2 arrays, one has user data and the 2nd has group membership, but it's not exporting properly
    to CSV. I've tried the -notypeinformation but it's still showing up.
    My code is below, followed by contents of CSV file in text format.
    cls
    #declare array to use
    $user_main = @()
    $arrGroups = @()
    $user = Get-ADUser -Filter {samaccountname -eq "MyUserName"} -Properties *
    $temp_user.Name = $user.Name
    $temp_user.SAMname = $user.SamAccountName
    $temp_user.lastpwchange = $user.PasswordLastSet
    $temp_user.lastlogon = $user.LastLogonDate
    #get group membership
    $groups = $user.memberof
    foreach ($group in $groups)
    $temp1 = $group.Split(",")
    $group_name = $temp1[0].Substring(3, $temp1[0].Length -3)
    #$arrGroups += New-Object -TypeName psobject -Property $temp
    $arrGroups += $group_name
    $user_main += New-Object -TypeName psobject -Property $temp_user
    #$user_main | select * | Format-Table
    #$arrGroups
    $new = $user_main + $arrGroups
    Export-Csv -InputObject $new -Path c:\test\test.txt -NoTypeInformation -Encoding "utf8"
    Write-Host ""
    Write-Host "Done"
    The resulting text file contains:
    "Count","Length","LongLength","Rank","SyncRoot","IsReadOnly","IsFixedSize","IsSynchronized"
    "45","45","45","1","System.Object[]","False","True","False"
    So I have 2 issues. One is the "export-csv -notype" isn't working quite right, not sure why. And secondly, you can see the System.Object[] entry, which I believe is my array of groups. I need that to display the names of the groups the user belongs
    to.
    Any help is greatly appreciated!

    Hi Robert,
    I’m writing to just check in to see if the suggestions were helpful. If you need further help,
    please feel free to reply this post directly so we will be notified to follow it up.
    If you have any feedback on our support, please click here.
    Best Regards
    Anna
    TechNet Community Support

  • Insert values in an array (within a function)

    Hello,
    I can't seem to get values insert in an array. I know it
    works outsite the function but
    when using variables in a function and trying to insert this
    in an array it does not work.
    The values are empty.
    But if you uncomment the line someArray.push(a0,a1,a2) and
    uncommend the for loop it works.
    In actionscript 2.0 i could use eval ..but in actionscript
    3.0 you have to use this to convert a string to a value.
    Does anyone see, what i am doing wrong?
    function doSomething() {
    var a0:String = "hello";
    var a1:String = "why doesn't it";
    var a2:String = "work!";
    var someArray:Array = new Array();
    //someArray.push(a0,a1,a2);
    for (var i:uint =0; i<=3; i++) {
    someArray.push(this["a"+i]);
    trace(someArray);
    doSomething();

    In this case, the problem arises from a scope issue. The vars
    are defined within the function so they are visible only within the
    function. When you use "this" you are referencing the object that
    contains the function, which cannot see those vars (they do not
    exist for "this", only for the function). It works if you go this
    way...
    var a0:String = "hello";
    var a1:String = "why doesn't it";
    var a2:String = "work!";
    function doSomething() {
    var someArray:Array = new Array();
    for (var i:uint=0; i<3; i++) {
    someArray.push(this["a"+i]);
    trace(someArray);
    doSomething();
    The other line: someArray.push(a0,a1,a2);
    does work because it is within the function and can see the
    vars.

  • Duplicate movieclip not working!!

    i have create a function for duplicate movieclip but when i
    call for the function it not working. Is there anyone who can help
    me to trace wats going on wif my script? i have been trying to
    figure out but still cant find out wat went wrong.
    Below is my code:

    thanks kglad! finally got the duplicate work!!!

  • Change value of string within an array?

    Alright, so im trying to change "hello" to "Aello", there fore im changing the first letter of the string to an "A". This string is within an array:
    This is what i have:
    System.out.println ((char)split[1].charAt(0))='a');
    but im getting an error

    I think you mean:
    split[1] = "a" + split[1].substring(1);
    System.out.println(split[1]);
    Strings are immutable which means they cant be changed. The only
    thing you can do is create new Strings.
    hello <- you cant make the 'h' an 'a'
    a + ello <- but you can create a new string from 'a' and the rest of 'hello'
    Edited by: TuringPest on Nov 25, 2007 10:01 PM

  • Determine index of array within event structure

    I am doing some testing with dynamically registered events.  For these testing purposes, I have 2 separate arrays of boolean references hooked up to the dynamic input terminal.  The event structure is executing like I expect it to.  The only problem is that I want to know the index within the array for the event that triggered the value change event.  I would have thought I could use the CtlRef node to determine this, but instead it returns a reference to the actual boolean control that triggered the event.
    I could write a subroutine that searches for the label of the boolean that triggered the event within the arrays, but that is not efficient or good practice.
    So for instance, if I click on Boolean 2, I'd want the event structure to know it was array #1, index 1.  If I click on Boolean 6, I'd want the event structure to know it was array #2, index 2.
    Is this possible?

    That is a very good idea.  The caption is good to use for the label you show to the user.  You can change it to show different things, even programmatically, such as if you need to make your application more international and have it display controls in different languages to different users.  It lets you use longer or more descriptive names, without having those long names eat up block diagram space.
    Another thing I've done is take the control reference and search for it among the array of control ireference.  Search 1-D array will give you the index of the control within the array.  Then I can use that index and apply it to a different array and index out a value from that.  It could be a name, or perhaps a numeric value I use as a multiplier or something like that.  Just make sure there is a one to one correlation between the references in the array and whatever is the other array you are getting additional data from.  For what you have drawn now, it could be a little bit complicated because you actually have two different 1-D arrays of references.  But if you concatenated those arrays together, you'd have a single 1-D array you can search.

  • Arrays within custom Classes - same array for different instances?

    Hello all,
    I have made a very simple custom class for keeping track of groups of offices for a company.  The class has a Number variable to tell it how many different offices there are, and an Array to store the individual offices by name.  It looks like this.
    class officeCluster
        static var _className:String = "officeCluster";
        // variables
        var numOffices:Number;
        var locationArray:Array = new Array();
        // functions
        function officeCluster()
            trace("officeCluster constructor");
    Very simple!
    Now, it is my understand that when I create different instances of the class, they will each have their own version of "numOffices" and their own version of "locationArray".
    When I run traces of "numOffices", this seems to be true.  For example,
    trace(manufacturingOfficeCluster.numOffices);
    trace(servicesOfficeCluster.numOffices);
    yields
    5
    4
    In the output panel, which is correct.  However, there is trouble with the locationArray.  It seems that as I assign different values to it, regardless of what instance I specify, there is only ONE array- NOT one for each instance.
    In other words,
    trace(manufacturingOfficeCluster.locationArray[1].theLocation);   // theLocation is a String.  The locationArray itself holds Objects.
    trace(servicesOfficeCluster.locationArray[1].theLocation);
    yields
    New Haven, CT
    New Haven, CT
    even though I have defined elsewhere that they are different!
    Is anyone aware of any issues partaining to using Arrays within Class instances?  Any help would be appreciated!
    note:  I've been able to work around this by creating multiple arrays within the class and using a different one for each instance, but this seems very sloppy.

    Unfortunately, the code segment you attached results in:
    12
    12
    in the output panel.   So the problem must lie elsewhere!  Let me give some more detail...
    There are several files involved. The "officeCluster" class file looks like this:
    class officeCluster
         static var _className:String = "officeCluster";
         // variables
         var numOffices:Number;
         var locationArray:Array = new Array();
         // functions
         function officeCluster()
            trace("officeCluster constructor");
    I have two actionscript files which contain object data for the individual offices.  They look like this...
    var servicesOfficeCluster = new officeCluster();
    servicesOfficeCluster.numOffices = 4;
    var newHope:Object = new Object();
    newHope.locationName = "New Hope Office";
    newHope.theLocation = "New Hope, NJ";
    //more data
    servicesOfficeCluster.locationArray[0] = newHope; //array index is incremented with each entry
    //more Objects...
    and like this...
    var manufacturingOfficeCluster = new officeCluster();
    manufacturingOfficeCluster.numOffices = 5;
    var hartford:Object = new Object();
    hartford.locationName = "Hartford Office";
    hartford.theLocation = "Hartford, CT";
    //more data
    manufacturingOfficeCluster.locationArray[0] = hartford; //array index is incremented with each entry
    //more Objects...
    As you can see, the only difference is the name of the officeCluster instance, and of course the Object data itself.  Finally, these are all used by the main file, which looks like this- I have commented out all the code except for our little test -
    import officeCluster;
    #include "manufacturingList.as"
    #include "servicesList.as"
    /*lots of commented code*/
    manufacturingOfficeCluster.locationArray[1].theLocation = "l1";
    servicesOfficeCluster.locationArray[1].theLocation = "l2";
    trace(manufacturingOfficeCluster.locationArray[1].theLocation);
    trace(servicesOfficeCluster.locationArray[1].theLocation);
    Which, unfortunately, still yields
    12
    12
    as output :\  Any ideas?  Is there something wrong with the way I have set up the class file?  Something wrong in the two AS files?  I'm really starting to bang my head against the wall with this one.
    Thanks

  • Can I duplicate my Aperture library so I can use one to import into new Photos app?

    Hi, I'm using latest version of Aperture and Yosemite. I'd like to try the new photos app but still be able to use Aperture. Can I duplicate the library and just use the copy to do so? Or is there another way that I'm not aware of?
    Thanks in advance.
    John

    You must be within the Country with a Valid Billing Address and Credit Card for that Country to use the iTunes Store of that Country...

  • How can I render an active link (yrl) within a UIX/XML page

    How can I render an active link (url) within a UIX/XML page.
    How can I get <jbo:ShowValue> to work in UIX/XML, or is there another way?
    Bill G...

    It may seem strange, but the <contents> of <rawText> aren't actually
    raw - it's only the "text" attribute that's raw. (It seems strange because
    it is. Ah well.) This is different from UIX JSP.
    So, try something like the following:
    <bc4j:attrScope name="Notes">
    <contents>
    <rawText text="&lt;a href=&quot;"/>
    <rawText>
    <boundAttribute name="text">
    <bc4j:attrProperty name="value"/>
    </boundAttribute>
    </rawText text="&quot;&gt;"/>
    Some text in the link.
    <rawText text="&lt;/a&gt;"/>
    </contents>
    <bc4j:attrScope>
    Thankfully, this will be much simpler in 9.0.3, when the following
    will work:
    <link text="Whatever you want">
    <boundAttribute name="destination">
    <bc4j:attrValue name="Notes"/>
    </boundAttribute>
    </link>

  • How can I duplicate a control in a subVI using the reference?

    Here's what I want to do. I have a tree control in my main application. I add and delete items dynamically based on user input. If I pass my tree reference to a subVI, I can add, subtract and reorder the items in the tree and the changes are shown on the main tree. How can I duplicate the tree in the subVI? Would I simply pass the tree control in (which I'd rather not do) or is there some other way to accomplish this?
    Thanks in advance for any help.
    Gary

    Here's my attempt.  This VI uses a control reference of the old tree and generates a data structure that can be used by the "Edit Tree Items.Add Multiple Items to End" method to add contents to the new tree that should be identical to the contents of the original tree.  Note that this VI only works with LabVIEW 8.0 and later, since the afore-mentioned method is not available in previous versions.
    I hope this helps...also note that I saw some re-draw issues with LabVIEW 8.0, i.e. after the VI ran, I didn't see the tree displayed properly until I minimized/restored the window, or dragged another window over it.  I did not see the redraw issues in LabVIEW 8.2.
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    Duplicate Tree.vi ‏21 KB

  • Can anybody help me set this code into an array?

    Thanks, can you help me understand how to make an array work?
    I need to fade toggle a different country png for each country button and fade out the rest of the country images i.e.: when i click the UK button i need to fade toggle the UK png and fade out the other countries
    when i click the USA button i need to fade toggle the USA ing and fade out the other countries and so on
    sym.getSymbol("Countries").$("UK").fadeToggle();sym.getSymbol("Countries").$("USA","AUS","Hongkong","Switzerland","Ireland","Indias","Japa n","Netherlands","Spain").fadeOut();
    sym.getSymbol("Countries").$("USA").fadeToggle();sym.getSymbol("Countries").$("UK","AUS","Hongkong","Switzerland","Ireland","Indias","Japan ","Netherlands","Spain").fadeOut();
    etc
    but it doesn't seem to work how i have it and i have been told to do an array but I'm not sure how?
    Project here if you want to have a look:
    Dropbox - Countries.zip
    can you help?

    I think this[var = sym.getSymbol (Stanbuttons).$(".UK_stan, .USA_stan"); ] should be
    var myvar = sym.getSymbol (Stanbuttons).$(".UK_stan, .USA_stan");
    And than
    myvar.each(function(){
    $(this).fadeOut();

  • Error: An integer constant expression is required within the array subscrip

    hello all,
    here is a small piece of code which compile well with g++:
    #include <iostream>
    using namespace std;
    int main () {
    int i= 0, j=4 ;
    cout <<" i=" ; cin >> i ;
    cout  << "i="<<i<< endl;
    if ( i > 1) {
       double xx [i+5];
       int n= i+5;
       for (int k =0 ; k < n ; k++) xx[k] =k;
      cout << "xx[2]=" << xx[2] << " xx[4]=" << xx[4] <<" xx["<<i<<"]="<< xx[i] <<en
    dl;
      cout << "xx[1]=" << xx[3] << " xx[5]=" << xx[4] <<" xx["<<n-1<<"]="<< xx[n-1]
    <<endl;
    }with Sun Studio 12 CC, the error is:
    "x.C", line 12: Error: An integer constant expression is required within the array subscript operator.
    1 Error(s) detected.Is there an option to force CC to accept it? i read that CC has some gnu extensions (http://docs.sun.com/source/820-4155/c++.html)
    Thanks in advance for help,
    gerard

    This works:
    #include <iostream>
    #include <alloca.h>
    using namespace std;
    int main () {
    int i= 0, j=4 ;
    cout <<" i=" ; cin >> i ;
    cout  << "i="<<i<< endl;
    if ( i > 1) {
       double *xx = ( double * ) alloca( sizeof( *xx ) * ( i + 5 ) );
       int n= i+5;
       for (int k =0 ; k < n ; k++) xx[k] =k;
      cout << "xx[2]=" << xx[2] << " xx[4]=" << xx[4] <<" xx["<<i<<"]="<< xx[i] <<en
    dl;
      cout << "xx[1]=" << xx[3] << " xx[5]=" << xx[4] <<" xx["<<n-1<<"]="<< xx[n-1]
    <<endl;
    }

  • TS3899 I recently discovered that I can no longer access websites pointed to within the content of an email message on my iPad Air by clicking on the highlighted HTML text or symbols. What should I do to correct this issue?

    I recently discovered that I can no longer access websites pointed to within the content of an email message on my iPad Air by clicking on the highlighted HTML text or symbols. What have I done to create, and what should I now do to correct, this issue?

    Or you could include a width to your body style:
    body {
    background-image: url(Logo/sky1.jpg);
    background-position: center center;
    background-attachment: fixed;
    width: 75%;}
    It might work or not depending on your other color scheme.

  • Oh can I duplicate a page in a PDF file?

    How can I duplicate a page in a file? I thought I could
    just drag it down but that doesn't seem to work.

    thank you
    Amy Watt
    [email protected]
    978-778-4368

Maybe you are looking for

  • Exception in connection with MS sql-server2000

    i have following code import java.sql.*; import java.*; class Conn2      public static void main(String args[])throws Exception           Driver d=(Driver)Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();           Connecti

  • How to transpose columns to rows in ODI

    Hi, I am trying to transpose Columns to rows along with Headers. For instance if i have Account Name | Assigned To | Lead Source | Currency | Onsite_April |Offisite_April2 | FCST AMC LIC April | | | | | | Microsoft | Mark | Channel1 | INR | 1000 | 20

  • Photoshop CS6 still running in Background Processes, won't close

    Lately, I've been having a problem with Photoshop CS6 where, even after I close the program, Photoshop.exe is still running under Background Processes in the task manager. Hitting "end task" on the program doesn't do anything. It takes up quite a big

  • ORA-20001: This demonstration can only be installed into an Oracle....

    I tried to install demostration and get en error: ORA-20001: This demonstration can only be installed into an Oracle database which has the English preferences loaded for Oracle Text. Please contact your administrator. What is that? O:10.2.0.1 XE (la

  • Deployment operation was not completed within timeout

    I use Eclipse 3.3 and WLS 10. If i deploy my EAR to the server after 5min i get the following error in plugin "com.bea.workshop.wls.core": "Deployment operation was not completed within timeout. State Type : running; Command Type : distribute; Action