flash: local to global?
- Started
- Last post
- 5 Responses
- Jman
i have a script based on proximity of mouse to a movie clip inside a movie clip. But I need the position of the child clip to be relative to the stage, not the parent clip. As it is, flash thinks the clip is at 0,0....Can anyone help me? does this make sense?
- unfittoprint0
_root._xmouse && mc._x
_root._ymouse && mc._y
- Jman0
thanks Unfit....I knew you'd come thru for me, but I a;so figured you'd be a little over my head, which you always are....could you elaborate a little? Here is my script...
onClipEvent (enterFrame) {
deltaX = math.round(_root._xmouse-this._x...
deltaY = math.round(_root._ymouse-this._y...
diff = Math.round(Math.sqrt((deltaX*del...
if (diff>95) {
diff = 95;
}
// change alpha
_root.cover._alpha = (100-diff);
// change scale
_root.cover._xscale = (100-diff);
_root.cover._yscale = (100-diff);
}I have this code on a clip inside a clip....so it is referrencing the x and y in relation to the parent clip, but i need it to be in relation to the stage.....any more help is greatly appreciated
- function820
check out the localtoGlobal command
try this
globalPos = new Object()
globalPos.x = 0
globalPos.y = 0this.localToGlobal(globalPos)
then in your script instead of using this._x use, globalPos.x (dont use _x , just x)
the command needs to go in the movieclip onRelease or a prototype function to work
- Jman0
function82, you ROCK!! that is exactly what I was looking for....worked like a charm!
Thanks alot!
- function820
np :)