A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [CS3][AS2] duplicateMovieClip of dynamicClip?

  1. #1
    [Horse Thief] gotoAndCrash's Avatar
    Join Date
    May 2007
    Location
    NW, USA
    Posts
    576

    [CS3][AS2] duplicateMovieClip of dynamicClip?

    I'm trying to make a tiled background. I have the tiles saved as images, & am importing them via XML & dumping them into a Movie Clip. But when I try to duplicate that Movie Clip it doesn't show up. I set it's _xscale to 500, traced it's _xscale, _x, _y, _alpha, _visible, all showed up fine - I even tweened it from 0, to bottom right corner - can't see it?!?!!?

    Is there something about not being able to duplicate dynamically-generated clips? Though, I could trace it's parameters just fine....wth??

    I made a test file, drew a box, converted to Clip, told it to duplicate itself onPress, worked fine...

    Any thoughts?
    1 Infinite Loop, Cupertino is a portal of Hell.

  2. #2
    Junior Member
    Join Date
    Sep 2008
    Posts
    2
    This sounds like an interesting problem and I would have to experiment with this. But to answer your question, it is not necessary for you to use duplicateMovieClip at all if you are able to attach your clip dynamically from the library. Just use attachMovie to attach all the clips dynamically that you need and don't worry about attaching one and then duplicating it.

    edit: Actually it seems like I misunderstood your problem. The reason why it is not working for you is because you CANNOT duplicated loaded swfs or images. You must load it each time you want to use it again. What I would suggest though is having a clip in your library that has all the tiles in it and inside your xml specifying the name of the tile inside that clip. Then when you load your map you attach the clip dynamically and use the tile names inside the xml to make it display the appropriate tile graphic.

    I want to further elaborate on what you are doing as well, because I've written tile-based engines before. Don't use xml, it's overkill for this sort of application. One it's too costly to parse, two the amount of overhead in terms of metadata is too great. Use a simple comma separated file format instead and use String.split function. Very simple.
    Last edited by KirillM; 09-07-2008 at 02:07 PM.

  3. #3
    [Horse Thief] gotoAndCrash's Avatar
    Join Date
    May 2007
    Location
    NW, USA
    Posts
    576
    Well, I was thinking about it last night, & I think what I'm going to do is import my tile into Flash, make it a Movie Clip, set it's Linkage, & just For Loop Attach them onto the Stage. Which would work fine - the reason I was wanting to do it as stated above was just to try something new, & when it seemed like it wouldn't work I wondered "WHY NOT?!?!?" - I was also thinking in terms of IF (though I probably won't, but just for proof-of-concept) I ever wanted to update the tile I could just change the image without having to touch the Flash.

    This project is a website, so all of the data is already being fed in via XML, & I just wanted to add an attribute to the first node dictating the path to the tile. The first one comes in fine (creating an Empty Movie Clip & Loading the image into it), but I wasn't able to duplicate that Movie Clip...which I thought was kinda dumb!
    1 Infinite Loop, Cupertino is a portal of Hell.

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