Loading and parsing CSS....

Hello, Apologies if this is a silly/rookie question. Please let me know if I am going about this the wrong way..... I want to load and parse a CSS file in haxe, nme and/or jeash. How do I do this? I am targeting html5. I was using the Assets lib to loa…

Viewing 1 to 5 (5 Total)
Loading and parsing CSS....

SamBrick

SamBrick
Total Posts: 27
Joined: February 02, 2012

Hello,

Apologies if this is a silly/rookie question. Please let me know if I am going about this the wrong way..... I want to load and parse a CSS file in haxe, nme and/or jeash. How do I do this? I am targeting html5. I was using the Assets lib to load the css file using getText() but I don't see how to parse it from a string into a Stylesheet.... Ultimately I want an easy way to keep text styling info (externally) and then I want to apply the style info as text formats onto textfields......

Any advice, help or input would be gratefully received.

Thanks!

Sam

Tags:
Posted on February 08, 2012 at 10:58 AM

singmajesty

singmajesty
Total Posts: 2140
Joined: August 25, 2011

Re: Loading and parsing CSS....

One thing that will be tricky is that Jeash uses canvas elements for text. Perhaps there is a way to use standard DIVs for text? Then you would be able to assign CSS styles to have it look the way you want. It would not be difficult to use the JS API to create and add text elements, but it may be necessary to integrate more fully with Jeash's rendering code in order to have the correct z-order

Posted on February 08, 2012 at 11:33 AM

SamBrick

SamBrick
Total Posts: 27
Joined: February 02, 2012

Re: Loading and parsing CSS....

Thanks singmajesty for the help.

I was hoping to use some of the styling info for jeash canvas based text and then where more complex text styling was needed use standard divs as you suggest. Crayfellow has been helping me do this and running some really impressive and successful tests hacking Jeash.

However, I am still having a hard time figuring out how to retain the css as css or to parse the string it comes in as......

Cheers,

Sam

Posted on February 08, 2012 at 11:42 AM

grumpytoad

grumpytoad
Total Posts: 63
Joined: November 21, 2011

Re: Loading and parsing CSS....

This sounds similar to the work going on at primevc:

http://github.com/touch/PrimeVC...

Currently they have a working flash CSS parser, some work is going into a plain js renderer, i am working towards jeash compat, which should lend itself well to nme too.

Posted on February 08, 2012 at 12:17 PM

SamBrick

SamBrick
Total Posts: 27
Joined: February 02, 2012

Re: Loading and parsing CSS....

Thanks Grumpytoad! I'll take a look at that. Looking forward to your jeash integration too. FYI I was also pointed to some cssParsing in Nicolas' hxtml classes.

Cheers,

Sam

Posted on February 09, 2012 at 5:02 AM