Question:

How do I bring rotating sun-rays in Adobe Flash?

by Guest64058  |  earlier

0 LIKES UnLike

Have you seen those beautiful Flash animations where the sun-rays or other objects rotate so beautifully around the object? I am so interested to create one but need the steps to do it. There are online help in Adobe's site but a step by step illustration would be pretty nice.

 Tags:

   Report

1 ANSWERS


  1. Copy and paste this AS3 code to the first frame of your flash CS3 document. You don't need to create anything on the stage

    have a look @ my flash blog to C an example

    http://flash-workshop.blogspot.com/2008/...

    function CreateRays() : Shape {

    var ray: Shape = new Shape ();

    ray. graphics. beginFill (0xFF9900,.5);

    ray. graphics. lineStyle (1,0xFF9900,.5);

    ray. graphics. lineTo (600,-20);

    ray. graphics. lineTo (600,20);

    ray. graphics. lineTo (0,0);

    ray. graphics. endFill();

    return ray;

    }

    var sun:Shape = new Shape();

    sun. graphics. beginFill (0xFF9900,1);

    sun. graphics. drawCircle (0,0,30);

    sun. graphics. endFill();

    //edit this no to change the no of rays :-)

    var SunaRays: Number = 25;

    var rayShapes = new Shape ();

    var SunGlow: MovieClip = new MovieClip ();

    for (var i:int = 1; i <= SunaRays; i++) {

    rayShapes = CreateRays();

    rayShapes. rotation = 360 / (SunaRays) * i;

    SunGlow. addChild (rayShapes);

    }

    SunGlow. addChild (sun);

    addChild (SunGlow);

    SunGlow. x = stage. stageWidth/2;

    SunGlow .y = stage. stageHeight/2;

    //you can change fps here

    stage. frameRate = 30;

    stage. addEventListener (Event.ENTER_FRAME,rotateSun);

    function rotateSun (e:Event) : void {

    //you change speed here

    SunGlow. rotation += 1;

    }

    Anil

    anilkumarnd@gmail.com

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.