A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Loading/Unloading

Threaded View

  1. #4
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    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 04:57 PM.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

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