[> ScrollReel Actionscript 3.0 Component <]

Category : [> Coding <] · No Comments · by 25th October 2015

vdd

This is a little Actionscript 3.0 CustomComponent i build for Rehearsal
its Opensource. This is how you add it on Stage :

> Feel free to extend the Scroll Up/Down Behaviour <

>> Get it here :ScrollReel

package {
        /**
     * @author matuser
     */
    import flash.display.MovieClip;
    import flash.events.*;

    import caurina.transitions.*;

    import fl.data.DataProvider;

    import mat3d.yugopReel.ScrollReel;
    import mat3d.yugopReel.model.events.*;
    import mat3d.textarea.Area;

    public class YugopReelSW extends MovieClip {
        public var curTxt : String = new String();
        public var xt : ScrollReel;
        public var xxt : Area;

        public function YugopReelSW() {
            build();
        }

        public function build() {
            stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove)
            xt = new mat3d.yugopReel.ScrollReel();
            xt.name = "myScrollReel";
            xt.Width = 2772;
            xt.Height = 362;
            xt.x = -924;
            xt.y = 0;
            xt.buttonHeight = 362;
            xt.buttonWidth = 924;
            xt.AutoScroll = false;
            xt.ScrollInit = "_x";
            xt.StepControl = false;
            xt.StepBehaviour = "easeInOutCubic";
            xt.ScrollTime = 2;
            xt.FileType = "XML";
            xt.File = "inhaltone.xml";
            //xt.addEventListener(ScrollReelEvent.ON_MOVED, doTestCase);
            //xt.addEventListener(ScrollReelEvent.ON_CLICKED, doTestCase);
            xt.addEventListener(ScrollReelEvent.ON_START, doStart);
            xt.alpha = 0;
            addChild(xt);
            /*
            xxt = new mat3d.textarea.Area();
            xxt.name = "myArea";
            xxt.Width = 632;
            xxt.Height = 150;
            xxt.x = 420;
            xxt.y = 150;
            xxt.alpha = 100;
            xxt.FileType = "XML";
            xxt.File = "menuconfig.xml";
            xxt.addEventListener("onInit", initialize);
            xxt.addEventListener("onLink", linkId);
            addChild(xxt);
            setChildIndex(LeftBtn, numChildren - 1);
            setChildIndex(RightBtn, numChildren - 1);
            LeftBtn.addEventListener(MouseEvent.CLICK, doClick);
            RightBtn.addEventListener(MouseEvent.CLICK, doClick);
            LeftBtn.addEventListener(MouseEvent.ROLL_OVER, doRollOver);
            RightBtn.addEventListener(MouseEvent.ROLL_OVER, doRollOver);
            LeftBtn.addEventListener(MouseEvent.ROLL_OUT, doRollOut);
            RightBtn.addEventListener(MouseEvent.ROLL_OUT, doRollOut);
            */
        }

        public function mouseMove(me : MouseEvent) : void {
            //trace("MouseMove" + me.stageX + ">>" + me.stageY);
            if(me.stageX< -50 || me.stageX > 964 || me.stageY < 0 || me.stageY > 362) {
                xt.myModel.VIEW.isOver = false;
                //trace(">>>outside");
            } else {
                xt.myModel.VIEW.isOver = true;
                //trace(">>>inside");
            }
        }

        public function doClick(me : MouseEvent) : void {
            switch(me.target.name) {
                case "LeftBtn":
                    //trace("LeftClick");
                    if(xt.myModel.VIEW.ismoving == true) {
                    } else {
                        xt.MoveRight();
                    }
                    break;
                case "RightBtn":
                    //trace("RightClick");
                    if(xt.myModel.VIEW.ismoving == true) {
                    } else {
                        xt.MoveLeft();
                    }
                    break;
            }
        }

        public function doRollOver(me : MouseEvent) : void {
            switch(me.target.name) {
                case "LeftBtn":
                    //xt.myModel.VIEW.isOver = true;
                    break;
                case "RightBtn":
                    //xt.myModel.VIEW.isOver = true;
                    break;
            }
        }

        public function doRollOut(me : MouseEvent) : void {
            switch(me.target.name) {
                case "LeftBtn":
                    //xt.myModel.VIEW.isOver = false;
                    break;
                case "RightBtn":
                    //xt.myModel.VIEW.isOver = false;
                    break;
            }
        }

        //import mat3d.Test;
        //import nl.demonsters.debugger.MonsterDebugger;
        //var debugger : MonsterDebugger;
        //debugger = new MonsterDebugger(this);

        //var curTxt = new String();

        public function doStart($r : ScrollReelEvent) {
            curTxt = $r.params.param2;
            Tweener.addTween(xxt, {alpha:0, time:0.4, transition:"easeInOutQuart", delay:0, onComplete:txtAlp});
        }

        public function txtAlp() {
            //trace(">>>txtAlphacallback<<<"+curTxt);
            xxt.setText(curTxt);
            Tweener.addTween(xxt, {alpha:1, time:0.3, transition:"easeInOutQuart", delay:0.8});
        }

        public function doTestCase($e : ScrollReelEvent) {
            switch ($e.type) {
                case "onClicked" :
                    trace("TYPE: " + $e.type);
                    break;
                case "onMoved" :
                    trace("TYPE: " + $e.type);
                    break;
                case "onStart" :
                    trace("TYPE: " + $e.type + ">>>" + $e.params.param2);

                    break;
            }
    //trace("TYPE: " + $e.type + "\nTARGET: " + $e.target + "\nFIRST CUSTOM PARAM: " + $e.params.param1 + "\nSECOND CUSTOM PARAM: " + $e.params.param2);
        }

        
        
        public function initialize(e : Event) {
    //xxt.setText("<span class='secheadline'>Lipton Linea StyleStar>></span><p><br><br>Hierbei handelt es sich im ein kleines Gewinnspiel wo der Benutzer per Drap and Drop seine bevorzugten Items einsammeln kann das ganye Ketegorisiert sich nach <a href='event:link1'>Autos</a> , <a href='event:link2'>Schuhe</a> und <a href='event:link3'>Einrichtungsgegenstände</a>.Icons wurden von mir Gestalltet das Spiel von mir programmiert .<br>Technologien :<br><br>Flash<br>Xml<br>Php</p>");
        }

        public function linkId(e : Event) {
        }

        public function sronClicked(e : Event) {
            trace(">>>" + e.target);
        }
    }
}



Leave a Reply

Your email address will not be published. Required fields are marked *