<p>I want to create buttons with icons in Flex dynamically using Actionscript.</p>

<p>I tried this, with no success:</p>

<pre><code>var closeButton = new Button();
closeButton.setStyle("icon", "@Embed(source='images/closeWindowUp.png");
</code></pre>

I'm assuming you're adding it to the stage?
Also, I think your Embed is missing a close quote / paren.
```
```
closeButton.setStyle("icon", "@Embed(source='images/closeWindowUp.png");
```
```
should be:
```
```
closeButton.setStyle("icon", "@Embed(source='images/closeWindowUp.png')");
```
```