#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    France
    Posts
    196
    Rep Power
    14

    multiple rows from DB to php to flash Again!


    Hi,

    I'm referring to a previous post but want some more input and I'm not sure how to follow up on an older post dealing with this issue.

    multiple rows from DB to php to flash

    The essence of this is creating variables in php and then reading the variables into Flash and creating duplicate movies for each loop. Problem being in the example of the quoted post we get a syntax error.

    x=1;

    position=0;

    while(x<=numberRows){

    duplicateMovieClip( "movieClip", "post" + x, x);

    setProperty("post" + x, _y, position);

    this["post" + x].flashVarTitle = _root.["varTitle" + x];

    position = position + 64;

    x++;

    }



    Can anyone explain the Flash ActionScript of this line:

    this["post" + x].flashVarTitle = _root.["varTitle" + x];



    Error message when we run this line in Flash 5 or MX

    Symbol=text, Layer=actions, Frame=10: Line 17: Expected a field name after '.' operator.

    this["post" + x].flashVarTitle = _root.["varTitle" + x];


    However if we remove the _root from ["varTitle" + x]; then the script runs. See below.

    this["post" + x].flashVarTitle = ["varTitle" + x];


    However this means that if we want to embed the script in a movieClip we need to put _root or _parent etc back in front of the ["varTitle" + x]; when it will fail again.

    Can anyone help?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    14
    Code:
    this["post" + x].flashVarTitle = _root.["varTitle" + x];
    Just needs the dot taken out after _root

    Code:
    this["post" + x].flashVarTitle = _root["varTitle" + x];
    Notice how this[ is different from _root.[


    When refrencing a member of the _root object you just need the brackets and not the dot syntax.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    France
    Posts
    196
    Rep Power
    14

    Thanks


    Thanks a lot

    Bob

IMN logo majestic logo threadwatch logo seochat tools logo