Loading/Unloading
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Loading/Unloading

  1. #1
    Is the best Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    367

    Loading/Unloading

    Hi, so in my game I got frame rate to smoothen out more using some techniques. Problem is it wont help forever because I am planning on making the world huge so im trying to think of a good way to hide/unhide tiles.

    So far I tried alphaing out tiles that are not seen by the vcam that went horrible and turned out really laggy.

    Than I tried making the vcam act as a giant hit test to my tiles making them go to a blank keyframe when not in use. That didn't really help.

    I found how ever that like above ^ making tiles go to empty keyframes helps ALOT, but having the constant hit test uses alot of resources.

    So please I cant go to much into code because its complicated, maybe ill have too but I need some ideas from you guys. Thanks.


    if nothing works I am considering having a "room like design" example: I walk to the edge of the map I am now in the next map while the other one is gone etc. I don't think splitting maps though is a good user experience because in reality having a big map you can walk around in feels way better "I think".

    Living in the E-Age

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    936
    I don't understand really well what you are trying to do, or what you really need, but reading your thread I suppose that's fixed removing the tiles movieclip when no using them, and attaching them when using them. attachMovie/removeMovieClip is the only option. Or you can have the tiles as an external .swf and loadMovie/unLoadMovie.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  3. #3
    Is the best Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    367
    but will they remove and re attach in the same position as they were removed in?

    Living in the E-Age

  4. #4
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    936
    Yeah, because you specify the last _x _y coordinates with a variable.
    PHP Code:
    //create
    function create(){
    _root.attachMovie("bookMC""bookMC"_root.getNextHighestDepth());
    bookMC._x=lastX
    bookMC
    ._ylastY
    bookMC
    .onPress=function(){
        
        
    startDrag(thisfalse);

        
    trace(bookMC._x);
        
    trace(bookMC._y);

        
    }
    bookMC.onRelease=function(){
        
    this.stopDrag();
            
    lastX=bookMC._x
    lastY
    =bookMC._y
    }
    }

    //remove
    function remove(){
        
    bookMC.removeMovieClip();
    }

    //secondary buttons
    buu.onPress=function(){
        
    remove();
        
    }

    buu2.onPress=function(){
        
    create();

    In that example i made for you, there is 2 buttons, one creates a movieclip and the other removes it. When creating it, i tell flash that the _x and _y coordinates of my movieclip is equal to lastX and lastY.

    Then, on my movieclip press it start Dragging it. When release, it stop dragging it and tell flash that lastX is equal to my movieclip's last _x and lastY is equal to my movieclip's last _y. So , i press the button for removing it, and when pressing the other button to re-attach it, TADA! My movieclip appears exactly where I left it!
    Last edited by angelhdz; 12-11-2012 at 03:57 PM.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  5. #5
    Is the best Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    367

    Cool

    Thanks dude! you are a boss.

    Living in the E-Age

  6. #6
    Is the best Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    367
    For some reason its only outputting the books location but not really creating or destroying the book. Idk hmm

    Living in the E-Age

  7. #7
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    936
    the function remove(){ bookMC.removeMovieClip();} MUST destroy the movieclip.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  8. #8
    Is the best Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    367
    They aren't destroying it or creating it im positive I did it correctly, did you try using it?

    Living in the E-Age

  9. #9
    Is the best Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    367
    I got it working, thanks angel you the man

    Living in the E-Age

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

Poll by Flashkit.com