Flash Catalyst – Skin a custom DataList

I myself being a designer, designing a custom skin for a List component has always been a little difficult. Experiencing Adobe Flash Catalyst was overwhelming from a designer’s perspective. To make this obvious, I am presenting a simple way of creating a fairly cool looking list box (DataList) component using Adobe Flash Catalyst 1.0.

Download

You may download this project file for reference.

Download
(6533 downloads)

Preview

This is what we will create following this tutorial.

DataList Skin
(Image)


Get Adobe Flash player

(Interactive SWF)

Prerequisites

This tutorial requires you to have Adobe Flash Catalyst 1.0 Installed.

Overview

DataList as a component requires 2 main components. One being Repeating Item, the other being a Vertical Scroll bar. There are also other innovative ways of having a list control. This tutorial covers the skinning of a standard vertical list box with custom item (with a title, description and thumbnail placeholder) and a custom looking vertical Scroll bar.

Creation of the DataList UI

Let’s jump in to the steps of creating the component. We start off by drawing simple vector rectangles and filling them with different colors and gradients with some filters. We begin by creating a new Flash Catalyst Project as shown below: -

New Flash Catalyst Project

Adobe Flash Catalyst has a Toolbox when in Design workspace. A screen shot of the same is shown below: -

Design Workspace Toolbox - Rectangle Tool

Choose the Rectangle tool and draw a rectangle of 351 x 351 pixels. All the dimensions I draw in my user interface are just my choice and are not necessarily a compulsion. You may feel free to have your own dimensions.

Rectangle

As you can see, it is just a very simple rectangle, which is not very aesthetic. Let us try and make it look better by adding a Fill Color and an appropriate Stroke color.

Filled Rectangle Filled Rectangle Properties

The properties of the above rectangle is as shown. Fill Color = #CCCCCC, Stroke Color = #DDDDDD.

This is the canvas that we drew here that holds the repeating items of the DataList. Do not worry about the behavior of the component just yet. We are trying to create a nice look for our DataList. We shall arrive in steps that convert the artwork to component in just a while. Now we shall create a List Item rectangle. Repeat the same process of creating a rectangle, place it inside the canvas rectangle as shown below. The properties of the item rectangle is also shown. Fill Color is a gradient from #CCCCCC to #ADADAD. Stroke Color is #A8A8A8.

List Item UI List Item Rectangle Properties

To give it more effect and life, let us draw another rectangle just inside the one above and give it an inner outline effect. The output and properties of this rectangle is displayed below. Stroke Color is #EFEFEF.

Enhanced Item Rectangle Enhanced Item Rectangle Properties

Assuming we have a List Item background graphic, we shall draw a couple of Text Boxes that will represent Labels of the ListItem component. Use the Text Tool to insert a text field on the rectangle. Later, we also apply a subtle Drop Shadow filter using the Filters panel.

Text Tool List Item UI with a Title
List Item Title Text Properties List Item Title Drop ShadowDrop Shadow Properties

We shall add another Text Field on the List Item graphic that will represent the description or metadata of the list item. Make the description text field a little smaller and give it an opacity of 75% to make it look a little dark compared to the title.

Add Description Text Field

Let’s now draw a rectangle that should act as a place holder for thumbnail of the list item. Fill Color is #FFFFFF with an opacity of 30%.

Final UI of List Item

We can finally freeze the UI of the List Item as it is completely done. It is now time to create a vertical scrollbar for our DataList.

Creating Vertical Scrollbar

It amazes to know how easy it is to create a scrollbar in Adobe Flash Catalyst. It is just a matter of drawing 2 rectangles. Draw a rectangle with a width of 7 px and a height of 330 px. Give it a corner radius of 4 px. Fill it with a color #999999. Also give it a slight inner shadow. The properties panel below shows the DropShadow parameters.

Drop Shadow Properties

This is how the UI should look like now.

UI

We are done creating the “Track” for the scrollbar. Let us now create the “Thumb” component of the scrollbar. This should be fairly simple as it is just a 7×66 pixels rectangle with 4 corner radius and fill color #333333. Place it just on top of the previous “Track” rectangle.

This is how it should look finally.

Final UI

Now is when we have the complete design of how our List component has to look like. Let’s go ahead and convert the non-intelligent design to a working flex component.

Just for your reference, the CODE for the above skin we created is shown below. It is however not a good idea to make modifications to this.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:fc="http://ns.adobe.com/flashcatalyst/2009" backgroundColor="#FFFFFF" height="600" preloaderChromeColor="#FFFFFF" width="800">
	<fx:Style source="Main.css"/>
	<fx:DesignLayer d:userLabel="Layer 1">
		<s:Rect height="350" radiusX="0" width="350" x="49.5" y="49.5">
			<s:stroke>
				<s:SolidColorStroke caps="none" color="#CCCCCC" joints="miter" miterLimit="4" weight="1"/>
			</s:stroke>
			<s:fill>
				<s:SolidColor color="#DDDDDD"/>
			</s:fill>
		</s:Rect>
		<s:Rect height="65" radiusX="0" width="330" x="59.5" y="59.5">
			<s:stroke>
				<s:SolidColorStroke caps="none" color="#A8A8A8" joints="miter" miterLimit="4" weight="1"/>
			</s:stroke>
			<s:fill>
				<s:LinearGradient rotation="90">
					<s:GradientEntry alpha="1.0" color="#CCCCCC" ratio="0"/>
					<s:GradientEntry alpha="1.0" color="#ADADAD" ratio="1"/>
				</s:LinearGradient>
			</s:fill>
		</s:Rect>
		<s:Rect alpha="0.4" height="63" radiusX="0" width="318" x="60.5" y="60.5">
			<s:stroke>
				<s:SolidColorStroke caps="none" color="#EFEFEF" joints="miter" miterLimit="4" weight="1"/>
			</s:stroke>
		</s:Rect>
		<s:RichText color="#FFFFFF" fontFamily="Myriad Web Pro Bold" fontSize="14" tabStops="S0 S50 S100 S150 S200" text="Item Title" width="238" x="133" y="71">
			<s:filters>
				<s:DropShadowFilter alpha="0.25" angle="45.0" blurX="1" blurY="1" color="0x000000" distance="1" hideObject="false" inner="false" knockout="false" quality="2" strength="1"/>
			</s:filters>
		</s:RichText>
		<s:RichText alpha="0.75" color="#FFFFFF" fontFamily="Myriad Web Pro" fontSize="12" height="28" tabStops="S0 S50 S100 S150 S200" text="Item Description or Metadata" width="238" x="133" y="91"/>
		<s:Rect alpha="0.3" height="57" width="57" x="63.5" y="63.5">
			<s:stroke>
				<s:SolidColorStroke caps="none" color="#FFFFFF" joints="miter" miterLimit="4" weight="1"/>
			</s:stroke>
			<s:fill>
				<s:SolidColor color="#FFFFFF"/>
			</s:fill>
		</s:Rect>
		<s:Rect height="330" radiusX="4" width="7" x="386" y="59">
			<s:fill>
				<s:SolidColor color="#999999"/>
			</s:fill>
			<s:filters>
				<s:DropShadowFilter alpha="0.4" angle="45.0" blurX="2" blurY="2" color="0x000000" distance="1" hideObject="false" inner="true" knockout="false" quality="2" strength="1"/>
			</s:filters>
		</s:Rect>
		<s:Rect height="66" radiusX="4" width="7" x="386" y="59">
			<s:fill>
				<s:SolidColor color="#333333"/>
			</s:fill>
		</s:Rect>
	</fx:DesignLayer>
</s:Application>

Adding Intelligence

In order to convert the artwork to components, we need to start from the inside of the component and move out hierarchically. If and once we convert the whole artwork in to a DataList component, it is hard to convert the scrollbar to a Vertical Scrollbar component. Hence, we shall start by creating the scrollbar component.

Each component has a group of elements that need to be present. Some elements are always marked *required* and are compulsory. Some are optional. For instance, the Vertical Scrollbar component has the Track and Thumb compulsory. The up and down arrow buttons are optional. I shall demonstrate converting only the required elements since we haven’t drawn the up and down arrows.

For this, start by selecting the required components for the Vertical Scrollbar, Track and Thumb. You should see a panel on the screen that will allow you to convert the artwork into components. You can find the panel in the menu – Window > HUD (F7). Choose the dropdown that says “Convert Artwork to Component” and select “Vertical Scrollbar” as shown below: -

Convert Scrollbar

Now both Track and Thumb artwork seem like a single object and is converted into Vertical Scrollbar component. The HUD panel shows that you can now edit the parts of the component. Go ahead and click the “Edit Parts” button.

Scrollbar Edit Parts

We need to specify Flash Catalyst the different parts of our component. In this case, the mandatory Track and the Thumb. Now go ahead and select the artwork for Track, i.e., the longer rectangle. Choose the dropdown in the HUD panel and select “Choose Part” under “Convert to Vertical Scrollbar Part” section and select “Track”.

Convert Track

Follow similar steps by selecting the Thumb artwork, i.e., shorter rectangle and convert it to Thumb under the HUD.

Convert Thumb

It is time to convert the whole artwork we did to a DataList component. Click on the “DataListSkin” on breadcrumbs that is on top left as shown below to move to the root of the artwork so we can select the rest of the artwork.

Breadcrumbs

Now select all the artwork (HUD should show “7 Items”). Select “Choose Component” under “Convert Artwork to Component” on the HUD and choose “DataList” component.

Convert to DataList

Just as we did with the scrollbar, we need to now specify the parts of the List component. The artwork should appear as a single element on the screen and HUD should show a button “Edit Parts”. Go ahead and click it.

Edit DataList Parts

If you have observed in the above screen shot, the dark gray rectangle that represents the background of our item is stretched a little horizontally, to touch the scrollbar. This happened to maintain the same spacing around the item and the background box. We need to fix that. Select the rectangle that is stretched.

ListItem Background Selection

Use the properties panel to reduce the width to -10 of what it is. According to our dimensions, I choose 321px for width. One very important thing to note is, there are multiple “States” inside the DataList component and we made this fix in one of the states. We need to make this change affect all other states. Do not make this change manually in all states. Instead, as soon as you reduce the size in the current state, a button appears in the HUD panel that says “Make Same in All Other States”. Click the button.

Make Same in All Other States

Now that we have fixed the artwork width, let us specify what should comprise the item. The only required element inside a DataList component is called the “Repeated Item”. As per our design, the repeated item is the 2 rectangles for the background, title text of the item, description text and the thumbnail rectangle. Select these 5 elements and in the HUD, choose “Choose Part” under the “Convert Artwork to Component”. Select “Repeated Item”.

Artwork for Repeated Item Selected

Choose Repeated Item

Ah! You should now be seeing the item repeated 5 times below.

Repeated Item

Adobe Flash Catalyst by default repeats the Repeated Item 5 times. This can be modified later by adding/editing/deleting the items. Below the screen, you should find a panel “Design-Time Data”.

DesignTime Data

By clicking on the “Add Row” and delete buttons below in the panel, you can add or delete rows for design time reference and also edit the contents of each text field that your repeated item contains inline under the Design-Time Data panel. We may now do a Ctrl+Enter (Windows) or Cmd+Enter (Mac) to test our List component in the browser. The component should show the number of rows you added in the Design-Time Data panel and the scrollbar should work as expected. A major part of our component creation is finished.

However, we can notice that the mouse-over of an item and the selected item doesn’t look as per our liking as Adobe Flash Catalyst by default adds what it calls “Highlight Rectangle” above the list items to give it a mouse-over effect and selected item effect. This could work out for some designs. But we shall explore how to customize the UI for these states as well.

Mouse Over Default UI

As explained before in this article, we have different states for each component. It is obvious to have similar states for our DataList component as well. The states are “Normal”, “Over” and “Selected” states.

DataList Component States

We can customize the UI of our elements in the component by navigating to the particular state. Go ahead and click the “Over” state to customize it.

Over State

Click on the artwork to select a “Highlight Rectangle” and delete it since we are modifying the rectangles that we created.

Highlight Rectangle

Select the back rectangle of the item and fill it with a darker gray and a darker outline. Fill gradient should be #999999 to #666666 and Stroke color shall be #666666.

Over State Artwork Over Artwork Properties

Save your .fxp file and test the content. You should see the darker item graphic for the mouse-over state.

Mouse Over UI

Go ahead and repeat similar steps to customize the “Selected” state of your list item and fill it with a gradient from #000000 to #333333 and give it a stroke color of #000000. Darken the description text field in the “Selected” state to color #999999.

Selected State Customization

This is what we get after the customization.

Final Output

Test and run the content that you created. This is pretty much it. We can now import this custom skinned component to Flash Builder and bind the data we require. Hope you enjoyed creating this custom skin.

Happy Skinning! :)

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
Flash Catalyst - Skin a custom DataList, 5.0 out of 5 based on 1 rating

  • vcvfxdesign

    hello i ve been following your tutorial so helpfull cheers or u
    i have a doubt how can ilimit the number of times the “repeated item ” repeats because i m making a menu
    the scrooll works fien but it go without limit it can go to million times scroling i wish u can help me to limit this
    thanks by reading :D

    hoep to hear soon about it

  • http://www.hsharma.com Hemanth Sharma

    Hi

    Thanks for reading. This is just a tutorial to skin a Data List component in Flash Catalyst. You can limit the number of items you populate in the list box in your Flex project that uses this component. That is, when you populate the list box, make sure you don’t have your DataProvider more than your desired number of elements.

    Hope this helps.

    - h

  • Ankush

    Awesome

  • Tom Simon

    Very nice. Do you work for Adobe?

  • http://www.hsharma.com Hemanth Sharma

    Thanks Ankush, Tom. Yes. I work for Adobe.

    - h

  • Tom Simon

    Hemanth. Thank you for such a helpful tutorial. I have been architecting flash loader portals for many years, That is portals where I had to build containers to instantiate composited flash files from a modeler framework. This was long before the CS5 integrated suite – so now I see there are the tools that will make this easier. Presently I am working on a puremvc/flex(flash4) framework using LiveCycle for data binding. This has been challenging work but shows great promise. I am very much committed now to Adobe’s vision – so very much appreciate the tutorials.

  • http://www.hsharma.com Hemanth Sharma

    Thanks Tom… All the best with your work. Do drop us a mail in case you face technical issues. We will be happy to try and point you to a probable solution. :)

    - h

  • Mark

    Hemanth, thanks for the excellent tutorial! I took your example and modified it for my purposes and am really happy with the result.

    My question is -

    how do I connect my List in Flash Builder so that it displays using the new DataListSkin?

    (I’m still very new to flex, FB, FC, etc.)

    again, many thanks!

  • http://www.hsharma.com Hemanth Sharma

    Hi Mark,

    Thanks for using the tutorial. I am a little held up at the moment for one of our summits (www.adobesummit.com). But do expect a video tutorial on your doubt soon… :)

    Hope it helps!

    - h

  • Shweta

    Can this be used with Android platform?

  • http://www.hsharma.com Hemanth Sharma

    I guess not Shweta… Check out “Hero” SDK preview release.

    - h

  • Julien A.

    Hello,

    Thank you for this nice tutorial, I did managed to create quite a good datalist, but I’d like now to make each line link to a specific URL…

    And I just can’t find how to do it.

    I’d like to be able to click on each line so as to go to a specific url, I hope I’m clear. Could you tell me how to do that ?

    Thank you a lot.

    Julien

  • http://www.hsharma.com Hemanth Sharma

    Thanks Julien.

    You will need to do that in Flash Builder using Flex and ActionScript. Just import this skin into a new Flex Project and add < ... change="onListChange(event)"> event listener to your list. Inside the onListChange method, call a navigateToURL method.

    Hope this helps.

    - h

  • PRinCE

    Ok, first of all, pls tell me the difference between the scrollbar and slider…. i used a slider and the dataitem to make the datalist. so now i have ‘repeated items’ which i can edit from design-time data and a vertical slider.
    this data list is to act as a menu for a simple website. so next, i added interaction to the datalist to play transition to appropriate pages on selection of appropriate item[index] of the datalist.
    I run the project, and i get the datalist. i clicked the items and they work properly. but the trouble is that my list has 7 items and the list shows only 3. the remaining are to become visible when i use the slider, but for some reason, the slider works coz when i move its thumb, its ‘indexnumber??’ seems to change like 1.0-2.0…. upto 10.0, which i think means the slider is working but the dataitems are not linked and do not move according to the slider….

    so how do i sort this out??? is it absolutely necessary to use a scrollbar for a list? same case happens when i tried to make a multiline scrollable textbox with slider. when i used scrollbar, the text scrolls… but slider doesnt make the text scroll. i did convert them to scrollpanel and selected the text as scrollable content in both cases. so whats the deal with the slider?

  • http://www.hsharma.com Hemanth Sharma

    Prince,

    Slider should ideally be used for volume controls, media player seek bar, etc. Scrollbar should be used for scrolling. Not sliders. Since Catalyst allows you to skin these two components very well, I don’t see a reason why you should use a Slider for scrolling a DataList.

    - h

  • PRinCE

    another doubt too…

    how do i make an image gallery with catalyst???
    the idea is to build a datalist showing the thumbnails of the images and clicking on a thumbnail should show that image in big size. the question is, how can i assign thumbnails dynamically? i mean if i wanted to update the images in the gallery and i had to add new images and remove old ones so that the number of image changes, will the datalist reflect the change appropriately on its own? or do i have to manually assign the dataitems??? how can i make the dataitems take their data from say, and xml file which lists all the images in the gallery folder??? if so, all i need to do would be to update the xml and the rest would be done automatically… how to do this? also, i dont want to use lightbox…rather, i would like to build someting similar to it from scratch… so i can make the boxes and the buttons and stuff. so say, i have this big rectangle named ‘image_holder’ on the page but how to load the image into ‘image_holder’??? this too has to be dynamic like linking to an xml file or something….

    please do help me, plz plz plz…..

  • http://www.hsharma.com Hemanth Sharma

    Prince,

    Do use the DataList component and instead of “Vertical” layout in the Properties panel, choose “Tile” and specify your desired alignment and direction of items. Consider each repeated item of that DataList as the thumbnail inside the gallery. The DataList itself becomes the gallery.

    You need to import the FXP file to Flash Builder and add dynamic XML loading, etc. to the UI in Flex. Flash Catalyst is just a skinning and prototyping tool. Not to be considered a replacement of Flash Builder.

    - h

  • CBM

    Hi there, just wondering, i have made an image gallery but i want to be able to click on a thumbnail which will take me to another state. Is there a way to do this with scripting??
    Thanks heaps

  • Slawek

    HI, PLEASE CAN ANY ONE HELP. I designed data list with pictures gallery. I want horizontal and vertical pictures but when I apply vertical ones system stretch the vertical picture.

  • http://www.hsharma.com Hemanth Sharma

    Can you share your code and be more detailed?

    - h

  • Slawek

    In Adobe Catalyst I converted horizontal pic to data list to create photo gallery and everything work fine but when I trying to import vertical picture system stretch that pic to horizontal size in that photo gallery. Code is very long.
    thx for help.

  • Slawek

    In another way is it possible to create data list photo gallery in Catalyst with vertical and horizontal pictures?

  • http://www.hsharma.com Hemanth Sharma

    Slawek, with this much of info, it is really not possible to understand. Can you upload your code files and give me the link so I can take a look at it?

    - h

  • http://www.hsharma.com Hemanth Sharma

    This is very much possible… I need the source to show you how. If not the complete source, can you mail me the mxml + AS code from the gallery file?

    - h

  • http://mofreego.com Simon Edwards

    Hi there. Loved this tutorial, very simple to follow and best explanation I’ve read to date on building datalists. Many thanks and keep up great work ;-D

  • http://www.hsharma.com Hemanth Sharma

    Thanks Simon!

    - h

  • http://www.CosmicCowboy.com Mark Embrey

    Hi Hemanth -

    I really appreciate your work here! My only difficulty (with Flash Catalyst in general) is that the resulting file size can be HUGE!

    Can you offer any tips for paring down the file to its’ minimum size?

    thanks,

    Mark

  • http://www.hsharma.com Hemanth Sharma

    Hi Mark,

    All I can think of is try not to use raster images in the artwork. Bitmaps add more for file size and Vector images add more for processing. So, try and use a balanced mixture. Hope this tip helps.

    - h

  • Jack Viers

    So is there any way to have repeated items that change size based on state without the bounding box reserving size for the final state? For example, I want the repeated item to be 40 pixels tall in the normal state, and 200 pixels tall in the selected state. and I want the following repeated item to be directly below the previous repeated item without there being blank space for the additional pixels for the selected state.

  • Raghu

    Hi Hemanth,

    I was wondering what is the best way to use this DataListSkin in my flex application?

    Can we get one single fxg file out of this skin & use as a single component in my flex application?

    Thanks,
    Raghu.

  • http://www.hsharma.com Hemanth Sharma

    Raghu,

    Any skin you create in Flash Catalyst becomes an FXP file (Flex Project) file. This is not a skin file. It is a Flex Project. Now you can create a new Flex Project by using Import in Flash Builder. The only difference is that when you import, you set the start point of your Flex Project to the FXP that Flash Catalyst creates. I hope I answered your question.

    I would recommend creating different FXP’s for different component skins (just to keep it simple and organized and separate) and later, import them into separate projects. After this, copy and use only the necessary skin files, organize paths to assets as required neatly in the main project you are working on. Later, I would delete the Flex Projects I created by importing the FXP files so my workspace is cleaner and my main app Flex Project contains the skins I manually merged. I would however retain and preserve the original FXP files I created in Flash Catalyst.

    Another way is to just create one FXP with all component skins. Import it into an app (which will be the main Project Flex App) in Flash Builder and work things out.

    It really depends on each project type. Additionally, explore the “Flash Catalyst Enabled Flex Project” introduced in the latest Flash Builder.

    - h

  • http://www.hsharma.com Hemanth Sharma

    Jack,

    It is possible to have only the active item scale up in its size. It is very easily done. However, this isn’t possible in Flash Catalyst.

    > Create a Flash Catalyst project and DataList component skin.
    > In the “Selected” state of each ItemRenderer of the DataList you created, expand the height of the item to the desired height.
    > Save FXP and import it as a new Flex Project in Flash Builder.
    > Open the YourDataListItemRenderer.mxml file.
    > The top most tag of the item renderer will have the height specified. This is the height your artwork for the item renderer had in Flash Catalyst. Just remove the height=”xxx” parameter.

    This should work as you expect. :)

    - h

  • Raghu

    Hemanth, thanks… am clear now… Enjoy !!

  • Raghupathi Reddy

    Hemanth,

    The scroll bar skin in this example is of fixed height. Is it possible to make the height of the scroll bar as 100%?

  • http://www.hsharma.com Hemanth Sharma

    Raghu,

    1. Once you move your FXP to Flash Builder into a Flex Project, in your DataList1Skin.mxml file, you should have the Scrollbar components (e.g., ). Add a parameter – fixedThumbSize=”false” to that.

    2. In the DataList1ScrollBarThumb.mxml (or the thumb skin file that you would have), make the height of to 100%.

    - h

  • Pingback: Can someone please tell me how to make a photo gallery in flash catalyst? | Photo Gallery