arne
unread,May 24, 2011, 11:22:34 AM5/24/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to HYPE Framework
ok i reply to myself - the issue is of course the stage dimensions
how could i manage this??
code of my Gaia page :
package vuittonAV.pages {
import hype.extended.layout.ShapeLayout;
import hype.framework.core.ObjectPool;
import hype.framework.display.BitmapCanvas;
import hype.framework.rhythm.SimpleRhythm;
import com.gaiaframework.templates.AbstractPage;
import com.greensock.TweenMax;
import com.greensock.easing.Elastic;
import flash.display.*;
import flash.events.MouseEvent;
import flash.system.ApplicationDomain;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
public class DicoPage extends AbstractPage
{
private var motsTab:Array = new
Array("word1","word2","word3","word4");
private var pool:ObjectPool;
private var layout:ShapeLayout;
private var rythm:SimpleRhythm;
public var MyShape;
public function DicoPage()
{
super();
MyShape.visible = false;
var textCont : Class =
ApplicationDomain.currentDomain.getDefinition("TextObject") as Class ;
pool = new ObjectPool(textCont,300);
layout = new ShapeLayout(MyShape);
var format:TextFormat = new TextFormat();
format.align = TextFormatAlign.CENTER;
pool.onRequestObject = function(clip) {
var alea=Math.floor(Math.random() * motsTab.length);
var alea2 = (Math.random()) + 0.25;
clip.texte.defaultTextFormat = format;
clip.texte.text = motsTab[alea];
clip.texte.wordWrap=false;
clip.texte.autoSize = TextFieldAutoSize.LEFT;
clip.bg.width = clip.texte.textWidth;
clip.bg.x = clip.texte.x + clip.bg.width/2;
clip.texte.scaleX = clip.texte.scaleY = alea2;
clip.texte.alpha = alea2;
clip.alea2= alea2;
layout.applyLayout(clip);
addChild(clip);
clip.buttonMode =true;
clip.mouseChildren = false;
clip.addEventListener(MouseEvent.ROLL_OVER,overTexte);
clip.addEventListener(MouseEvent.ROLL_OUT,outTexte);
TweenMax.from(clip, 1, {scaleX:0,scaleY:0,alpha:0});
};
rythm = new SimpleRhythm(populatePool);
//pool.requestAll();
rythm.start();
}
private function populatePool(r:SimpleRhythm) : void
{
pool.request();
}
private function overTexte(event : MouseEvent) : void {
addChild(DisplayObject(event.currentTarget));
TweenMax.to(event.currentTarget.texte,4,{scaleX:3,scaleY:3,alpha:1
,glowFilter:{color:0xffffff, alpha:1, blurX:30, blurY:30, quality:
2, strength:3}
,ease:Elastic.easeOut
});
}
private function outTexte(event : MouseEvent) : void {
var alea = event.currentTarget.alea2;
TweenMax.to(event.currentTarget.texte,4,{
scaleX:alea
,scaleY:alea
,alpha:alea
,glowFilter:{color:0xffffff, alpha:0, blurX:30, blurY:30, quality:
2}
,ease:Elastic.easeOut
});
}
override public function transitionIn():void
{
super.transitionIn();
TweenMax.to(this, 0.3, {alpha:1, onComplete:transitionInComplete});
}
override public function transitionOut():void
{
super.transitionOut();
TweenMax.to(this, 0.3, {alpha:0,
onComplete:transitionOutComplete});
}
}
}