creating a rounded button from AS3? - actionscript-3

How to create rounded & good looking "OK" and "CANCEL" buttons from AS3 ?
I dont want to use any images for these, just draw them?

I'd use a Shape or a Sprite, and draw on it using the graphics proerty
something like
var s:Shape = new Shape();
s.graphics.beginFill(0x123123, 1);
s.graphics.drawRoundRect(...);
s.graphics.endFill();
or using a Sprite if you want to attach additional elements on it (like a label)

Further to monkee's answer, if using Flex you can create very simple rounded Buttons by setting the cornerRadius style.

There are many ways to do that.
If I were you - if a button is all you need. Make yourself a button class. If you need more Layout & GUI elements, consider using the Flex Framework or something like ASwing
In Flex either learn how to skin a component or do it yourself. Just create a canvas, box, label or whatever with a picture in it and make it behave like a button.

Related

Making dynamic text movable?

I have this DIY designer where a user can put text on a board. The problem is it cant be moved. I can do draggable movieclips but not dynamic text. Is it possible?
I'm assuming your dynamic text is going into something like a label or an Flex TextArea or TextInput or something. You should just be able to move the container itself by setting the x and y properties. TextInputs have opaque backgrounds, but it sounds like you should probably be using a Flex TextArea or something similar anyway.

how to make a triangle button in flex using custom component?

I need a button that has a triangle shape.
how to make a custom component like a triangle button in flex?
what class should i override? updateDisplayList()? or layoutChrom()?
Depending on how complex you want the button to be you might be able to get away with using a process like this - except make the color outside the triangle the same for the 'clicked' and 'unclicked' states. Only change the color inside the triangle for the selected state.
If you need something more complex you can start with this or this for guidance.

fancy tooltips in Swing

I have a JTable that I would like to display a fancy tooltip (basically a JTextArea) for particular cells in a column. I am using a custom cell renderer, so it would be easy if I could figure out how to popup a window when I hover over the cell renderer's component.
Are there any examples of how to do this?
You can use HTML in tooltips, if you use the <html> and </html> tags around the content.
Use HTML to format the tooltip. Using colored (<font>) and multi-line (<br>) tooltips is now easy.
Creating and overwriting the default JToolTip is a bit harder. Every component has a JToolTip instance and you can retrieve this one with JComponent.createToolTip(). To create a custom tooltip, extend the cell renderer and override it's createToolTip to implement your custom functionality (return a custom extended version of JToolTip).
I'm not sure I totally am clear on what sort of customizations specifically you're hoping to do, so I'll be general here.
There is a class, UIManager, that controls the look and feel of components, including the swing ToolTip class. The simple way to make an easy change is to call a method in UIManager to set properties for the tooltips. Doing this you could do things like use BorderFactory to add a decorative border, or change the background color, etc.
Here are some examples of changing some of these properties:
UIManager.put("ToolTip.background", new ColorUIResource(255, 247, 200)); // The color is #fff7c8.
Border border = BorderFactory.createLineBorder(new Color(76,79,83)); // The color is #4c4f53.
UIManager.put("ToolTip.border", border);
ToolTipManager.sharedInstance().setDismissDelay(15000);// 15 seconds
If you want to change a whole bunch of things about their look and feel, it is better to extend your current look and feel with a class implementing custom tooltip look and feel. A full example of this can be found in this blog post by a former Sun developer.
You might also have a look at this Stack Overflow question on how to set the insets on a tooltip.

Flex 4 -- Adding blur below pane

I'm looking to create a component like an Alert but with a bunch of components inside the pane. How can I create the blur effect below a pane?
Have a look at the AS docs here, there's a good example that will do what you want. Any DisplayObject can have filters applied to it
Alternatively, you can use something like TweenMax's dropShadowFilter to do it quickly and easily

TileList custom ImageCell, buttons/sprites on each image

Hi im trying to add some buttons or sprites on each of TileList items, i even made my own ImageCell class and inject some code that adds sprite on each image but it is not clickable - all clicks are reffering to "object MyImageCell" not that specific sprite, is there a solution for this or any other way for adding some content on TileList items?
I think you have the some problem as I met.In your MyImageCell class add this property:this.mouseChildren = true;
Hope this can help.