263 posts
  • 7 Years of Membership
  • Antarctica
  • Author Level 2
  • Collector Level 1
+2 more
x360c
says

Okay, here is my code:

    var forums01_cats_list:Array=new Array ();
    forums01_cats_list=forums01_items.split ('<sepvar3>');
    var forums01_catHolder:Array=new Array ();
    for (var forums01_catNum:int=0;forums01_catNum<(forums01_cats_list.length-1);forums01_catNum++) {
        forums01_catHolder[forums01_catNum]=new MovieClip ();
        forums01_forumHolder.addChild (forums01_catHolder[forums01_catNum]);
        forums01_cats_list.forum_list=new Array ();
        forums01_cats_list.forum_list=forums01_cats_list[forums01_catNum].split ('<sepvar2>');
        for (var forums01_forumNum:int=2;forums01_forumNum<(forums01_cats_list.forum_list.length-1);forums01_forumNum++) {
            forums01_cats_list.forum_list[forums01_forumNum].forums=new Array ();
            forums01_cats_list.forum_list[forums01_forumNum].forums=String (forums01_cats_list.forum_list[forums01_forumNum]).split ('<sepvar>');
        }        
    }
</sepvar></sepvar2></sepvar3>

And then I get this error:

ReferenceError: Error #1056: Cannot create property forums on String.
    at index_fla::MainTimeline/forums01_loadComplete()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

Anybody know why I’m getting this error? I’ve tried everything and it’s really pissing me off.

8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says

Use the debugger so you can pinpoint which line is giving you the trouble..

Click to the left of the line number for the line:

var forums01_cats_list:Array=new Array ();

so that there is a red dot, then compile to the debugger using CTRL SHIFT ENTER …

Step through line by line using ALT F6 I think and see where it breaks…

1281 posts
  • 7 Years of Membership
  • Affiliate Level 4
  • Author Level 6
  • Blog Interview
+8 more
rondog
says

I cant tell from your code since it wont compile anyway, but Ide say go to your publish settings and turn debugging on and it will tell you exactly what line is giving you the error.

8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says

beat you to it rondog :p

263 posts
  • 7 Years of Membership
  • Antarctica
  • Author Level 2
  • Collector Level 1
+2 more
x360c
says
It’s this line with the error above:
forums01_cats_list.forum_list[forums01_forumNum].forums=new Array ();
8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says

Well reading the error suggests you are trying to create an array from a string…

what are you accessing via that path… what does it return… a String?

Without knowing what the datatypes of your variables etc and what your trying to do its a bit tricky but it looks like

forums01_cats_list.forum_list[forums01_forumNum]

returns a String, which you cannot create an array as an attribute…

Hope this helps :)

263 posts
  • 7 Years of Membership
  • Antarctica
  • Author Level 2
  • Collector Level 1
+2 more
x360c
says

How can I turn it into an array?

107 posts
  • 7 Years of Membership
  • Author Level 2
the_asman
says

ok here is your problem
forums01_cats_list.forum_list[forums01_forumNum].forums=new Array ()
lets redefine this for explain it easier
a[i].forums = new Array ( )

simple right
now the next line
forums01_cats_list.forum_list[forums01_forumNum].forums=String (forums01_cats_list.forum_list[forums01_forumNum]).split ( ‘ ’ )
lets redefine this one for ease of explaining
a[i].forums = String ( ‘some string here’ )

still simple
however if you notice you just retyped an array to string which is a big no no in AS
you would need something like
a[i].forums[ 0 ] = String ( ‘some string here’ )
a[i].forums[ 1 ] = String ( ‘some string here’ )

since .forums was type cast as an array you have to treat it as an array

a few things you need to focus on
your variable names make it very difficult to understand your code and you should work on making them smaller
a rule of thumb for a for loop counting variable is to use I
that is the industry standard



one last comment i notice before hitting post is the “String” statement if you take that out that will remove you converting the split array into a string

263 posts
  • 7 Years of Membership
  • Antarctica
  • Author Level 2
  • Collector Level 1
+2 more
x360c
says

Thanks Asman :D

107 posts
  • 7 Years of Membership
  • Author Level 2
the_asman
says

anytime

i take it you got it working?

by
by
by
by
by
by