Elasticsearch之rollover

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch之rollover相关的知识,希望对你有一定的参考价值。

参考技术A Elasticsearch rollover API - Code47 - 博客园

如果所有数据只存在一个索引下,随着数据积累,索引体积越来越大。为了方便管理ES索引,尽量将数据分散到多个索引里。在ES5.0以后新增了一个rollover API,可以动态的滚动索引。

FLash:尝试使用setChildIndex和TweenLite创建按钮rollOver效果时出错

alt text (来源:flickr.com

嗨再次大家:)所以今天我试图基本上在按钮rollOver上创建一个简单的发光效果。我可能会使事情变得复杂,但我正在做的事情是通过拥有2个movieClip(默认状态和over状态)。

首先我将默认状态添加到舞台,接下来我将rollOver状态添加到舞台,但深度为0,alpha也设置为0。现在我希望rollOver状态将深度与默认状态交换,并使用TweetLite类动画化为完整的alpha,这样我就可以获得一个很好的平滑过渡。

我现在收到一个错误,但是我的代码是:

import gs.TweenLite;
import fl.motion.easing.*;
import flash.display.MovieClip;


var shopButton:MovieClip;
var shopButtonRoll:MovieClip;
var maxIndex:Number = this.numChildren - 1;

// Button - places the default state onto the stage
shopButton = new ShopButton();
shopButton.name = "shopButton";
shopButton.x = 262;
shopButton.y = 207;
shopButton.stop();
thumbsMov.addChild(shopButton);

// Button Glow - places rollOver state under the default and with 0 alpha
shopButtonRoll = new ShopButtonRoll();
shopButtonRoll.name = "shopButtonRoll";
shopButtonRoll.x = 262;
shopButtonRoll.y = 207;
shopButtonRoll.alpha = 0;
thumbsMov.addChildAt(shopButtonRoll, 0);

// Listeners

shopButton.addEventListener(MouseEvent.MOUSE_UP, shopClick);
shopButton.addEventListener(MouseEvent.ROLL_OVER, sendToTop);
shopButton.addEventListener(MouseEvent.ROLL_OUT, shopOff);
shopButtonRoll.addEventListener(MouseEvent.ROLL_OVER, shopOver);

// Button Actions 
// shopOver should bring rollOver to top and animate to 100%

function shopOver(event:MouseEvent):void
{
     TweenLite.to(shopButtonRoll, 1, {alpha:1});
}
function shopOff(event:MouseEvent):void
{
     // Code to animate back to 0 then change depth of rollOver to 0
}
function shopClick(event:MouseEvent):void
}
     trace("You clicked Shop");
}

// sendToTop Function
// Sent to top - depth change
function sendToTop(e:Event):void
{
     //this.setChildIndex(ShopButton(e.target), maxIndex);
     this.setChildIndex(e.currentTarget as MovieClip, maxIndex);
}

我在rollOver上得到的错误:(

ArgumentError:错误#2025:提供的DisplayObject必须是调用者的子级。在flash.display :: DisplayObjectContainer / setChildIndex()at test_fla :: MainTimeline / sendToTop()

我不明白提供的DisplayObject的错误意味着什么必须是调用者的孩子?

答案

根据您尝试完成的任务,您无需管理深度。基本上你可以在shopButton中添加翻转效果,然后翻过shopButton,为发光设置动画。我用以下代码编写了你的​​代码:

import gs.TweenLite;
import fl.motion.easing.*;
import flash.display.MovieClip;


var shopButton:MovieClip;
var shopButtonRoll:MovieClip;

// Button - places the default state onto the stage
shopButton = new ShopButton();
shopButton.name = "shopButton";
shopButton.x = 262;
shopButton.y = 207;
shopButton.stop();
thumbsMov.addChild(shopButton);

// Button Glow - places rollOver state under the default and with 0 alpha
shopButtonRoll = new ShopButtonRoll();
shopButtonRoll.name = "shopButtonRoll";
shopButtonRoll.alpha = 0;
shopButton.addChild(shopButtonRoll);


// Listeners
shopButton.buttonMode = true;
shopButton.addEventListener(MouseEvent.MOUSE_UP, shopClick);
shopButton.addEventListener(MouseEvent.ROLL_OVER, shopOver);
shopButton.addEventListener(MouseEvent.ROLL_OUT, shopOff);

// Button Actions 
// shopOver should bring rollOver to top and animate to 100%

function shopOver(event:MouseEvent):void
{
     TweenLite.to(shopButtonRoll, 1, {alpha:1});
}
function shopOff(event:MouseEvent):void
{
    TweenLite.to(shopButtonRoll, 1, {alpha:0});
     // Code to animate back to 0 then change depth of rollOver to 0
}
function shopClick(event:MouseEvent):void
}
     trace("You clicked Shop");
}

以上是关于Elasticsearch之rollover的主要内容,如果未能解决你的问题,请参考以下文章

elasticsearch入门到放弃之elasticsearch-head

ElasticSearch系列之什么是ElasticSearch?

运维实操——日志分析系统ELK(上)之elasticsearch

日志分析系统ELK之Elasticsearch

日志分析系统ELK之Elasticsearch

elasticsearch之python操作(非原生)