[thelist] Re: Flash ActionScript problem

Valerie L Walker wholebody at sfo.com
Wed Sep 26 14:30:31 CDT 2001


this is for a class assignment for an advanced Flash 5 class i'm taking, and
i'm really stuck. the .fla file in question is at
http://www.wiggage.com/portfolio/flash/class2/test05.fla
 here's my code (from the main timeline, with comments). it seems to get
stuck at the hitTest part, which is very strange, because the exact same
coding was working when it was part of an onClipEvent inside the mc,
earlier in the process. i have posted a plea for help on the class website,
but if you could take a look at it maybe you could see where i'm going
wrong. i have checked each element out separately, and everything seems to
be working except the damn hitTest.--v
===========

stop ();
// line 2: bring the cupid on the stage
_root.attachMovie("eros", "cupid", 2);
//line 4: hide the mouse
Mouse.hide();
//line 6: replace mouse cursor with cupid
startDrag ("cupid", true);
// line 8: declare function to bring the heart mc onstage
function enterHeart () {
	_root.attachMovie("moveHeart", "heart", 1);
	_root.fade._x = 300;
}
//line 13: declare function to make the heart chase the cupid
function findIt () {
	_root.heart._x += (_root._xmouse-_root.heart._x)/10;
	_root.heart._y += (_root._ymouse-_root.heart._y)/10;
}
//line 18:declare function to make the "yes" message mc fade away
function fadeIt(){
	_root.fade._alpha -= 5;
}
//line 22: trigger the function "enterHeart"to bring the heart onstage
// heart.inHeart mc triggers function "findIt" as an onClipEvent
_root.enterHeart();
//line 25: if the cupid catches the heart
	if(_root.heart.hitTest(root.xmouse, _root.ymouse, true)){
//line 27: then go to next frame in heart.inHeart movie & display "yes!"
message
	_root.heart.inHeart.nextFrame()
//line 29: and attach "yes" message mc that triggers function "fadeIt"
		_root.heart.attachMovie("alphaFade", "fade", 3);
}
//line 32: if the "yes" message is faded out completely
	if (_root.heart._alpha<0){
//line 34: then take both movies off the stage
		_root.removeMovieclip (fade);
		_root.removeMovieClip (heart);
//line 37: and start the process over again by bringing in the heart
	_root.enterHeart();
	}
	
======

<tip>
In any programming environment, you have to begin by stripping it down to
the essentials, then get it to work (by debugging it), and then you can add
the bells and whistles (complexity), and get it to work again (by debugging
it again). Piling on complexity when you start a project will make it
impossible to debug. Work, incrementally, from the simple to the complex;
that's exemplified by the concept of KISS. --Ron Miller
</tip>



valerie
wholebody at sfo.com (home)
valeriewalker_99 at yahoo.com (away)
http://www.wiggage.com
http://www.compostcoven.org
sigil city: http://www.compostcoven.org/compost/sigils/sigils.html

"what's so funny 'bout peace, love, and understanding?"--elvis costello






More information about the thelist mailing list