A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: dragging a movie loaded with loadMovie

  1. #1

    dragging a movie loaded with loadMovie

    Hi
    I've got a button in my main timeline that loads a movie over the main one like a pop-up in html. What i'd like to do is to make it draggable, but i don't know how - or where i have to put the code (in the loaded movie or in the main movie but referring to the loaded movie) ...
    Could you help ?
    thank you :-))

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Does the movie load into a level or a movie clip?

    If you use a movie clip to hold the loaded move probably the easiest thing to do is something like this (in the movie that does the loading),

    code:

    // define press and release event handlers for the movie clip myClip, which will contain the loaded movie
    myClip.onPress = function() {
    this.startDrag(true);
    };
    myClip.onRelease = function() {
    this.stopDrag();
    };
    myClip.createEmptyMovieClip("holder", 1); // create an empty clip inside myClip to load the movie into (loading directly into myClip would delete the event handlers)
    myClip.holder.loadMovie("filename.swf"); // load the movie



    if you load into a level, maybe you could use similar code on the main timeline (of the movie that gets loaded) like this,

    code:

    _root.onMouseDown = function() {
    _root.startDrag(true); // drag the main timeline of the movie
    };
    _root.onMouseUp = function() {
    _root.stopDrag();
    };


  3. #3

    that's excellent!

    I'm using levels so i'll go for the second option.
    thank you very much
    Bob

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