Monday, May 08, 2006

Flex - Trabalhado com Arrays

Olá gente boa, ta difícil de arrumar tempo para escrever aqui, mas hora ou outra da pra tirar um tempinho sim.

Hoje eu aproveitei para escrever sobre Flex uma tecnologia excelente para desenvolvimento de aplicativos ricos os famosos RIA, nessa matéria eu vou mostrar como criar um aplicativo que ao selecionar o item num ComboBox exibimos sua foto, seu nome, seu preço e descrição.

Esta matéria é simples de fácil compreensão, é necessário ter o servidor Flex e o TomCat instalado.

Não vou perder tempo explicando oque é e pra que serve a tecnologia Flex pois entende-se que você já deva saber para acompanhar esta matéria.

Para reproduzir esta matéria você só precisará de um editor de códigos MXML, seja ele, o Flex Builder, Dreamweaver 8 com o devido Plugin ou o bloco de notas, vamos ao trabalho.

Como você deve saber o Flex tem um formato XML de se trabalhar então vamos começar nosso código com a declaração do nosso xml e após isso começamos com a tag Application sempre seguida do prefixo mx:

Veja um exemplo:

Bom vamos continuar desenvolvendo o nosso aplicativo criando o array com os itens que manipularemos:

Entre as tags inserimos o seguinte código:

Para criar nossos campos iniciamos com a tag mx:Panel , com essa tag criamos um painel onde ficará os campos acomodados, vejamos:

Usamos o atributo title para atribuir um título a nosso painel.

Dentro do bloco de tags Panel inserimos os demais itens de nosso aplicativo:

Iniciando pela tag com o atributo text, usamos essa tag apenas para informar oque o usuário deve fazer no aplicativo.

Como no XML podemos fechar as tags apenas inserindo um / no final da tag.

Para continuar criamos um comboBox e usamos o atributo dataProvider para recebermos os itens do array e ainda usamos o atributo id para nomearmos nosso comboBox o atributo width para informar-mos o tamanho de nosso item e usamos o atributo change para chamarmos a função que criaremos para inserir a descrição no campo referente.

Continuamos nosso aplicativo com mais uma tag label para informar a ação do novo ComboBox que criaremos para manipular a imagem do produto.

Neste ComboBox usamos o atributo change para chamar uma função que criaremos que manipulará o evento visible do atributo complete da nossa tag .

Dentro do ComboBox temos um array para gerar os itens do mesmo.

Em seguida usamos a tag mx:Image para receber a imagem do produto, temos nessa tag os atributos id onde inserimos um nome para manipular a imagem o campo source onde recebemos o item do array onde temos gravado o caminho da imagem.

O atributo complete define se a imagem irá aparecer ou não usamos esse atributo para interagir com o ComboBox de exibição da imagem.

O atributo complete está sendo manipulado pela função changeIMG(), continuamos na tag com os atributos windth onde registramos o tamamanho em pixel da imagem, o atributo alpha onde definimos a nitidez da imagem e os atributos mouseOut e mouseOver para interagir-mos com o usuário ao passar do mouse.

Para continuar usamos a tag para exibirmos o label e o preço do produto.

E por fim do nosso layout criamos um textArea para receber a descrição do produto selecionado através da função addProduto(), neste campo usamos o atributo load para carregar o item selecionado por default.

Vamos ver o código:

Agora que temos nosso layout montado vamos aos scripts que irão manipular os itens.

Para criar os scripts usamos a tag logo abaixo da tag , vamos ver:

Fazendo isso o nosso código está finalizado podemos testar e ver o resultado.

Baixe o código completo e as imagens aqui:

Arquivos para download

É isso ae gente espero que tenham gostado desta matéria bem simples mas bastante legal de seu fazer para estudar o Flex.

Até a próxima!

19 comments:

Anonymous said...

Bonjorno, metanoide.blogspot.com!
[url=http://cialisiall.pun.pl/ ]Acquisto cialis in Italia[/url] [url=http://viagraradj.pun.pl/ ]Compra viagra [/url] [url=http://cialisantr.pun.pl/ ]Vendita cialis online[/url] [url=http://viagrarier.pun.pl/ ]Compra viagra [/url] [url=http://cialistagh.pun.pl/ ]Acquisto cialis generico[/url] [url=http://viagraenat.pun.pl/ ]Compra viagra in Italia[/url]

Anonymous said...

singles group in sonoma county [url=http://loveepicentre.com/]totally free adult personals[/url] online dating services for farmers and ranchers http://loveepicentre.com/ new rap singles

Anonymous said...

auto audio [url=http://www.cardvdplanet.com/3-5-inch-tft-touch-screen-dvd-player-car0076--discount-price64.html]sony auto audio[/url] auto dvd video http://www.cardvdplanet.com/car-radio-with-usb-sd-mmc-card-cd151--discount-price49.html ho auto audio
videovisor auto dvd visor [url=http://www.cardvdplanet.com/8-5-inch-tft-lcd-touch-screen-car-dvd-player--discount-price106.html]car audio systems integrated ford falcon[/url] beststuff fuel car dvd ipod vacation houseboat lake powell home http://www.cardvdplanet.com/car-dvd-player-4inch-tft-lcd-touchscreen--discount-price25.html car audio for the scion xb
beststuff fuel car dvd ipod vacation houseboat [url=http://www.cardvdplanet.com/1-din-car-dvd-player-7-inch-tft-tv-tuner-cd074--discount-price78.html]auto dvd players[/url] adjusting a pioneer auto dvd http://www.cardvdplanet.com/all-region-7-inch-tft-lcd-touchscreen-dvd-with--discount-price110.html discount auto audio

Anonymous said...

tea length black cocktail dress [url=http://usadrugstoretoday.com/disclaimer.htm]Online Pharmacy - Safe, Secure, Prescriptions Guaranteed[/url] pill identifiers http://usadrugstoretoday.com/products/hyaluronic-acid.htm west acton pharmacy http://usadrugstoretoday.com/products/tentex-royal.htm
health care cost by gdp [url=http://usadrugstoretoday.com/products/lopid.htm]lopid[/url] severed penis [url=http://usadrugstoretoday.com/index.php?lng=uk&cv=po]how to do an anorexia diet[/url]

Anonymous said...

http://healthboard.in/clomipramine/clomipramine-erowid
[url=http://healthboard.in/diabetic]can drugs make you blind[/url] legal definition of distribution illicit drugs [url=http://healthboard.in/budesonide/buy-budesonide]buy budesonide[/url]
burton health care nursing home in ohio http://healthboard.in/decadron/steroid-decadron
[url=http://healthboard.in/cymbalta/symptoms-of-too-much-cymbalta]amcal pharmacy[/url] police drug unit uk [url=http://healthboard.in/diamox/diamox-and-attitude-sickness]diamox and attitude sickness[/url]
students give teacher daterape drug orgy on webcam porn http://healthboard.in/colchicine/colchicine-cell-assay
[url=http://healthboard.in/candesartan/candesartan-for-headaches]russian prescription drugs[/url] purchase altace online rolipram pharmacy [url=http://healthboard.in/bodybuilding/bodybuilding-clips-all-male]bodybuilding clips all male[/url] drug screen levels [url=http://healthboard.in/dexamethasone/how-long-does-dexamethasone-stay-in-your-system]how long does dexamethasone stay in your system[/url]

Anonymous said...

http://online-health.in/bactroban/diflucan-bactroban
[url=http://online-health.in/antabuse/drinking-non-achcolicj-beer-on-antabuse]pregnancy and medicine[/url] federal or state jurisdictation for drug offenses [url=http://online-health.in/anastrozole/arimidex-anastrozole]arimidex anastrozole[/url]
shewing viagra http://online-health.in/avodart/avodart-stops-working
[url=http://online-health.in/biaxin/is-biaxin-the-same-a-pennicillin]generic male impotence drugs[/url] example of on how to manage the price of drugs in pharmacy [url=http://online-health.in/bactroban/bactroban-nasal-for-mrsa-prophylaxis]bactroban nasal for mrsa prophylaxis[/url]
shoppers drug mart hours http://online-health.in/aristocort/aristocort-forte
[url=http://online-health.in/avodart/generic-drug-for-avodart]system of a down drugs[/url] syringe use in the pharmacy [url=http://online-health.in/atenolol/atenolol-kidney-failure]atenolol kidney failure[/url] uams pharmacy [url=http://online-health.in/azathioprine/azathioprine-50-mg-tablet-xan-picture]azathioprine 50 mg tablet xan picture[/url]

Anonymous said...

after market scan tool for 2003 mercedes benz http://eautoportal.in/geo replacing a freeze plug on a 1990 mercedes benz 300 se
[url=http://eautoportal.in/bmw-car/bmw-repair-clinic]auto price guides[/url] mercedes benz tuners [url=http://eautoportal.in/bentley/classic-bentley-dashboard-instruments]classic bentley dashboard instruments[/url]
national auto warranty company http://eautoportal.in/automobile/automobile-electric-blanket
[url=http://eautoportal.in/ford-com/can-you-get-cummins-diesel-in-ford-trucks]mercedes benz e270cdi 2110161a4[/url] mercedes sender unit 5 [url=http://eautoportal.in/kawasaki/kawasaki-vn800-carberator-jet]kawasaki vn800 carberator jet[/url]
automobile carpet 1948 lincoln http://eautoportal.in/bikes/cheapest-pocket-bikes
[url=http://eautoportal.in/kia/kia-asia-rocsa]pentax compatible auto focus 35mm lens[/url] mercedes benz suv 2007 [url=http://eautoportal.in/jeeps/jeep-wrangler-tow-bar-bakersfield]jeep wrangler tow bar bakersfield[/url]

Anonymous said...

aftermarket parts for 2007 volkswagen rabbit coupe http://autoexpress.in/opel/ellen/opel volkswagen fast
[url=http://autoexpress.in/mercury/mercury/retrograde/direct]sa2000 auto racing helmet[/url] fisher king oscar winner mercedes [url=http://autoexpress.in/plymouth/plymouth/cranbrook]plymouth cranbrook[/url]
renewing automobile tags in tampa florida http://autoexpress.in/scion/dc/sports/header/for/scion/xb
[url=http://autoexpress.in/peugeot/peugeot/automotive]garantie automobile location[/url] volkswagen vanagon camper [url=http://autoexpress.in/opel/opel/dealer/france]opel dealer france[/url]
prestige auto rental fl http://autoexpress.in/plymouth/new/plymouth/to/australia/1910
[url=http://autoexpress.in/maybach/maybach/automobiles]tag auto body s[/url] showcase auto [url=http://autoexpress.in/scion/scion/canada]scion canada[/url]

Anonymous said...

leisure travelers use and perception of travel agents survey http://greatadventures.in/plane-tickets/discount-air-plane-tickets-to-malawi tourism family travel
[url=http://greatadventures.in/tours/ionian-jewel-italian-tours]air travel and european deals[/url] portage glacier facts reports travel guides economy [url=http://greatadventures.in/disneyland/embassy-suites-at-disneyland]embassy suites at disneyland[/url]
oxygen travel http://greatadventures.in/tourist/tourist-attractions-china
[url=http://greatadventures.in/tourist/okefenokee-swamp-tourist-attractions]heavenly treasures travel[/url] unaccompianed minor air travel [url=http://greatadventures.in/cruises/costa-fortuna-cruises]costa fortuna cruises[/url]
fundraising for travel http://greatadventures.in/map/goa-india-map american express travel office stanford ct [url=http://greatadventures.in/disneyland/disneyland-welcome-tour]disneyland welcome tour[/url]

Anonymous said...

bree olsen freeones porn http://planetofporn.in/adult-xxx/adult-videos-for-sale-interracial-adult-movies
[url=http://planetofporn.in/archive-adult/adult-movies-with-hypnosis-scenes]adult baby spanking[/url] hentai one peice [url=http://planetofporn.in/erotic-stories/erotic-home-made-sex-video]erotic home made sex video[/url]
black sexy and over 40 elpaso tx http://planetofporn.in/adult-video/adult-video-chat-room
[url=http://planetofporn.in/first-anal/anesth-anal]michigan adult protective services[/url] xxx adult christmas [url=http://planetofporn.in/erotic-video/erotic-stories-of-teachers-and-students]erotic stories of teachers and students[/url]
google adworda adult sites http://planetofporn.in/blow/grtting-a-blow-job
[url=http://planetofporn.in/amateur-porn/amateur-wife-creampie-amateur-creampie]halo elite hentai[/url] using anal toys [url=http://planetofporn.in/erotic-gay/erotic-jennifer-rare-escort]erotic jennifer rare escort[/url]
adult nude365 day calendars http://planetofporn.in/girl-anal/anal-sex-accident
[url=http://planetofporn.in/archive-adult/milf-adult-mature-model]hermaprodites porn[/url] lubricant testing [url=http://planetofporn.in/ass-video]ass video[/url]

Anonymous said...

anal fuck nude ass http://theporncollection.in/lesbian-video/lesbian-cunnilingus
[url=http://theporncollection.in/orgy/gay-strait-orgy]dildo for president[/url] sexy nude mexicanas [url=http://theporncollection.in/gay-love/home-porn-gay-videos]home porn gay videos[/url]
courtney virgin ring http://theporncollection.in/free-hentai/hentai-mang
[url=http://theporncollection.in/gay-male/gay-fotos]adult entertainment free sex girls[/url] dildo ass girl [url=http://theporncollection.in/lesbian-xxx]lesbian xxx[/url]
free adult vido clips http://theporncollection.in/gay-male/gay-canines
[url=http://theporncollection.in/gay-male/free-gay-porm-cards]high tail hall hentai[/url] adult webmaster scripts [url=http://theporncollection.in/incest/incest-family-russia]incest family russia[/url]
cefalexin oral adult dosage http://theporncollection.in/incest/incest-storiesa
[url=http://theporncollection.in/porn-girl/japan-porn-myfilehost]what is the adult age in michigan[/url] only dudes gay porn [url=http://theporncollection.in/moms/poems-from-moms-to-daughters]poems from moms to daughters[/url]

Anonymous said...

costume designers guild http://www.thefashionhouse.us/black-red-sweater-color15.html chicago fashion stylist [url=http://www.thefashionhouse.us/black-brown-on-sale-color163.html]fitness and workout clothes for women[/url] fashion show ideas
http://www.thefashionhouse.us/prada-sports-shoes-brand10.html oldfashioned christian music [url=http://www.thefashionhouse.us/50-club-wear-size2.html]svensk designer[/url]

Anonymous said...

arkansas drug laws [url=http://usadrugstoretoday.com/products/apcalis-sx.htm]apcalis sx[/url] medical insurance student last half year http://usadrugstoretoday.com/categories/artritis.htm
migradorixima migraine medicine [url=http://usadrugstoretoday.com/products/levitra.htm]levitra[/url] chlamydia prescription drug [url=http://usadrugstoretoday.com/products/colchicine.htm ]heart rate decline in age [/url] ruby mineral
pictures kids sleeping bus [url=http://usadrugstoretoday.com/products/study-habits.htm]study habits[/url] lauren jolenne smoking http://usadrugstoretoday.com/products/celadrin.htm
blood and belief [url=http://usadrugstoretoday.com/products/hangover-helper.htm]hangover helper[/url] drug awareness program guide [url=http://usadrugstoretoday.com/products/evecare.htm ]red blood cell anatomy [/url] macomb county health department

Anonymous said...

smoke neutralizer [url=http://usadrugstoretoday.com/categories/hypnotherapie.htm]hypnotherapie[/url] fibers run at right angles to the axis of the muscle http://usadrugstoretoday.com/products/fluoxetine.htm
america statistics on fashion and diet industry [url=http://usadrugstoretoday.com/products/biaxin.htm]biaxin[/url] learn medical term pronunciation [url=http://usadrugstoretoday.com/products/cystone.htm ]keene medical products [/url] medical infromation
pharmacy continuing education online [url=http://usadrugstoretoday.com/products/flomax.htm]flomax[/url] australasian chapter of sexual health medicine http://usadrugstoretoday.com/catalogue/q.htm
medical asi [url=http://usadrugstoretoday.com/categories/antibiotici.htm]antibiotici[/url] step by step recipe stuffed chicken breast [url=http://usadrugstoretoday.com/products/remeron.htm ]kireten gum [/url] anorexia diet

Anonymous said...

abbotsford off track betting http://xwn.in/slot_slot-developers lottery odds on the thunderball
[url=http://xwn.in/blackjack_blackjack-chip-set]coshatta casino[/url] ndeposit casino bouns [url=http://xwn.in/roulette_roulette-flash-game-download-grand-russian]roulette flash game download grand russian[/url]
blackjack fabulous 18 index plays http://xwn.in/lottery_tennessee-lottery-jumbo-bucks
[url=http://xwn.in/slot_how-many-breakers-are-safe-for-32-slot]hoyle casino 2004 update[/url] computer casinos craps internet casino [url=http://xwn.in/casino-online_tony-caudill-casino]tony caudill casino[/url]
gambling and financial and advantages http://xwn.in/online-casino_schenectady-new-york-casino applying for diversity lottery [url=http://xwn.in/online-casinos_oklahoma-border-casinos]oklahoma border casinos[/url]

Anonymous said...

jd power and associates automobile review http://pqx.in/aprilia/aprilia/warranty volkswagen baja kits
[url=http://pqx.in/volvo/volvo/v50/centralized/locking]uber golf volkswagen[/url] auto club knotts berry farm discounts [url=http://pqx.in/isuzu/isuzu/pickup/truck/noises]isuzu pickup truck noises[/url]
mercedes benz of anchorage http://pqx.in/acura/jenkins/acura/ocala
[url=http://pqx.in/bentley/malcom/bentley/satffordshire]storch auto traders[/url] volkswagen girl graphics for myspace [url=http://pqx.in/cadillac/engine/weight/cadillac/500]engine weight cadillac 500[/url]
did mercedes have air conditioning in 1980 http://pqx.in/citroen/citroen/diesel/engine/erratic/idle
[url=http://pqx.in/jaguar/ownerinfo/jaguar]roof rack basic carrier mercedes[/url] where is the fuel filter located in a 2001 volkswagen jetta [url=http://pqx.in/ducati/ducati/revell/diecast/model]ducati revell diecast model[/url]

Anonymous said...

princess margaret home lottery http://lwv.in/online-casinos/list-of-casinos-in-usa free gambling online casinos
[url=http://lwv.in/slots/williams-new-slots]lottery games in ri[/url] downtown kck casino [url=http://lwv.in/blackjack/annual-salary-as-a-blackjack-dealer]annual salary as a blackjack dealer[/url]
planting blackjack oak acorns http://lwv.in/lottery/michigan-state-lottery-results
[url=http://lwv.in/joker]keno in maryland bars[/url] character bingo markers [url=http://lwv.in/slot/australian-slot-cars]australian slot cars[/url]
gambling trends http://lwv.in/casino-playing-cards/fit-deck-playing-cards casino wheeling wv [url=http://lwv.in/bingo/bingo-tomato-seeds]bingo tomato seeds[/url]

Anonymous said...

blackjack mamba http://lwv.in/gambling-online/world-history-of-gambling mixed number improper fraction bingo
[url=http://lwv.in/online-casino/casino-heart-rama]carribean casino bingo okc[/url] casinos in tacoma washington [url=http://lwv.in/online-casino/mystic-lake-casino-indian-checks]mystic lake casino indian checks[/url]
the lottery rose http://lwv.in/baccarat/courvoisier-baccarat-decanter
[url=http://lwv.in/roulette/morris-levy-roulette-buddy-holly]free pogo bingo[/url] free casino gambling [url=http://lwv.in/blackjack/ear-piece-for-blackjack-pda]ear piece for blackjack pda[/url]
arizona lottery director http://lwv.in/baccarat/baccarat-psydelic-collection caesars palace hotel casino las vegas [url=http://lwv.in/roulette/digital-roulette-layout]digital roulette layout[/url]

Anonymous said...

dvd movie release dates [url=http://moviestrawberry.com/films/film_dirty_laundry/]dirty laundry[/url] high school musial 2 movie http://moviestrawberry.com/films/film_officer_duck/ backdraft movie quotes
movie times frederick md [url=http://moviestrawberry.com/films/film_little_children/]little children[/url] dbz movie http://moviestrawberry.com/easy-downloads/letter_C/?page=5 ginuwine movie
free xxx porn movie previews [url=http://moviestrawberry.com/films/film_someone_s_watching_me/]someone s watching me[/url] female domination free movie
halo live action movie [url=http://moviestrawberry.com/films/film_welcome_home_roscoe_jenkins/]welcome home roscoe jenkins[/url] dirty dancing havana nights the movie http://moviestrawberry.com/films/film_cheats/ stowe vermont movie theater
the christmas carol movie musical [url=http://moviestrawberry.com/films/film_rain_man/]rain man[/url] movie locator http://moviestrawberry.com/films/film_austin_powers_international_man_of_mystery/ youtube movie downloads