Creating Gradient-filled shapes via JSFL CS5.5?

I'm trying to use JSFL to create a number of oval shapes on a layer, that have a gradient fill applied to them.  I've stripped down the JSFL to very bare bones which I will post here:
var flashDoc = fl.getDocumentDOM();
var flashLib = flashDoc.library;
var flashTimeline = flashDoc.getTimeline();
// Set fill color for all shapes
var fill = flashDoc.getCustomFill();
fill.style = "radialGradient";
fill.color = "#FFFFFF";    // For some reason if I don't assign at least *something* here, the color array doesn't work and I get fully black shapes
fill.colorArray = ["#0033CC", "#FFFFFF"];
fill.posArray = [0, 255];
fill.focalPoint = 0;
fill.linearRGB = true;
flashDoc.setCustomFill( fill );
for( var i = 0; i < 10; ++i )
    var x = Math.random() * 500;
    var y = Math.random() * 400;
    var radius = Math.random() * 25 + 25;
    var left = x - radius;
    var top = y - radius;
    var right = x + radius;
    var bottom = y + radius;
    flashDoc.addNewOval( {left:left, top:top, right:right, bottom:bottom}, false, true );
When I run this script I do not get the results I'm expecting.  I get a number of oval shapes that all share the same gradient transform, i.e., each shape only gets part of the gradient.  The documentation says this function should be equivalent to using the draw oval tool, yet when you use that tool each oval you draw is associated with its own gradient transform.
My Questions:
1. Am I missing a piece here to create shapes each with their own gradient transform?
2. Is it a bug that I have to set something into fill.color, even though I'm supplying a color array?  If I set nothing there, all the shapes will draw in full black.
3. Is there a way to specify gradient colors that include alpha?
Thanks for your time.

Yep, that made the rest of my whole day!! Works excelllent in the demo, and i'm just replacing all the  Image<->Triangle commands. Wonderfulll & thanks a lot, LitDev. (enjoint the sb sample in your Test-DL :-))
PS:
Controls.SetTextBoxText(Controls.AddTextBox(10,10), "Enter your name here...")
Controls.AddButton(".. then press the Button", 180,10)
LDGraphicsWindow.Capture("","")
GraphicsWindow.Clear()
GraphicsWindow.DrawImage("ImageList1", 0,0)

Similar Messages

  • Is it possible to create a contact form via Flash cs5.5 and package out app for desktop?

    I need to create a desktop app for windows.  Im using Flash cs5.5 and I wanted to know of an easy to way to create a simple contact form that would work once installed on a desktop/
    Thanks guys for any input!

    If you want a contact form you can either use StageWebView or HTMLLoader to show an HTML page in your web server with a contact form.
    Or you can create the form with Flash textfields and then send the whole thing with a POST request to a PHP script in the server, for example.

  • Photoshop shape layer gradient fill bug

    I use shapes filled with linear gradient turned 90° from its default position. And every now and then, when I select the given shape layer (with the move tool or directly in the layer dialog) the gradient jumps into the default rotation position. The thing is, if this happens, there´s no way I can turn it back.. if I type a value or try to rotate the gradient, it always jumps back.. even if I create a new shape, the rotation function is set to default and won´t move a degree.. Normally a PS restart helped to solve this.. but today, the problem remained even after that.. I will reboot the system and hopefully it will work but.. if anyone has experienced the same problem or has any suggestions, please help.
    PS CC 2014 (latest update - though this problem I´ve had since the first CC), OS 10.8.5 (Maybe updating to Mavericks?)
    thanks in advance!

    I do not use a mac however on windows if I have a gradient filled shape layer I rotated the the gradient fill.  If I accidentally click the solid fill or pattern fill icon when I click back on the gradient fill icon the angle is the default 90 degrees it does not remember that the fill was set to 0 or 180.
    I have not observed any problem with the move tool but I seldom have a shape with a gradient fill.  I normally use a layer style gradient fill on a solid 50% gray filled shape,

  • CS6 Gradient fills on shapes different after reloading?

    Is anyone else getting an issue whereby gradient fills have changed when you reopen a PSD.
    It's happening too often to me to be something i'm doing accidentally.
    Sometimes i save my file and the gradient fill on a shape is be grey, reopen and it's then white.
    Fixing it and saving it again seems to then save it properly.
    I haven't been able to establish a pattern to reproducing it yet.
    Hence why i'm wondering if others have seen this too?
    Rob.

    If you define the gradient with Foreground and/or Background in a colour stop(s) of the gradient, then whenever the file is opened, these stop(s) will take on Photoshop's current fore/background colours.
    For example, the first preset gradient is called "Foreground to Background" and the grey/black checker in the stops indicate fore/background colour and not a fixed colour.
    However, when you reopen a file that has such a gradient-filled Shape and inspect the gradient, the stops will misleadingly look like normal fixed colour stops despite really being fore/background stops.
    To make a fore/background stop a fixed colour stop, simply click the stop before saving the file.

  • Drop down and gradient fill

    In flash i want to create a roll over dop down menu like
    suckerfish drop down.
    I want each menu item to have a gradient fill of color and
    change color when roll over.
    2)How do i create gradient fill on just a simple rectangle? I
    see in color mixer this but th epaint fill does 1 solid color.
    3) is it possible to have a drop down menu?

    2) To create a gradient fill, do the following:
    a- create a rectangle
    b- select the fill color
    c- from the color mixer, choose liner gradient from the Type
    como box.
    d- in the gradient color indecator, you will see two colors.
    duoble-click the color box to change it. and move the small
    triangle to control its length.
    e- to add new color click any where on the gradient bar.
    3) you you can, just search on google on how to create
    drop-menu in Flash and you will find many

  • Gradient fills

    Hi, I want to create gradient fills that start from somewhere within an object rather than the edge. This allows me to create an object that looks more 3D, such as a sphere or a cylinder. At the moment the inspector in Keynote 4.0.1 only seems to allow me to change the angle around the edgeobject from which the gradient starts and not move the commencement of the gradient to a point within the object. This is easy in PPT. Any suggestions? Cheers, FAD

    Welcome to the discussions, fad1.
    You can't change the gradient in EXACTLY the way you want, but the use of some creative color picking might get you the next best thing. Here are some links to pages where I've used only Keynote's gradient tool to create some images I think have a nice 3D "Web 2.0" feel to them Some steps on how to produce the effect is on the page.
    http://web.mac.com/makentosh/tipsfromtheiceberg/Blog/Entries/2006/6/27To_saw,_is_to_see,yesternow.html
    http://web.mac.com/makentosh/tipsfromtheiceberg/Blog/Entries/2006/7/7Shiny_happythingies.html
    http://web.mac.com/makentosh/tipsfromtheiceberg/Blog/Entries/2006/7/13Shiny,_taketwo.html

  • Fill/stroke gradients from shape tool option bar: editing color stop/midpoint location values

    Hi!
    In PS6 beta 1 (20120305.m415), the new gradient editor available from the shape tool option bar, used to edit gradient for both fill and stroke, doesn't contain editable stops location percentage input fields.
    Those are available from the traditional gradient editor dialog box, for opacity and color stops and midpoints. They are quite handy to create gradient with some precise stops.
    Could you please enhance the new gradient editor and add either these two location fields, or at least, a tooltip which displays a stop/midpoint percentage value as we drag it?
    Thanks,
    el' ~

    If you click on the gradient bar it will bring up the full gradient editor.

  • Making a radial gradient fill follow the shape of a path

    I have created an elaborate path. I now want to radial gradient fill the background but I want it fill in such a way that the gradient is shaped like the path, e.g. if I had a star or car shaped path, the radial gradient isn't round but shaped like a star or a car.
    I want to get the effect of a shape glowing but in a gradient of different colours as opposed to just one.

    Chuck, I had to dig into the darkest depths of my old memory for this, but I had a feeling it was there somewhere.  The black stroke on the outside is on another layer, because I _had_ to harden up the outline! 

  • Gradient fill disappearing when converting vector/Illustrator file to shape layer

    Hi,
    When coverting a vector or Illustrator file (such as a logo) into a shape layer any gradient fill is lost. Is there no way to ensure the gradient fill is converted across or is this a matter for a future release of After Effects?
    Many thanks.

    That's a limitation of the current feature.
    If you want a different behavior, you can submit a feature request here: http://www.adobe.com/go/wish

  • Change the blending mode on the gradient fill within a shape layer?

    I can't seem to figure out how to do this, if it is possible.  I have a shape layer with a gradient fill,  that gradient fill layer needs to be set to multiply, by default its normal.  can the be done with scripting?

    Indeed it is not that easy to modify the blending mode.
    The blending mode is property(1), or property("ADBE Vector Blend Mode"), of the gradient fill.
    Normally the blending modes are listed in the BlendingMode object, and mutliply corresponds to BlendingMode.MULTIPLY
    But it doesnt work for shape graphics: if you try myGradientFill.property(1).setValue(blendingMode.MULTIPLY); you are out of range.
    The value to enter is actually the occurrence of the mode in the dropdownmenu, counting separators...
    so
    myGradientFill.property(1).setValue(4);
    Xavier

  • Creating gradient mesh object, object turns into gradient mesh object w/ white fill

    Creating gradient mesh object, object turns into a gradient mesh object w/ white fill automatically.
    I would like this to be a stroke object as I cannot see the picture that I am trying to recreate.
    Illustrator is not allowing me to change the white fill into a stroke after I create the gradient mesh object.
    Here is the image when I try to create the gradient mesh object, I do not have the white fill option chosen and the image still
    becomes a white fill gradient mesh object.
    Please can anyone help??
    Thank you.

    Sure. A gradient mesh won't have strokes. It will always have fills. If you want no fill, you need to set the opacity of a single mesh point to 0%. But you actually don't want to do that for the complete grid, because it will be very time consuming to adjust this back to 100 percent for every single meshpoint when coloring them.
    Instead the usual setup is with the two layers. This allows you to see the gridlines and the template. Then you first adjust the grid (color doesn't matter for this). Then you pick up the colors from the template to color the single mesh points. From time to time you switch into preview to admire your work.

  • How can I get "distorted" gradient fills to copy & paste properly?

    Here's the situation simplified: I create a document and draw a circle and fill it with a circular gradient fill. I then copy and paste that circle into a new document. It looks exactly the same, and importantly, the gradient fill is still editable, so I can change the colours making up the gradient, their positions on the gradient-slider, etc.
    However, if I draw the circle in the first document, fill it with a circular gradient fill, and then I "distort" the gradient's shape to an oval shape, using the gradient tool — still keeping the circle itself as a circular shape (only the fill has changed shape) — and I then copy and paste this circle into a document, it does not get copied across properly as a "true" gradient fill.
    At first glance, it looks the same. However, viewing the circle in Outline mode shows that the gradient fill has been expanded into 100s and 100s of flat solid coloured objects, each one laid on top of another, getting progressively smaller and smaller, and all masked in the original circle shape.
    And of course, as the gradient fill has been expanded, it is no longer "live" and no longer editable, so I now can not edit its colours or positions on the gradient-slider, etc.
    So, how can I make it so that Illustrator maintains and keeps the correct gradient fill when copying and pasting between documents? I've tried editing all the settings under Preferences > File Handling & Clipboard, but all without success.
    At the moment, to overcome this "bug", I have to separate the two document windows by dragging its tab out of the main Illustrator window, so I now have two floating windows, rather than all windows tabbed in the one environment, and I then have to drag and drop the object from one window to the other. Slightly inconvenient, but it does get the job done.
    Strangely enough, dragging and dropping DOES work, whereas copying and pasting does NOT. Weird.
    However this slight inconvenience soon adds up when I have to do it many many many times over.
    And it gets progressively worse, because dragging and dropping does not allow me to place the object in the position I want it, whereas with copying and pasting, I could ordinarily choose to "Paste In Front" to place my object exactly in the same position between the two documents.
    In order to overcome this, I have to drag and drop to get the gradient fill across correctly, and then I have to copy and paste a non-filled duplicate version of the object to get it in precisely the same place, and then I have to use the alignment tools to get the two objects to line up. This = major inconvenience.
    And all this becomes even worse when attempting to copy an Illustrator object into Photoshop as a Smart Object, because when I then double-click the Smart Object in Photoshop to edit it, the gradient fill has been expanded — because, obviously, the object had to have been copied and pasted to get it from Illustrator into Photoshop, and this is the problem that Illustrator seems to be having.

    Thanks for the continuing answers guys, mucho appreciado.
    However, to go through what's been said since my last post...
    I tried launching Illustrator in another user account on this machine, but it wouldn't even launch! I got some error number (which I don't recall offhand, but I can re-check it later).
    To clarify, this is an official install of CS4 (so no pirating here!), and Illustrator was not running in my other main user account.
    And the InDesign thing wouldn't apply to me, as I don't use that app at all. I do invariably have a couple of other CS4 apps running though, usually always Photoshop and Bridge.
    I CAN understand how copying and pasting from Illustrator to InDesign would cause this though, because InDesign doesn't support live editable gradients to the same advanced degree that Illustrator does, so it has to expand it when doing so, thereby losing its editability.
    Copying and pasting whilst staying completely within Illustrator though is a different story.
    You know what — I just had a thought... What if this is nothing to do with Illustrator, but is instead something to do with my Mac OS's system-level clipboard?
    I actually had a 3rd-party multiple-item clipboard item installed some time ago, but then never used it. Maybe there's still remnants of that floating around and that's interfering with it somehow?
    I'll see if I can clear out all traces of it and see if it makes a difference... Fingers crossed!

  • Infinity ribbon with gradient fill

    Looking for a way to create an infinity shape/ribbon with gradients. After that I need to create several layer of fills that intertwine on top and below each intertwined ribbon.
    Help if you can
    w

    webbeese wrote:
    Looking for a way to create an infinity shape/ribbon with gradients. After that I need to create several layer of fills that intertwine on top and below each intertwined ribbon.
    Do a search here (Illustrator Forum). There's a great tutorial by JET (JETalmage) and a very good thread...

  • Why does Illustrator CS6 create gradients through clip groups?

    Hi,
    This may be a stupid question, but I jumped to CS6 from CS3 and am a bit confused. I create graphics for stock imagery and it is important to minize the amount of shapes. I created my first image with CS6 that has several gradients and my file is enormous because when I viewed it with "Overprint view" it showed that all gradients consisted of several paths contained in a clip group. How do I avoid this? Any help would be appreciated!

    I just made a very primitive inerpretation of clip art which is the kind of stuff sold for stock.
    There are no clipping paths even though there are many paths with gradient fills. Can you explain how you create the art and or prepare a video so we can watch you create one shape with which you use the gradient that produces this clipping group?

  • Rotate gradient fills along with an object

    I created an object with gradient fills.  I grouped all of the elements in the object.
    When I try to rotate the object, the gradient fills do not rotate with the object.  An element that was transformed by: Effects->Warp->Arc also doesn't rotate as I would expect.
    Is there a way to tell Illustrator to rotate an object and keep it looking like it did before the rotate?
    (I'm using Illustrator CS5 on Windows XP.)
    Thanks!

    Regarding rotation of an ordianry grad fill applied to a single path:
    State EXACTLY and COMPLETELY, click-by-click, command-by-command, tool-by-tool, step-by-step, the minimum steps necessary to replicate the behavior you are seeing.
    Regarding a live effect like Warp:
    It is normal behavior for the Effect to not "rotate" with the object, because you are rotating the object to which the live effect is applied. The live effect is automatically re-applied after every edit you make to the object. That's what the "live" nature of "live effects" is all about; it gets re-applied automatically on-the-fly as you edit the original object. The fact that live effects do not "rotate with the object" can be used to great advantage.
    One way to cause the effect to "rotate with the object" is to store the object as a Symbol. Then, when you rotate Instances of that Symbol, the reference geometry of the effect is rotated also.
    JET

Maybe you are looking for