Adobe Dreamweaver Forums



Last 10 THreads :         Live stream player (Last Post : noobie_here - Replies : 0 - Views : 1 )           »          cfloop within a cfif tag (Last Post : Azadi - Replies : 2 - Views : 3 )           »          Making constraints on a symbol... (Last Post : sirkibble2 - Replies : 0 - Views : 1 )           »          Creating a boundry in the stage... (Last Post : fazstp - Replies : 2 - Views : 3 )           »          Director or Flash? (Last Post : Sean Wilson - Replies : 1 - Views : 2 )           »          DW8 Activation not working (Last Post : moonliner - Replies : 0 - Views : 1 )           »          Re: Mouse capture won't activate (Last Post : robertnagle - Replies : 0 - Views : 1 )           »          help! my FB3 has gone insane! (Last Post : peteandrus - Replies : 0 - Views : 1 )           »          help! my FB3 has gone insane! (Last Post : peteandrus - Replies : 0 - Views : 1 )           »          How come the html is being displayed, and not the link (Last Post : Skaterstu - Replies : 0 - Views : 1 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 10-15-2008, 09:11 PM
Merlyn MM
 
Posts: n/a
Diggs:
Default button skin

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!



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-15-2008, 09:50 PM
cputnam14
 
Posts: n/a
Diggs:
Default Re: button skin

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.


Reply With Quote
  #3 (permalink)  
Old 10-15-2008, 10:12 PM
Merlyn MM
 
Posts: n/a
Diggs:
Default Re: button skin

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!

Reply With Quote


  #4 (permalink)  
Old 10-15-2008, 11:15 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: button skin


"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


Reply With Quote
  #5 (permalink)  
Old 10-16-2008, 12:30 AM
Merlyn MM
 
Posts: n/a
Diggs:
Default Re: button skin

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]

Reply With Quote
  #6 (permalink)  
Old 10-16-2008, 04:56 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: button skin


"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


Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 02:35 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk