View Full Version : overwritting on release (quick question)
substance
08-21-2006, 12:07 PM
I have a movieclip ('1_mc') that is draggable and inside '1_mc' I have another mc ('2_mc').
I want 2_mc to make 1_mc invisible using:on (release) {
this._parent._visible = false;
}
This doesnt work. I think what is happening is the 'on (release)' function I have for '1_mc' (to make it draggable) is overwritting 2_mc's 'on (release)' function.
So my question is, how do i get both of them to work? (and yes, 2_mc needs to be inside 1_mc)
snapple
08-21-2006, 12:32 PM
The visibility of a parent clip will effect is child clips - and visibility doesn't just effect the visibility - it actually disables them too, and would disable any event handlers.
mooska
08-21-2006, 12:32 PM
mc1.onRelease = function(){
if(this.mc2.hitTest(this._xmouse, this._ymouse, true)){
trace("mc2 release");
}
//mc1 dragable code
}
substance
08-21-2006, 12:41 PM
hmm, like :
this.onRelease = function(){
if(this.close.hitTest(this._xmouse, this._ymouse, true)){
this._visible = false;
}
}
this.onPress = function() {
this.startDrag();
};
this.onRelease = function() {
this.stopDrag();
}
Where 'player' is mc1 and 'close' is mc2. Hmm, this wont work.
substance
08-21-2006, 12:49 PM
The visibility of a parent clip will effect is child clips - and visibility doesn't just effect the visibility - it actually disables them too, and would disable any event handlers.
I think you misunderstood, the movieclip will be visible untill the 'close' button is pressed at which point it will become invisible and there's no need for a 'close' button.
mooska
08-21-2006, 12:51 PM
Like thisclip.onPress = function() {
this.startDrag();
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
//
if (this.close.hitTest(_root._xmouse, _root._ymouse, true)) {
this._parent._visible = false;
}
};
names are instance names in property panel
substance
08-21-2006, 01:04 PM
Like thisclip.onPress = function() {
this.startDrag();
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
//
if (this.close.hitTest(_root._xmouse, _root._ymouse, true)) {
this._parent._visible = false;
}
};
names are instance names in property panel
Ok, well this works... but is there any way to make a MC draggable while keeping other buttons in tact? The thing is, the movieclip that is draggable has a bunch of other buttons and interactivity on it and when you make it draggable all of a sudden any button on that movieclip doesnt work. Is there a way around this?
I guess I could make only a certain section of the MC draggable... but then how would 'attach' the rest of the MC to move with the draggable part?
Sorry if i'm not making sense... I'm trying to figure out the logic and solve the problem at the same time.
mooska
08-21-2006, 01:33 PM
post your fla, cause its hard to tell what youre trying to do.
If its has many different mcs that need to have onPress etc event within it, then try to use onMouseDown and hittest part on that mc, and onRelease on mcs inside of it.
substance
08-21-2006, 01:39 PM
okay, I think I got it. I made a 'dragbar' that will move the whole MC.
this.dragBar.onPress = function() {
this._parent.startDrag();
};
this.dragBar.onRelease = function() {
this._parent.stopDrag();
};
this.close.onRelease = function() {
this._parent._visible = false;
};
Seems to work....
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.