views:

56

answers:

1

I have tried to do this here http://wonderfl.net/c/9Kdv but what I want is not this

alt text

but rather the equivalent of this. As I'm flash newbie I don't see how:

alt text

action script 3 code below:

package {
    import flash.display.*;
    import flash.text.*;
    import flash.net.URLRequest;
    import flash.filters.*;

    import flash.geom.Rectangle;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var mc:MovieClip = new MovieClip();
            mc.graphics.beginFill(0x400000);
            mc.graphics.drawRoundRect(0, 0, 278, 170,25,25);
            mc.graphics.endFill();
            mc.x = 80;
            mc.y = 60;
            addChild(mc);  

            //from tut http://blog.0tutor.com/post.aspx?id=116
            var filt:GlowFilter = new GlowFilter();  
            var filt_shadow:DropShadowFilter = new DropShadowFilter();              
            //here we add some properties to the two filters, the glow filter we give a color.   
             filt.color = 0xFF0000;  

             //and how much it should blur.   
             filt.blurX = 7;  
             filt.blurY = 7;  

             //then the dropshadow filter, also how much it should blur on the object.   
             filt_shadow.blurX = 4;  
             filt_shadow.blurY = 4;  

             //and finally an alpha, the alpha goes from 1 to 0, 1 being fully visible and 0 is transparent, then of cause .5 is just in between.   
             filt_shadow.alpha = .4;  


             mc.filters =  [filt,filt_shadow];

            var theTextField:TextField = new TextField();
            theTextField.border = false;
            theTextField.x = 30;
            theTextField.y = 50;
            theTextField.autoSize = TextFieldAutoSize.LEFT;
            theTextField.text = "Experiment";

            var myformat:TextFormat = new TextFormat();
            myformat.color = 0xFFFFFF;
            myformat.size =24;
            myformat.align="center";                
            myformat.font = "Impact";

            theTextField.setTextFormat(myformat);   
            mc.addChild(theTextField);      

            var url:String = "//www.rebol.com/graphics/reb-logo.gif";
            var urlReq:URLRequest = new URLRequest(url);

            var ldr:Loader = new Loader();
            ldr.load(urlReq);
            ldr.x=30;
            ldr.y=88;
            mc.addChild(ldr);


        }
    }
}
+1  A: 

Instead of this line:

mc.graphics.beginFill(0x400000);

you can use beginGradientFill with the fillType set to GradientType.RADIAL. You would just need to adjust the focalPointRatio to make it offcenter. Check out the example in the docs for how to do this.

TandemAdam
Hi thanks that seems what I should use, but it's not easy to know the parameters values. I have done something but am wandering a lot :)
Rebol Tutorial
There are quite a few examples out there on how to use beginGradientFill. The link above shows an example with parameters, and Google have even more help.
TandemAdam