That embed will not work because it is in action script and will be treated as a string try something like this:
First embed the image you want to use as an icon as a Class like so [Embed(source="icons/more.gif")] [Bindable] public var buttonIcon:Class; Now you can use it for your button like this: issButArray[i].setStyle("icon", buttonIcon); that should work for you. On Mon, Mar 15, 2010 at 9:01 AM, criptopus <sd_br...@ntlworld.com> wrote: > > > issButArray[i].setStyle("icon","@Embed(source='icons/more.gif')"); > > Type Coercion failed: cannot convert "@Embed(source='icons/more.gif')" to > Class? > > - New error? > > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, Robert > VanCuren Jr <robert.vancuren...@...> wrote: > > > > you need to use the setStyle method because icon is a style not a > property. > > > > myButton.setStyle("icon", source); > > > > On Mon, Mar 15, 2010 at 8:20 AM, criptopus <sd_br...@...> wrote: > > > > > > > > > > > // Add TLink To Issue Box > > > issButArray.push(new Button()); > > > issButArray[i].icon="@Embed(source='icons/more.gif')"; > > > issHbxArray[i].addChild(issButArray[i]); > > > > > > Error : > > > > > > Cannot create property icon on mx.controls.Button > > > > > > how do I set a buttons icon programatically? > > > > > > - Stephen > > > > > > > > > > > > > >