Need help with this please, nearly there but I am getting an error.
Using a function to add sign_mc1 to sign_mc10 from the library into a container.
I am also sure there's another way to write the code.
function stoppedF():void {
var i:Number;
if (wheel_mc.segment_01.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 1);
output_txt.text = "Hit 01";
}
else if (wheel_mc.segment_02.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 2);
output_txt.text = "Hit 02";
}
else if (wheel_mc.segment_03.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 3);
output_txt.text = "Hit 03";
}
else if (wheel_mc.segment_04.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 4);
output_txt.text = "Hit 04";
}
else if (wheel_mc.segment_05.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 5);
output_txt.text = "Hit 05";
}
else if (wheel_mc.segment_06.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 6);
output_txt.text = "Hit 06";
}
else if (wheel_mc.segment_07.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 7);
output_txt.text = "Hit 07";
}
else if (wheel_mc.segment_08.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 8);
output_txt.text = "Hit 08";
}
else if (wheel_mc.segment_09.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 9);
output_txt.text = "Hit 09";
}
else if (wheel_mc.segment_10.hitTestPoint(hitObject.x,hitObject.y,true)) {
zoomSign(i = 10);
output_txt.text = "Hit 10";
}
else {
output_txt.text = "Wrong";
}
}
function zoomSign(i:Number):void {
var myTimeline:TimelineMax = new TimelineMax;
var container:Sprite = new Sprite ();
this.addChild(container);
var sign_mc:MovieClip = new MovieClip;
var si:sign_mc = sign_mc[""+ i];
container.addChild(si);
trace("Loop No. " + i);
// Container Start Position
container.x = 120;
container.y = 120;
// Container Start Rotation
container.rotation = 0;
myTimeline.append(TweenMax.to(container, 1, {x:120, y:120,rotation:0,alpha:1, scaleX:2, scaleY:2, onComplete:completeF,ease:Bounce.easeOut}));
myTimeline.append(TweenMax.to(container, 1, {alpha:0}), 1);
}
function completeF():void {
trace("Do Something");
}