Hi Guys,
I have just started learning AS3 (2-3 weeks) and I have to say its very enjoyable!
I am trying to make a function that pulls in values to save me writing 15 separate functions!
I have a “street mc” which has 15 “house mc’s” inside.
When the user hovers over a house I want the resident to appear above the house.
The house instance name is house1 and there is a mc in the library linked using the MrsRoy() class.
This is my code so far:
var house1Res:MovieClip = new MrsRoy();
function resIconIn(e:MouseEvent):void{
var currentHouse = "street." + e.target.name;
var currentRes = e.target.name + "Res";
currentHouse.addChild(currentRes);
currentRes.play();
var fadeIn:Tween = new Tween(currentRes, "alpha", None.easeIn, 0, 1, 12, false);
currentHouse.addEventListener(MouseEvent.MOUSE_OUT, resIconOut, false, 0, true);
}
function resIconOut(e:MouseEvent):void{
var currentHouse = "street." + e.target.name;
var currentRes = e.target.name + "Res";
var fadeOut:Tween = new Tween(currentRes, "alpha", None.easeOut, 1, 0, 3, false);
fadeOut.addEventListener(TweenEvent.MOTION_FINISH, onFinish, false, 0, true);
removeEventListener(MouseEvent.MOUSE_OUT, resIconOut);
}
function onFinish(e:TweenEvent):void{
var currentHouse = "street." + e.target.name;
var currentRes = e.target.name + "Res";
currentHouse.removeChild(currentRes);
}
I get the error:
TypeError: Error #1006: value is not a function.
at Dignity_drive_fla::MainTimeline/resIconIn()
Thanks in advance!