ThinkDigit Home
Subscribe to the Newsletter
Search
 
SKOAR!       / SHOPPING
 
 
News / Features / Downloads / Channel 5
 
 
Creating an image gallery app with Flash Builder 4 in 10 steps
 
Posted by
Kshitij Sobti
3
568
Posted on: Jul 01, 2010 22:17:13 IST

 
 
 

STEP 5: Now we add the list. Inside the <s:Application> – if you created a web project – or the <s:WindowedApplication> – if you created a Desktop application – add the List element.

<s:List  id="imagesList"  dataProvider="{index}" width="100%"  height="100%"  >
<s:layout>
<s:TileLayout  />
</s:layout>
</s:List>

 

This creates a list inside our application which has an id / name imagesList, and fills up to take 100% of the width and 100% of the height of the application. The <s:TileLayout /> tag inside the <s:layout> tag specifies that the list will display content in a tiled layout, as rows and columns of images.

The 'dataProvider="{index}" ' bit is telling the list to use the “index” object we defined earlier as the source for populating this list. The list will automatically create one list item for each image in the index. It will automatically handle displaying and scrolling in the list. Right now however the list is not geared to handle images, it will simply display informaiton about each image as text.

The list will right now display the XML data associated with each image in a list.

 

STEP 6: What we need to add to this list, is an item renderer. As the name suggests, an item renderer defines how each item in the list is to be rendered / displayed. You can create complicated structures with multiple controls and set it as an itemrenderer for a list. You could for example actually create an image editor, and put it as an item renderer to have an editable image gallery! We will however do something much simpler. We will add the following inside the list declaraiton:

<s:itemRenderer>
<fx:Component>
<mx:Image  source="{data.itemThumbnailImage}"  />
</fx:Component>
</s:itemRenderer>

Usually you will declare an item renderer in a separate file and provide that to the list, however this example is simple enough for an inline declaration. We are defining the Image component as the item renderer for the list.

The list passes the data associated with each list item, i.e. the contents of the <image> tag to the each item in the list as the “data” object. The image to be used for each list item is then accessible through data.itemThumbnailImage. This property as you can see from the XML format of the index file, has the releative path to the thumbnail of the image.

After adding this, you will notice that you can already see a gallery by running the project!

A running gallery already!

 

Right now though, you cannot view any images in their full-sized versions, which seriously hampers the usability of the gallery.

< Previous
  |  
Next >
 
To discuss this article visit its forum entry here

 






 
 
 
Latest Features
 
 
 
 
Comments 3comments
 
Posted by Frinnaravease on Dec 17,2011
 
Today, considering the Canada Goose Jacket fast life-style that everyone is having, credit cards have a big demand in the economy. Persons throughout every arena are using the credit card and people who not using the credit cards have lined up to apply for one in particular. Thanks for sharing your ideas about credit cards. In these days of austerity and relative stress and anxiety about having debt, some people balk contrary to the idea of making use of a credit card to make acquisition of merchandise and also pay for a holiday, preferring, instead just to rely on the actual tried along with trusted way of making payment - raw cash. However, if you possess the cash on hand to make the purchase fully, then, paradoxically, that is the best time for them to use the card for several motives. One thing is that often one of the most typical incentives for making use of your cards is a cash-back or rebate supply. Generally, you'll get 1-5% back for various purchases. Depending on the credit cards, you may get 1% back again on most expenses, and 5% in return on expenditures made from convenience stores, gas stations, grocery stores and also 'member merchants'. Thanks for these guidelines. One thing I should also believe is that often credit cards supplying a 0% rate often entice consumers along with zero rate, instant authorization and easy internet balance transfers, however beware of the main factor that may void your own 0% easy neighborhood annual percentage rate as well as throw you out into the bad house quickly. Thanks for your concepts. One thing we have noticed is banks in addition to financial institutions have in mind the spending patterns of consumers as well as understand that most of the people max outside their cards around the vacations. They properly take advantage of this Canada Goose Jacket fact and start flooding your inbox and snail-mail box along with hundreds of Zero APR card offers shortly when the holiday season closes. Knowing that when you are like 98% of the American public, you'll leap at the one opportunity to consolidate personal credit card debt and switch balances to 0 apr interest rates credit cards.
 
Posted by Fusswipsper on Dec 15,2011
 
Thanks for the ideas timberland shoes you have shared here. In addition, I believe there are numerous factors that keep your car insurance policy premium lower. One is, to consider buying autos that are inside the good set of car insurance businesses. Cars that happen to be expensive tend to be more at risk of being lost. Aside from that insurance is also depending on the value of your automobile, so the more costly it is, then higher the particular premium you pay. I have observed that car insurance organizations know the automobiles which are susceptible to accidents along with other risks. Additionally they know what type of cars are susceptible to higher risk plus the higher risk they've already the higher the premium charge. Understanding the straightforward basics connected with car insurance will let you choose the right kind of insurance policy timberland boots uk that will take care of your needs in case you become involved in an accident. Many thanks for sharing the particular ideas with your blog. Thanks alot : ) for your post. I would really like to say that the expense of car insurance varies greatly from one insurance plan to another, simply because there are so many different issues which give rise to the overall cost. One example is, the make and model of the motor vehicle will have a significant bearing on the price tag. A reliable old family car will have a lower priced premium compared to a flashy sports vehicle. Thanks for the several tips provided on this website. I have observed that many insurance firms offer timberland boots customers generous savings if they favor to insure several cars with them. A significant quantity of households have several cars these days, especially those with more aged teenage young children still residing at home, plus the savings upon policies can certainly soon begin. So it makes sense to look for a great deal. One thing I'd like to say is that car insurance cancelling is a horrible experience and if you're doing the right things being a driver you'll not get one. Some people do get the notice that they have been officially dumped by their own insurance company and many have to scramble to get added insurance from a cancellation. Inexpensive auto insurance rates are usually hard to get after the cancellation. Understanding the main reasons concerning the auto insurance canceling can help motorists prevent completely losing in one of the most crucial privileges out there. Thanks for the tips shared by means of your blog.
 
Posted by Josh on Jul 29,2010
 
I'm on step 5, just trying to get xml data to display in my list. Nothing appears. I don't know how to tell that my app is properly connecting/seeing/pulling from my xml file. Do I need to create a data service? If so an XML or HTTP service? I notice you have not yet your list still pulls the data from the xml file
 
 



 
 

 
 
 
 
Newsletter Subscription
 
 
 
 
 
 
 
 
 
 
 
 
 
 
http://devworks.thinkdigit.com