![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
I am trying to create a button with a png file and here is my code
<mx:Button width="175" label="{myRepeater.currentItem.CATEGORYDESC}" data="{myRepeater.currentItem}" mouseOver="changeStyle(event)" upSkin="@Embed(source='{myRepeater.currentItem.ICO N}')" click="displayId(event.target.getRepeaterItem())" mouseUp="categorySummarySelected(event.target.repe aterIndices[0])"/> [h]upSkin="@Embed(source='{myRepeater.currentItem.ICO N}')" [/h] but I am getting the following error: Implicit coercion of a value of type string to a type class. Thanks! |
| Sponsored Links |
|
|||
|
What does your PNG look like? If it is rectangular try this...
<mx:Button id="mybttn" label="Click Me" overSkin="@Embed(source='PathToPNG/filename1.png') " upSkin="@Embed(source='PathToPNG/filename2.png')" downSkin="@Embed(source='PathToPNG/filename3.png') "/> If the PNG is a strange shape...like the shape of Texas... There is a little more to it. Let me know and I can walk you through the other way. |
|
|||
|
If I give the file name it works but thats not what I am looking for. The file
name is provided by the data provider and the button is inside a repeater. Each button has a different image file which is provided by myRepeater.currentItem.ICON <mx:Repeater id="myRepeater" dataProvider="{catInfo}"> <mx:HBox id="bigbox"> <mx:Image id="img" source="{myRepeater.currentItem.ICON}"/> <mx:Button width="175" label="{myRepeater.currentItem.CATEGORYDESC}" data="{myRepeater.currentItem}" mouseOver="changeStyle(event)" upSkin="@Embed(source='{myRepeater.currentItem.ICO N}')" click="displayId(event.target.getRepeaterItem())" mouseUp="categorySummarySelected(event.target.repe aterIndices[0])"/> </mx:HBox> </mx:Repeater> Thanks! |
|
|||
|
"Merlyn MM" <webforumsuser@macromedia.com> wrote in message news:gd5llm$3l3$1@forums.macromedia.com... > If I give the file name it works but thats not what I am looking for. The > file > name is provided by the data provider and the button is inside a repeater. > Each > button has a different image file which is provided by > myRepeater.currentItem.ICON > > > <mx:Repeater id="myRepeater" dataProvider="{catInfo}"> > <mx:HBox id="bigbox"> > <mx:Image id="img" source="{myRepeater.currentItem.ICON}"/> > <mx:Button width="175" label="{myRepeater.currentItem.CATEGORYDESC}" > data="{myRepeater.currentItem}" mouseOver="changeStyle(event)" > upSkin="@Embed(source='{myRepeater.currentItem.ICO N}')" > click="displayId(event.target.getRepeaterItem())" > mouseUp="categorySummarySelected(event.target.repe aterIndices[0])"/> > </mx:HBox> > </mx:Repeater> An embed is just that. it _embeds_ the file. At compile time. I.e. the compiler has no idea what the value will be in your running file. You might want to look at my TileList_withStyleFunction to get some inspiration on how to handle this situation: http://flexdiary.blogspot.com/2008/0...efunction.html |
|
|||
|
Amy
Thanks for your help. Since I do not know the image files upfront to embed them like in your example. This is what i did and its not correct. Can you please guide me further? private function styleFunction(repeaterItem:Object):Class{ var btnIcon:Class = repeaterItem.ICON; return btnIcon; } <mx:Button width="175" label="{myRepeater.currentItem.CATEGORYDESC}" data="{myRepeater.currentItem}" mouseOver="changeStyle(event)" upSkin="@Embed(source=styleFunction(event.target.g etRepeaterItem()))" click="displayId(event.target.getRepeaterItem())" mouseUp="categorySummarySelected(event.target.repe aterIndices[0])"/> [h] upSkin="@Embed(source=styleFunction(event.target.g etRepeaterItem()))"[/h] |
|
|||
|
"Merlyn MM" <webforumsuser@macromedia.com> wrote in message news:gd5uat$ec5$1@forums.macromedia.com... > Amy > > Thanks for your help. Since I do not know the image files upfront to embed > them like in your example. This is what i did and its not correct. Can you > please guide me further? > > private function styleFunction(repeaterItem:Object):Class{ > var btnIcon:Class = repeaterItem.ICON; > return btnIcon; > } > > <mx:Button width="175" label="{myRepeater.currentItem.CATEGORYDESC}" > data="{myRepeater.currentItem}" mouseOver="changeStyle(event)" > upSkin="@Embed(source=styleFunction(event.target.g etRepeaterItem()))" > click="displayId(event.target.getRepeaterItem())" > mouseUp="categorySummarySelected(event.target.repe aterIndices[0])"/> > [h] > upSkin="@Embed(source=styleFunction(event.target.g etRepeaterItem()))"[/h] > http://www.magnoliamultimedia.com/fl...s_Flex_FAQ.pdf Q 11 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise