hi all - after working on this for the better part of today i’ve decided to ask for some assistance!
i have a draggable movieclip (let’s call it the Dragger) that’s loaded into my main movie via a regular mouse event (let’s call it a button named LOAD). it needs to be hidden by default (i have “hidden” and “visible” frame labels inside the Dragger that take care of this). i also need to have another movieclip inside of the Dragger that acts as a closebutton (it will tell the Dragger to hide itself). it has to be inside the Dragger so it will stay in the right position - putting the close button outside of the Dragger isn’t an option. simply attaching a regular mouse event like…
<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
on(release) {
_root.dragger.gotoAndPlay(“hidden”);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
…to the closebutton doesn’t work… the closebutton doesn’t even seem to know the mouse is being clicked because it’s inside of another movieclip. so i wrote a custom function that goes like this and dropped it onto the first frame of “hidden” and “visible” inside the Dragger (both labels got the code, just to be safe)…
<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
closebutton.onRelease = function (){
_root.container.goToAndStop(“hidden”);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
…that code magically hides the Dragger like i want and seems to circumvent the problem of the nested MCs. but the problem lies in the fact that the Dragger must be… draggable. so i added the following script onto the Dragger (when it’s on the stage, stopped at the “hidden” label - i put the code on the little tiny crosshair that represents the instance). this makes the Dragger move like i want it to… but kills the closebutton, no matter if i use a custom function to do it or a regular mouse event:
<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
onClipEvent (load) {
left = _x+1;
top = _y+110;
right = _x+1;
bottom = _y-112;
}
on (press) {
startDrag("", false, left, top, right, bottom);
}
on (release, releaseOutside, rollOut, keyPress “<Escape>”) {
stopDrag();
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
so to put it together, i added that code to a MC that’s actually inside the Dragger (after adding “_root.dragger” before start/stopdrag). so i can now drag the Dragger and use the closebutton. but there’s one problem. i click the LOAD button and the Dragger shows up in the right position. but when i click the Dragger to drag it around, it jumps to the upper left corner (0,0) of the stage. it seems like it forgets where its center point is and moves the center point to 0,0. i can sort of play with the top/left/bottom/right etc and get it constrained in one direction, but there’s no way that i can see to position it in the same place.
i think my problem is with the syntax of Actionscript and not knowing how to come up with a hack that forces the Dragger to stay put… or hopefully someone can suggest a more elegant way. ideally i’d like to have the Dragger constrained so that it can only move up and down, not going above or below the edge of the main movie. i will eventually be loading dynamic text and a dynamic JPG into the Dragger, but for now, i just need it to have a closebutton inside that will make the Dragger go to its “hidden” frame label.
i’m attaching a sample FLA (i’d upload my real movie but i’m under a NDA for this project) - i’m betting that someone will be able to just change a few numbers or add a line or two and this thing will be working… thanks in advance…