PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
How to mantain a movieclip's color between frames?
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to mantain a movieclip's color between frames?

Threaded View

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    2

    How to mantain a movieclip's color between frames?

    My app has 2 frames; in frame 1 there are 5 MC and on a DOUBLE_CLICK event the target's color change and go to the next frame 2. In frame 2 i have a button to return to frame 1.
    How can i maintain the MC color when i return to frame 1?
    Actionscript Code:
    package
    {
        import flash.display.*;
        import flash.events.*;
        import flash.net.*;
        import flash.geom.ColorTransform;

        public class test extends MovieClip
        {
            public function test()
            {
                var myMCTable:Array = [myMC1,myMC2,myMC3,myMC4,myMC5];
                for (var i:uint = 0; i<myMCTable.length; i++)
                {
                    myMCTable[i].doubleClickEnabled = true;
                    myMCTable[i].addEventListener(MouseEvent.DOUBLE_CLICK, changeColor);
                }
            }

            private function changeColor(e:MouseEvent):void
            {
                var newColorTransform:ColorTransform = (e.target).transform.colorTransform;
                newColorTransform.color = Math.random() * 0xFFFFFF;
                (e.target).transform.colorTransform = newColorTransform;
                nextFrame();
                goBack_btn.addEventListener(MouseEvent.CLICK, goBack);
            }

            private function goBack(e:MouseEvent):void
            {
                prevFrame();
            }
        }
    }
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center