A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: loadmovie on variable targets?

  1. #1
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472

    loadmovie on variable targets?

    Hi Guys,

    I'm using the following code to load a variable target into a variable movieclip.

    targetClip = "center"
    targetSWF = "myimage.jpg"
    _root[targetClip].loadMovie(targetSWF);

    This works fine but I want to be able to load into childs of
    movieClips like this

    targetClip = "center.image"
    targetSWF = "myimage.jpg"
    _root[targetClip].loadMovie(targetSWF);

    however that doesn't work!
    Any good ideas for a solution?
    //poden

  2. #2
    Resident Shostakovich Scholar
    Join Date
    May 2003
    Location
    Nottingham, UK.
    Posts
    299
    This might work- I think it's just a question of collective synatx when all the expressions are put together:

    path = eval("_root." + targetClip + "." + image);
    //I assume 'image' is another var?
    loadMovie(targetSWF, path);

    ..the point being that evaluating all the expressions into one, compact var, might help the targeting. Just a thought.

  3. #3
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    ... that doesn't do the trick.

    As far as I known the [] i used for concatenating strings/variables instead of using eval.

    'Image' is a child clip to 'center'.

    The problem is that I can't refer to child clips based on a variable.

    targetClip = "center" // this works
    targetClip = "center.image" // this doesn't work

    //poden

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    targetClip = "center"
    childClip = "image"
    targetSWF = "myimage.jpg"
    _root[targetClip][childClip].loadMovie(targetSWF);

    have you tried that?

    gparis
    Last edited by gparis; 09-01-2003 at 12:05 PM.

  5. #5
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    Hi G,

    well ... that should work!

    The path to differnet clips is called defined from a VB application. So for architectural reasons I'd prefer if the path could be defined as 'simple' as absolutely possible.

    I imagine that I perhaps could split the targetpath with "." as delimiter and then concatenate the path ... hmmm might work

    thanks for the input
    //poden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center