Skip to main content
August 9, 2007
Question

losing movie clip

  • August 9, 2007
  • 6 replies
  • 545 views
You are supposed to be able to drag an object from the side bar and it duplicates on the main screen.

There are two problems first the movie clip only persists one at a time and second the newly created clip doesn't release when the mouse button is released the first time.
This topic has been closed for replies.

6 replies

clbeech
Inspiring
August 10, 2007
right on Vee, also jwize to further simplify you could assign the XY properties in the attachMovie method by passing an Object.

var newClip = attachMovie("TableSquare", "TableSquare"+objectCounter, objectCounter, {_x:currentX, _y:currentY});

But in a function on the main timeline like Vee suggests.
Inspiring
August 10, 2007
Simplifying this script sounds like a good start. Pass to a func. on the timeline:

dupThisClip, currentX, currentY

and I like the what was just mentioned about the depth assignment.
clbeech
Inspiring
August 10, 2007
I agree with you Rothrock, it says right in the documentation that calls to getNextHighestDepth() can cause problems, particularly when using v2 Components, and with the use of _root in the event of loaded swf files.

I like to use '_level0' , instead of _root, and is absolute relative to the swf.
Also since jwize is already tracking the clips by number with 'objectCounter' it could be used as the depth assignment.

I'm thinking that the duplication of the on handlers might be the cuase of the release issue, maybe a moving the newClip's handlers to it's timeframe would solve this? or removing the 'outside' on(release) to stopDrag() (you're right there V) because the second 'set' of them are taking control of the newClip?
Inspiring
August 10, 2007
My guess is that you have a scope problem.

You haven't specified where you want getNextHighestDepth() to get the next highest depth from. So consequently it is getting it from the clip you have attached this code to.

But since you aren't attaching the clip to the same clip that this code is called from each time it is getting the same depth and attaching the new clip at the same depth – which replaces any clip that exists at that depth.

Personally I am totally opposed to getNextHighestDepth() and the use of _root, but here is most likely the answer. (I can't believe I'm typing these words! Please don't tell anybody!)

_root.getNextHighestDepth()

Inspiring
August 9, 2007
am not clear on what you mean when you state, "the movie clip only persists one at a time;" if you want more than one, set an interval with params.
Inspiring
August 9, 2007
check me on this but isnt stopdrag(); supposed to be stopDrag();?