|
Home > Archive > Macromedia Flash Server > May 2005 > Populate List Component from Array
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Populate List Component from Array
|
|
| Brandon_Krakowsky-A5pIpylr7pFSljaRc5+PrA@publi 2005-05-17, 5:45 pm |
| I'm trying to populate an instance of the List component from a button,
but I can't seem to pass the array name in a variable. It can't find the
specific array.
function loadGivenPres(index){
toc.removeAll();
var arr = String(index);
for (j=0; j<=maxSldNum; j++) {
var title = arr[j][2];
toc.addItem(title);
}
}
Then something like this:
loadGivenPres("list1");
Thanks,
Brandon
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| hank williams 2005-05-17, 5:45 pm |
| I am not exactly sure what you are trying to do here, but in
Actionscript, a string is not an array. So you cant apply [] to a
string as you have here. In your code arr is a string and index is a
string. There are no arrays anywhere.
In any case, there is not enough context to know how to tell you what
you actually should be doing, because I dont really understand your
code. For example, what you seem to be assuming that arr is an array
of arrays or a two dimensional array. "arr[j][2]". What is the [2]
suposed to be for?
If you have an actual array that you are passing into loadGivenPres,
then you should pass the actual variable reference into the function
without the quotes around it. list1 vs "list1".
Hope this helps
Regards
Hank
On 5/17/05, Brandon_Krakowsky-f4Rxxx7sm6VSljaRc5+PrA@public.gmane.org
<Brandon_Krakowsky-f4Rxxx7sm6VSljaRc5+PrA@public.gmane.org> wrote:
> I'm trying to populate an instance of the List component from a button,
> but I can't seem to pass the array name in a variable. It can't find the
> specific array.
>=20
> function loadGivenPres(index){
> toc.removeAll();
> var arr =3D String(index);
> for (j=3D0; j<=3DmaxSldNum; j++) {
> var title =3D arr[j][2];
> toc.addItem(title);
> }
> }
>=20
> Then something like this:
>=20
> loadGivenPres("list1");
>=20
> Thanks,
> Brandon
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| daz lee 2005-05-17, 5:45 pm |
| flash isnt quite that strict yet with data types, we don't have to =
define structures fully, we don't have to make arrays specific data =
types only. we can have undefined values lol
here is a nice little reference for developers from other languages:
http://livedocs.macromedia.com/flas..._Remoting_MX/U=
seASData4.htm<http://livedocs.macromedia.com/flas...mx/Using_Flash=
_Remoting_MX/UseASData4.htm>
----- Original Message -----=20
From: hank williams<mailto:hank777-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>=20
To: FlashComm Mailing List<mailto:flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>=20
Sent: Tuesday, May 17, 2005 7:11 PM
Subject: Re: [FlashComm] Populate List Component from Array
I am not exactly sure what you are trying to do here, but in
Actionscript, a string is not an array. So you cant apply [] to a
string as you have here. In your code arr is a string and index is a
string. There are no arrays anywhere.
In any case, there is not enough context to know how to tell you what
you actually should be doing, because I dont really understand your
code. For example, what you seem to be assuming that arr is an array
of arrays or a two dimensional array. "arr[j][2]". What is the [2]
suposed to be for?
If you have an actual array that you are passing into loadGivenPres,
then you should pass the actual variable reference into the function
without the quotes around it. list1 vs "list1".
Hope this helps
Regards
Hank
On 5/17/05, =
Brandon_Krakowsky-f4Rxxx7sm6VSljaRc5+PrA@public.gmane.org<mailto:Brandon_Krakowsky@maxwelltrain.=
com>
=
<Brandon_Krakowsky-f4Rxxx7sm6VSljaRc5+PrA@public.gmane.org<mailto:Brandon_Krakowsky@maxwelltrain=
com>> wrote:
> I'm trying to populate an instance of the List component from a =
button,
> but I can't seem to pass the array name in a variable. It can't =
find the
> specific array.
>=20
> function loadGivenPres(index){
> toc.removeAll();
> var arr =3D String(index);
> for (j=3D0; j<=3DmaxSldNum; j++) {
> var title =3D arr[j][2];
> toc.addItem(title);
> }
> }
>=20
> Then something like this:
>=20
> loadGivenPres("list1");
>=20
> Thanks,
> Brandon
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - =
http://www.figleaf.com<http://www.figleaf.com/>
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> =
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm<http://chattyfig.=
figleaf.com/mailman/listinfo/flashcomm>
>
=3D---------------------------------------------------------
Supported by Fig Leaf Software - =
http://www.figleaf.com<http://www.figleaf.com/>
=3D---------------------------------------------------------
To change your subscription options or search the archive:
=
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm<http://chattyfig.=
figleaf.com/mailman/listinfo/flashcomm>
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Brandon_Krakowsky-A5pIpylr7pFSljaRc5+PrA@publi 2005-05-17, 5:45 pm |
| Sorry, should have specified. Just want to pass an array name, not the
contents of the array. I have like 3 arrays defined in the following way:
list1 = [
["slides1/Slide1.swf","audio1/Slide001.swf","1. title"],
["slides1/Slide2.swf","audio1/Slide002.swf","2. title"],
["slides1/Slide3.swf","audio1/Slide003.swf","3. title"]];
list2 = [
["slides2/Slide1.swf","audio2/Slide001.swf","1. title"],
["slides2/Slide2.swf","audio2/Slide002.swf","2. title"],
["slides2/Slide3.swf","audio2/Slide003.swf","3. title"]];
list3 = [
["slides3/Slide1.swf","audio3/Slide001.swf","1. title"],
["slides3/Slide2.swf","audio3/Slide002.swf","2. title"],
["slides3/Slide3.swf","audio3/Slide003.swf","3. title"]];
loadGivenPres("list1") would basically populate an instance of the List
component with the items in the "list1" array.
Here it is simplified:
function loadGivenPres(arrayName){
listInstance.removeAll();
for (j=0; j<=maxSldNum; j++) {
var title = arrayName[j][2];
listInstance.addItem(title);
}
}
Thanks again,
Brandon
hank williams <hank777-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Sent by: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
05/17/2005 02:11 PM
Please respond to
hank williams <hank777-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>; Please respond to
FlashComm Mailing List <flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
To
FlashComm Mailing List <flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
cc
Subject
Re: [FlashComm] Populate List Component from Array
I am not exactly sure what you are trying to do here, but in
Actionscript, a string is not an array. So you cant apply [] to a
string as you have here. In your code arr is a string and index is a
string. There are no arrays anywhere.
In any case, there is not enough context to know how to tell you what
you actually should be doing, because I dont really understand your
code. For example, what you seem to be assuming that arr is an array
of arrays or a two dimensional array. "arr[j][2]". What is the [2]
suposed to be for?
If you have an actual array that you are passing into loadGivenPres,
then you should pass the actual variable reference into the function
without the quotes around it. list1 vs "list1".
Hope this helps
Regards
Hank
On 5/17/05, Brandon_Krakowsky-f4Rxxx7sm6VSljaRc5+PrA@public.gmane.org
<Brandon_Krakowsky-f4Rxxx7sm6VSljaRc5+PrA@public.gmane.org> wrote:
> I'm trying to populate an instance of the List component from a button,
> but I can't seem to pass the array name in a variable. It can't find
the
> specific array.
>
> function loadGivenPres(index){
> toc.removeAll();
> var arr = String(index);
> for (j=0; j<=maxSldNum; j++) {
> var title = arr[j][2];
> toc.addItem(title);
> }
> }
>
> Then something like this:
>
> loadGivenPres("list1");
>
> Thanks,
> Brandon
>
> =-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
|
|
|
|
|