Simon Ferndriger
Simon Ferndriger

Reputation: 4962

Trigger/Propagate Hover in Flash Actionscript 2?

I have multiple flash layers. The top layer clickTag is for catching the banner ad click and navigation to its landingpage.

However, when the user hovers the clickTag layer, I would also like to show the hover effect on a button in the Button layer below. But since the top layer is covering the whole space (width 100% x 100% height) of the banner, the hover effect of the button in the layer below never gets triggered.

How can I trigger/propagate the hover effect of the top layer to the button in a layer below?

enter image description here

Thank you.

Upvotes: 0

Views: 352

Answers (2)

animaacija
animaacija

Reputation: 180

Found this drawing api from here

function drawRoundedRectangle(mc:MovieClip,rectWidth:Number, rectHeight:Number, cornerRadius:Number, fillColor:Number, fillAlpha:Number, lineThickness:Number, lineColor:Number, lineAlpha:Number) {
  with (mc) {
    beginFill(fillColor, fillAlpha);
    lineStyle(lineThickness, lineColor, lineAlpha);
    moveTo(cornerRadius, 0);
    lineTo(rectWidth - cornerRadius, 0);
    curveTo(rectWidth, 0, rectWidth, cornerRadius);
    lineTo(rectWidth, cornerRadius);
    lineTo(rectWidth, rectHeight - cornerRadius);
    curveTo(rectWidth, rectHeight, rectWidth - cornerRadius, rectHeight);
    lineTo(rectWidth - cornerRadius, rectHeight);
    lineTo(cornerRadius, rectHeight);
    curveTo(0, rectHeight, 0, rectHeight - cornerRadius);
    lineTo(0, rectHeight - cornerRadius);
    lineTo(0, cornerRadius);
    curveTo(0, 0, cornerRadius, 0);
    lineTo(cornerRadius, 0);
    endFill();
  }
}

This is for learning proposes strictly!!!

this.createEmptyMovieClip("th",100);
drawRoundedRectangle(th,100,50,5,0x00f999,100,1,0x000000,100);

th.onRollOver = function() {
decrement(th);
}

th.onRollOut = function() {
increment(th);
}  

function decrement(mc){
mc.onEnterFrame= function(){(th._alpha > 50)?th._alpha -= 9:delete this.onEnterFrame;}
}

function increment(mc){
mc.onEnterFrame= function(){(th._alpha < 100)?th._alpha += 5:delete this.onEnterFrame;}
}

Upvotes: 1

animaacija
animaacija

Reputation: 180

Soo many solutions, as create your costume button, listen for mouse placement in stage, and invoke button animation, wen mouse hovered specific region.

As if u are using button from Flash Componets menu, and you do not want to redraw that buttons style into your custom movie clip, here is one approach:

clickTag is applied to transparent movieClip right? Toogle into it to deepest possible level and just delete that region of bitmap, you want the button to be "seen" through, thus button actions will be seen now, through a hole in clickTag movieClip. // science

Upvotes: 0

Related Questions