Hi everyone, Im creating a navigation menu bar, and have problem in output=)
TypeError: Error #1034: Type Coercion failed: cannot convert flash.text::TextField@3271089 to flash.display.MovieClip.
at Untitled_fla::MainTimeline/mouseOverButton()
my AS3.0 is as following:
[COLOR=red]import gs.;
import gs.plugins.;
TweenPlugin.activate([BlurFilterPlugin]);
var buttonsArray:Array = new Array(home1Button,aboutus1Button,ourservices1Butto n,ourclients1Button,ourpartners1Button,careers1But ton,contactus1Button);
for (var i:uint = 0; i < buttonsArray.length; i++) {
buttonsArray*.addEventListener(MouseEvent.MOUSE_OVER, mouseOverButton);
buttonsArray*.addEventListener(MouseEvent.CLICK, buttonClicked);
}
buttonBackground.x = home1Button.x;
buttonBackground.y = home1Button.y;
buttonBackground.width = home1Button.width + 10;
buttonBackground.height = home1Button.height + 10;
TweenMax.to(buttonBackground, 0.1, {tint: Math.random() * 0xffffff});
function mouseOverButton(e:Event):void {
var button:MovieClip = (MovieClip)(e.target);
var targetWidth:Number = button.width + 10;
var targetHeight:Number = button.height + 10;
TweenMax.to(buttonBackground, 0.5, {x: button.x, y: button.y,
width:targetWidth, height:targetHeight, tint: Math.random() * 0xffffff});
}
function buttonClicked(e:Event):void {
trace(e.target.name + " was clicked!");
}[/COLOR]
Does anyone know why this comes up or how to get rid of it? Its very urgent for me>.<