[Flashcoders] New to the list - got a question
Hi All, I'm new to the list, so appologies if I don't get the posting right on this - but I have a question. I'm trying to load in a set of XML data, manipulate it and then get it to display on the stage. So far so good on the first two fronts - I can get the data in and get everything I want out of it. Now the amount of XML is dynamic, so I have pushed the needed data into an array. For example. XML: xml data item/item /data data item/item /data /xml The amount of data elements is dynamic (and there is a lot of other rubbish in the XML) so I've pushed all the data elements into an array. So far, so good, I can cycle through the array and access the XML elements using Xpath. The problem is - for each data element, I want to create a new instance of a MovieClip on the stage (thats already created in the library) and set varaibles inside it, and change it's X and Y positions. No problems creating it - but I can't access the MovieClip! Because the data is dymanic, I need to be able to create x amount of MovieClips. So I'm using the following code to do this: //For each Data Element in the Array (x = 0; x numDataElementsInArray; x++) { var newItemDividerName:String = itemDividerStageRecord +x; attachMovie(itemDivider, newItemDividerName ,x); //Now this all works, a newMovieClip is created on the stage (for as many elements as I have), 10 at the moment } Now the problem is - I then can't access the MovieClip dynamically. Basically I want to be able to access it by the variable name i've just assigned it. For example - I now have (when it is published), 10 elements on level0, named itemDividerStageRecord0-9. So I want to set their cords. So what i've been doing is: _root._level0.newItemDividerName._x = nextItemDivider; //nextItemDivider is a Number which does increment And thats not working at all - nothing is changing. I've traced it down to the name I'm using to access it - if in the same loop I put: _root._level0.itemDividerStageRecord6._x = nextItemDivider; That works for one MovieClip (obviously). But I want to be able to access each MovieClip dynamically. Is there any way to do this? I want to pass the instance name the varaible when setting the cord, not use the absolute element name newitemDividerName. Please let me know if this is confusing, I can explain better! Cheers. -Jon- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] New to the list - got a question
Use the Array operator liek this var x = 6; _root._level0.[itemDividerStageRecord+x]._x = nextItemDivider; hth -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jon Sent: Wednesday, August 02, 2006 2:45 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] New to the list - got a question Hi All, I'm new to the list, so appologies if I don't get the posting right on this - but I have a question. I'm trying to load in a set of XML data, manipulate it and then get it to display on the stage. So far so good on the first two fronts - I can get the data in and get everything I want out of it. Now the amount of XML is dynamic, so I have pushed the needed data into an array. For example. XML: xml data item/item /data data item/item /data /xml The amount of data elements is dynamic (and there is a lot of other rubbish in the XML) so I've pushed all the data elements into an array. So far, so good, I can cycle through the array and access the XML elements using Xpath. The problem is - for each data element, I want to create a new instance of a MovieClip on the stage (thats already created in the library) and set varaibles inside it, and change it's X and Y positions. No problems creating it - but I can't access the MovieClip! Because the data is dymanic, I need to be able to create x amount of MovieClips. So I'm using the following code to do this: //For each Data Element in the Array (x = 0; x numDataElementsInArray; x++) { var newItemDividerName:String = itemDividerStageRecord +x; attachMovie(itemDivider, newItemDividerName ,x); //Now this all works, a newMovieClip is created on the stage (for as many elements as I have), 10 at the moment } Now the problem is - I then can't access the MovieClip dynamically. Basically I want to be able to access it by the variable name i've just assigned it. For example - I now have (when it is published), 10 elements on level0, named itemDividerStageRecord0-9. So I want to set their cords. So what i've been doing is: _root._level0.newItemDividerName._x = nextItemDivider; //nextItemDivider is a Number which does increment And thats not working at all - nothing is changing. I've traced it down to the name I'm using to access it - if in the same loop I put: _root._level0.itemDividerStageRecord6._x = nextItemDivider; That works for one MovieClip (obviously). But I want to be able to access each MovieClip dynamically. Is there any way to do this? I want to pass the instance name the varaible when setting the cord, not use the absolute element name newitemDividerName. Please let me know if this is confusing, I can explain better! Cheers. -Jon- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] New to the list - got a question
_root._level0.[ _root._level0? Just _level0 should suffice. There's only 1 _level0. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of André Goliath Sent: Wednesday, August 02, 2006 8:50 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] New to the list - got a question Use the Array operator liek this var x = 6; _root._level0.[itemDividerStageRecord+x]._x = nextItemDivider; hth -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jon Sent: Wednesday, August 02, 2006 2:45 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] New to the list - got a question Hi All, I'm new to the list, so appologies if I don't get the posting right on this - but I have a question. I'm trying to load in a set of XML data, manipulate it and then get it to display on the stage. So far so good on the first two fronts - I can get the data in and get everything I want out of it. Now the amount of XML is dynamic, so I have pushed the needed data into an array. For example. XML: xml data item/item /data data item/item /data /xml The amount of data elements is dynamic (and there is a lot of other rubbish in the XML) so I've pushed all the data elements into an array. So far, so good, I can cycle through the array and access the XML elements using Xpath. The problem is - for each data element, I want to create a new instance of a MovieClip on the stage (thats already created in the library) and set varaibles inside it, and change it's X and Y positions. No problems creating it - but I can't access the MovieClip! Because the data is dymanic, I need to be able to create x amount of MovieClips. So I'm using the following code to do this: //For each Data Element in the Array (x = 0; x numDataElementsInArray; x++) { var newItemDividerName:String = itemDividerStageRecord +x; attachMovie(itemDivider, newItemDividerName ,x); //Now this all works, a newMovieClip is created on the stage (for as many elements as I have), 10 at the moment } Now the problem is - I then can't access the MovieClip dynamically. Basically I want to be able to access it by the variable name i've just assigned it. For example - I now have (when it is published), 10 elements on level0, named itemDividerStageRecord0-9. So I want to set their cords. So what i've been doing is: _root._level0.newItemDividerName._x = nextItemDivider; //nextItemDivider is a Number which does increment And thats not working at all - nothing is changing. I've traced it down to the name I'm using to access it - if in the same loop I put: _root._level0.itemDividerStageRecord6._x = nextItemDivider; That works for one MovieClip (obviously). But I want to be able to access each MovieClip dynamically. Is there any way to do this? I want to pass the instance name the varaible when setting the cord, not use the absolute element name newitemDividerName. Please let me know if this is confusing, I can explain better! Cheers. -Jon- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] New to the list - got a question
yeah, sorry, damn copypaste ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Wednesday, August 02, 2006 2:53 PM To: Flashcoders mailing list Subject: RE: [Flashcoders] New to the list - got a question _root._level0.[ _root._level0? Just _level0 should suffice. There's only 1 _level0. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of André Goliath Sent: Wednesday, August 02, 2006 8:50 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] New to the list - got a question Use the Array operator liek this var x = 6; _root._level0.[itemDividerStageRecord+x]._x = nextItemDivider; hth -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jon Sent: Wednesday, August 02, 2006 2:45 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] New to the list - got a question Hi All, I'm new to the list, so appologies if I don't get the posting right on this - but I have a question. I'm trying to load in a set of XML data, manipulate it and then get it to display on the stage. So far so good on the first two fronts - I can get the data in and get everything I want out of it. Now the amount of XML is dynamic, so I have pushed the needed data into an array. For example. XML: xml data item/item /data data item/item /data /xml The amount of data elements is dynamic (and there is a lot of other rubbish in the XML) so I've pushed all the data elements into an array. So far, so good, I can cycle through the array and access the XML elements using Xpath. The problem is - for each data element, I want to create a new instance of a MovieClip on the stage (thats already created in the library) and set varaibles inside it, and change it's X and Y positions. No problems creating it - but I can't access the MovieClip! Because the data is dymanic, I need to be able to create x amount of MovieClips. So I'm using the following code to do this: //For each Data Element in the Array (x = 0; x numDataElementsInArray; x++) { var newItemDividerName:String = itemDividerStageRecord +x; attachMovie(itemDivider, newItemDividerName ,x); //Now this all works, a newMovieClip is created on the stage (for as many elements as I have), 10 at the moment } Now the problem is - I then can't access the MovieClip dynamically. Basically I want to be able to access it by the variable name i've just assigned it. For example - I now have (when it is published), 10 elements on level0, named itemDividerStageRecord0-9. So I want to set their cords. So what i've been doing is: _root._level0.newItemDividerName._x = nextItemDivider; //nextItemDivider is a Number which does increment And thats not working at all - nothing is changing. I've traced it down to the name I'm using to access it - if in the same loop I put: _root._level0.itemDividerStageRecord6._x = nextItemDivider; That works for one MovieClip (obviously). But I want to be able to access each MovieClip dynamically. Is there any way to do this? I want to pass the instance name the varaible when setting the cord, not use the absolute element name newitemDividerName. Please let me know if this is confusing, I can explain better! Cheers. -Jon- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] New to the list - got a question 2
Cheers Jason, Unfortunately I have no control over the XML produced. The code you provided didn't work. _root._level0.[itemDividerStageRecord+x]._x = nextItemDivider; I get an error when compiling the actionscript now - Expected a field name after '.' operator. -Jon- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] New to the list - got a question
Why not use: var myMovie_mc:MovieClip = attachMovie(itemDivider, newItemDividerName ,x); Then you can set the properties by doing: myMovie_mc._x = nextItemDivider ; Giles P.S. Best to stick to one subject name for each question on the list because the list archive will then be able to tie the discussion together when searching -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jon Sent: 02 August 2006 13:45 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] New to the list - got a question Hi All, I'm new to the list, so appologies if I don't get the posting right on this - but I have a question. I'm trying to load in a set of XML data, manipulate it and then get it to display on the stage. So far so good on the first two fronts - I can get the data in and get everything I want out of it. Now the amount of XML is dynamic, so I have pushed the needed data into an array. For example. XML: xml data item/item /data data item/item /data /xml The amount of data elements is dynamic (and there is a lot of other rubbish in the XML) so I've pushed all the data elements into an array. So far, so good, I can cycle through the array and access the XML elements using Xpath. The problem is - for each data element, I want to create a new instance of a MovieClip on the stage (thats already created in the library) and set varaibles inside it, and change it's X and Y positions. No problems creating it - but I can't access the MovieClip! Because the data is dymanic, I need to be able to create x amount of MovieClips. So I'm using the following code to do this: //For each Data Element in the Array (x = 0; x numDataElementsInArray; x++) { var newItemDividerName:String = itemDividerStageRecord +x; attachMovie(itemDivider, newItemDividerName ,x); //Now this all works, a newMovieClip is created on the stage (for as many elements as I have), 10 at the moment } Now the problem is - I then can't access the MovieClip dynamically. Basically I want to be able to access it by the variable name i've just assigned it. For example - I now have (when it is published), 10 elements on level0, named itemDividerStageRecord0-9. So I want to set their cords. So what i've been doing is: _root._level0.newItemDividerName._x = nextItemDivider; //nextItemDivider is a Number which does increment And thats not working at all - nothing is changing. I've traced it down to the name I'm using to access it - if in the same loop I put: _root._level0.itemDividerStageRecord6._x = nextItemDivider; That works for one MovieClip (obviously). But I want to be able to access each MovieClip dynamically. Is there any way to do this? I want to pass the instance name the varaible when setting the cord, not use the absolute element name newitemDividerName. Please let me know if this is confusing, I can explain better! Cheers. -Jon- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] New to the list - got a question 2
Cheers Jason, Unfortunately I have no control over the XML produced. The code you provided didn't work. _root._level0.[itemDividerStageRecord+x]._x = nextItemDivider; Uh, I didn't provide that code. That was André. But it should work if you have: _level0.[itemDividerStageRecord+x]._x = nextItemDivider; Then nextItemDivder should be equal to: _level0.itemDividerStageRecord0._x _level0.itemDividerStageRecord1._x _level0.itemDividerStageRecord2._x _level0.itemDividerStageRecord3._x _level0.itemDividerStageRecord4._x etc. If you have your instances named as such and your loop is working. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Jon Sent: Wednesday, August 02, 2006 9:19 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] New to the list - got a question 2 Cheers Jason, Unfortunately I have no control over the XML produced. The code you provided didn't work. _root._level0.[itemDividerStageRecord+x]._x = nextItemDivider; I get an error when compiling the actionscript now - Expected a field name after '.' operator. -Jon- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] New to the list - got a question 2
try: _level0[itemDividerStageRecord+x]._x (note: removed '.' after _level0). HTH Adrian On 8/2/06, Jon [EMAIL PROTECTED] wrote: Cheers Jason, Unfortunately I have no control over the XML produced. The code you provided didn't work. _root._level0.[itemDividerStageRecord+x]._x = nextItemDivider; I get an error when compiling the actionscript now - Expected a field name after '.' operator. -Jon- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] New to the list - got a question 2
_level0[ (note: removed '.' after _level0). Oops - yeah, I meant that too! Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Adrian Park Sent: Wednesday, August 02, 2006 9:30 AM To: Flashcoders mailing list Subject: Re: [Flashcoders] New to the list - got a question 2 try: _level0[itemDividerStageRecord+x]._x (note: removed '.' after _level0). HTH Adrian On 8/2/06, Jon [EMAIL PROTECTED] wrote: Cheers Jason, Unfortunately I have no control over the XML produced. The code you provided didn't work. _root._level0.[itemDividerStageRecord+x]._x = nextItemDivider; I get an error when compiling the actionscript now - Expected a field name after '.' operator. -Jon- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com