Adobe Dreamweaver Forums



Last 10 THreads :         Truncate text? (Last Post : Handycam - Replies : 0 - Views : 1 )           »          security violation connecting to socket (Last Post : SoxFan33 - Replies : 1 - Views : 2 )           »          Please point me to the correct topic section of thisForum (Last Post : GillyWilly - Replies : 10 - Views : 11 )           »          Library is missing names from splitter bar (Last Post : Mad Dog - Replies : 5 - Views : 6 )           »          pdf question (Last Post : Joseph Kunz - Replies : 2 - Views : 3 )           »          Inserting .flv into Dreamweaver (Last Post : langeb22 - Replies : 0 - Views : 1 )           »          strange bugs (Last Post : fazstp - Replies : 1 - Views : 5 )           »          ADOBE - Forum search is broken (Last Post : Amy Blankenship - Replies : 1 - Views : 2 )           »          move tab with embedded image (Last Post : Amy Blankenship - Replies : 2 - Views : 3 )           »          Update cross domain policy (Last Post : SoxFan33 - Replies : 3 - Views : 14 )           »         


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-31-2008, 06:27 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-31-2008, 06:27 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-31-2008, 06:27 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-31-2008, 06:27 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-31-2008, 06:27 PM
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-31-2008, 06:27 PM
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 08:03 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk