Attn: AS experts
- Started
- Last post
- 15 Responses
- snizl
I was wondering if there was a way to trigger a loadMovie command after a movieclip reaches to a certain _y value. Any help appreciated. Thanks.
- nuggler0
if (movieclip >= yvalue){
loadMovie(whichmovie where);
}
- Milan0
dont forget ._y
if (movieclip._y >= yvalue){
loadMovie(whichmovie where);
}
- snizl0
That makes sense. I should've know it would be that easy.
- snizl0
Now what would I do to keep checking for the target _y value?
- tGP0
// if you want a movie loaded when _y of 300 is reached
var targetY = 300;// create a blank movieclip that will loop constantly, thus constantly checking the value of our conditional
_root.createEmptyMovieClip("hold... 100);
_root.holder_mx.onEnterFrame = function () {
// here i am using == to see if the _y value is exactly the same as the target, you could substiture this with >= or
- tGP0
post got cut off, here goes again...
// if you want a movie loaded when _y of 300 is reached...
var targetY = 300;// create a blank movieclip that will loop constantly, thus constantly checking the value of our conditional...
_root.createEmptyMovieClip("hold... 100);
_root.holder_mc.onEnterFrame = function () {
// here i am using == to see if the _y value is exactly the same as the target, you could substitute it with greater than or less than if it only has to be above or below the target _y value...
if (_root.myTargetedMovingClip._y == _root.targetY) {
loadMovie("myMovie.swf", _root.clipToLoadInto_mc);
}
}Hope this helps someone...
cheers
j
- snizl0
Hey thanks. I'll give it a shot!
- tGP0
hey man, you can disregard the email i sent your way, i got frustrated with the post field cutting off my code (the less than or equal too symbol doesnt seem to be good friends with it)...
cheers.
j
- snizl0
I tried out the code but its acting wierd. Should I set up a listener instead??
- System-Idle0
tGP's code looks fine to me.
make sure there are no obvious spaces where there shouldnt be
and use: delete this.onEnterFrame
just before the loadMovie line of code
- tGP0
describe "acting weird" ;-)
cheers
j
- caseyc0
Are you animating with code or using the timeline?
- snizl0
I am animating with code. Its hard to describe how its acting tGP, if you don't mind I'll send you the fla to look at. Thanks.
- tGP0
send it my way
cheers
j