PDA

View Full Version : my simple hitTest needs to loadMovie too


somnamblst
03-03-2009, 02:46 AM
I have a bouncing ball that when dunked plays a basketball net_mc animation. But I want to load a subSWF called youWin into an mc called mySUB when the ball hitTest is true.

This is what I have so far, I can't figure out how to make my hitTest do 2 things at once.

onClipEvent(enterFrame) {
if(this.hitTest(_root.net_mc)){

_root.net_mc.gotoAndPlay("net");
delete this.onEnterFrame
}

}

rrh
03-04-2009, 07:13 PM
Which of those two things is your code not currently doing?

somnamblst
03-04-2009, 09:15 PM
My what I feel is a hack of having the loadMovie just happen when a certain keyframe on the nested net_mc animation does work. But it seems jumpy. Sometimes it seems like my youWin2.swf which is loaded into mySUB on the main timeline appears to blink.

It just seems like it makes more sense to have the hit detection trigger the loading of the youWin2.swf.

I am currently attempting to do that like this but nothing is happening with the loadMovie. But the net_mc animation is playing.


onClipEvent(enterFrame) {
if(this.hitTest(_root.net_mc)){
mySUB.loadMovie(_root.myPR.absolutePath +"youWin2.swf");

_root.net_mc.gotoAndPlay("net");
delete this.onEnterFrame
}
}


I am also attempting the following but that is breaking the net_mc animation from playing in addition to not loading youWin2.swf into mySUB

onClipEvent(enterFrame) {
var mcl = new MovieClipLoader();
var lstn = new Object();
mcl.addListener(lstn);
lstn.onLoadInit = function(clip) {
clip.gotoAndPlay("net");}

if(this.hitTest(this.net_mc)){
mcl.loadClip("youWin2.swf", mySUB);
delete this.onEnterFrame
}
}

Thanks for looking at this!