So in my game I have a ketchup button that when its click creats a ketchup movieclip that attaches to the cursor. What I want is for when you click on the buns with the ketchup cursor it goes to the frame within the bunsmc called “ketchup”.
I keep getting this error and I have no idea how to fix it!
TypeError: Error #1034: Type Coercion failed: cannot convert ketchmc$ to flash.display.DisplayObject.
at bunsmc/ketchup()
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class bunsmc extends MovieClip
{
public function bunsmc()
{
x = 267;
y = 235;
addEventListener(MouseEvent.MOUSE_OVER,hilight);
}
public function hilight (e:MouseEvent):void
{
gotoAndPlay("highlight");
addEventListener(MouseEvent.MOUSE_OUT,plain);
}
public function plain (e:MouseEvent):void
{
gotoAndPlay("plain");
var blnTrip2:Boolean = true;
addEventListener(MouseEvent.CLICK,ketchup);
}
var ketchMC = ketchmc;
function ketchup (e:MouseEvent):void
{
if(stage.contains(ketchMC)&& blnTrip2)
{
trace("yay");
stage.removeEventListener(MouseEvent.CLICK,ketchup);
blnTrip = false;
}
}
}
}
what am I doing worng?
and suggestions on how to fix this and make it work??