ロールオーバーで解説が出る+くっついてくる//AS1.0

今回は、ロールオーバーしたときにだけ、ちょっとした解説などが出るようにするものです。

きもち+Mailのトップページやカスタマイズ画面の動画一覧を出す際に使っています。

Tweenクラスを使用するので、必ずはじめにimportの2行が必要です。
今回は、alphaと_x,_yの値をTweenで近づけてくるようになっていますが、場合によって、変化させる値を変えて使います。
(センターに配置してある青いのがarea_mc、浮き出てくる「ヘルプ」が、helptip_mcです)

//ActionScript//////////////////////////////////////////////////////////////////

//初期設定
import mx.transitions.Tween;
import mx.transitions.easing.*;
 var helpListener:Object = new Object();
 helptip_mc._alpha = 0;

//area_mcの設定

area_mc.onRollOver = function() {
    helptip_on();
};

area_mc.onRollOut = function() { 
    helptip_off();
};


function helptip_tween() {
    helptipx = new Tween(helptip_mc, "_x", Strong.easeOut, helptip_mc._x, _xmouse, 0.8, true);
    helptipy = new Tween(helptip_mc, "_y", Strong.easeOut, helptip_mc._y, _ymouse, 0.8, true);
}

//ついてくる動き
function helptip_on() {
    helptipa = new Tween(helptip_mc, "_alpha", Regular.easeIn, helptip_mc._alpha, 100, 0.4, true);
    Mouse.addListener(helpListener);
    helpListener.onMouseMove = function() {
        helptip_tween();
    };
}

//消える動き
function helptip_off() {
    helptipa_off = new Tween(helptip_mc, "_alpha", Regular.easeOut, helptip_mc._alpha, 0, 0.4, true);
    Mouse.removeListener(helpListener);
}

Bookmark and Share


ブックマークに追加