A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Attaching movie clips over movie clips...

  1. #1
    Junior Member
    Join Date
    Nov 2007
    Posts
    11

    Attaching movie clips over movie clips...

    The swf is supposed to be some sort of image gallery with 2 levels. Here is the image illustration of the movie structure (I would upload the fla but its too big for the site)



    Everything works just the way I want it too. After about 20 seconds of constant clicking and loading new movie clips the load to the root gets really sluggish.

    I am pretty sure the problem is all of the movie clips are loading over top of one another so after time it gets to crowded. I am not sure how to fix it though.

    My code to get to the first level movie clips looks like this:

    PHP Code:
    on (release) {
        
    _root.attachMovie ("image 4 att""newatt"_root.getNextHighestDepth(), {_x:302.7_y:209.6});


    My code to get to the next movie clip on that level looks like this:

    PHP Code:
    on (release) {
        
    _root.attachMovie ("image 5 att""newatt"_parent.getNextHighestDepth(), {_x:302.7_y:209.6});


    My code to get back to the main level looks like this:

    PHP Code:
    on (release) {
        
    _root.attachMovie ("mainMovie2""newatt",  _root.getNextHighestDepth(), {_x:302.7_y:209.6});



  2. #2
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    you probably should have a script that removes the old movieClip as you load the new MC. Something like: create a variable on your root timeline called:
    var activeMovieClip:MovieClip;

    And on your buttons do something like:
    PHP Code:
    on (release) {
       
    _root.attachMovie("linkageID""instance_name"_root.getNextHighestDepth());
       
    _root.activeMovieClip.removeMovieClip();
       
    _root.activeMovieClip instance_name;

    This way the movieClips that aren't visible are unloaded and don't take up space. That should speed it up too.
    moo

  3. #3
    Junior Member
    Join Date
    Nov 2007
    Posts
    11
    Quote Originally Posted by caroach
    you probably should have a script that removes the old movieClip as you load the new MC. Something like: create a variable on your root timeline called:
    var activeMovieClip:MovieClip;

    And on your buttons do something like:
    PHP Code:
    on (release) {
       
    _root.attachMovie("linkageID""instance_name"_root.getNextHighestDepth());
       
    _root.activeMovieClip.removeMovieClip();
       
    _root.activeMovieClip instance_name;

    This way the movieClips that aren't visible are unloaded and don't take up space. That should speed it up too.
    Thanks for the help, I am still having alot of trouble though. I declared the variable in my root and added that script to the button to get across movie clips and the button to get back to the root and it didn't work.

    Are there any tutorials I can follow?

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