Background image repeat in flex 3

I've been playing around with an adobe air application I am building and I was trying to make a background image repeat in flex just like it does in html.

I though this would be relatively easy but it turns out its not that simple. In the they achieve repeating backgrounds using a backgrounds.swf file, however I can't seem to find any info or source on how to customise this so I discovered another solution... DEGRAFA!

Degrafa is a graphic framework for flex3. It is incrediblypowerful and has so many features but Im not going to cover that at all, though if you want to learn more visit the degrafa site and look at the samples and tutorials.

To get a background image to repeat using degrafa is simple.

Step 1... visit degrafa and download the latest version of the swc.

Step 2... unpack the zip and place the degrafa swc file in your projects lib folder.

Step 3... Add the following css to your projects css file, or inside a style tag if you dont have a css file.

Application {    
background-image: Embed("assets/images/the_image_goes_here.png");
background-repeat: repeat;
background-position: center;
background-blend: multiply;
borderSkin: ClassReference("com.degrafa.skins.CSSSkin");
}

Step 4... Run and rejoice because degrafa is going to make you fall in love with flex all over again!

 

Comments
Add New
Alex C  - Question     |November 7, 2008, 5:30 am
Hi. I'm trying to get the above code (minus the borderSkin) working and am
having some difficulty. The image always resizes to fit the browser window and I
don't want it to do that. Any thoughts?
Brendon  - Reply to Alex C     |November 7, 2008, 8:45 am
I think its the borderskin from Degrafa that does all the repeating... any reson
why you are not using the borderskin statement?

I think in the next version of
flex the are incorporating more graphical functions like what degrafa offers
however in the mean time I havent been able to find any other way of doing this.
Alex C  - Reply to Brendon     |November 7, 2008, 9:07 am
Thanks, Brendon. I'd tried including the borderSkin earlier and kept getting an
error. This time, I included it and it worked like a charm! Wow! The image stays
at the same size.

Where can I read more about the various CSS properties
you're setting in the code above? For example, what are the other valid values
for the background-blend property? Thank you for your great help.
Brendon  - Reply to Alex C     |November 7, 2008, 9:13 am
Visit http://www.degrafa.com there should be all the documentation and example
to keep you occupied for a few months :)

By the way, thanks for your blog...
I've been there before for some flex examples... very helpful and well
written... cheers
Alex C  - Reply to Brendon     |November 10, 2008, 4:12 am
Thanks, Brendon. I didn't know if the blog was helping anybody. Very few
comments on there. Glad to hear you saw it :)
Steve A  - Panels too   |January 7, 2009, 9:48 am
works for panel backgrounds too - THANKS
TrueColorTech  - Awsome   |February 19, 2009, 4:13 pm
Thank you you solved an issue I was having :)
Powered by !JoomlaComment 3.26

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 

Help my beer fund

RocketTheme Joomla Templates