Showing posts with label prgramming. Show all posts
Showing posts with label prgramming. Show all posts

Dimmented is Live!


My latest app, Dimmented is live. It's still in beta, but all of the functions work, I hope. Only the UI stuff needs to be fine-tuned. It's my first Flex app, haven't got around to reading about transitions and effects yet, so there are no fancy animations yet in Dimmented.

Dimmented is an app that shows your Digg comments or any other Digg user's comments. I used to keep track of my Digg comments by using their API and reading the raw xml. But the problem with that is it doesn't show the replies to my comments. With Dimmented, I made it show replies, and not just the first level of replies, but all the replies, plus, it can also show the first level of "reply to".
I also included the "remember me" function so that I don't have to type in my username each time. At first, I tried to do this using cookies and php, but for some reason, it didn't work. Then I found out about Flex's shared objects, and it was so much easier, and boom, it was like the feature made itself available.

It is a good learning experience for me. At first I thought Flex was very different to what I already know about scripting/programming, but it turns out it's very similar to the xml-script structure that I'm used to making Konfabulator/Yahoo widgets. So, it wasn't that difficult. And the next version of Flex will have better support for making AIR apps, I don't know whether I'll ever go back to Konfabulator. I already have plans for my next Flex app.

E4X in Flex

I've just started working on an Adobe Flex project, and I've messing around with E4X. I'm familiar with Xpath 1.0 from working with Konfabulator widgets, but it took me a while to get to grips with E4X. Most of what I learned, I got from this website. So, I'll just go ahead and use some of the material from the site. Here's what I've learned so far. I'll be using the below XML as an example.

<?xml version="1.0"?>
<rdf>
<channel>
<title><![CDATA[Test file]]></title>
<link>http://www.sephiroth.it</link>
<description><![CDATA[A custom description of this document]]></description>
<language>en-us</language>
<items>
<item id="001">
<resource url="http://www.sephiroth.it/tutorials.php" />
<channel>FLASH-PHP</channel>
<author email="alex@alex.com">
<name>Alessandro</name>
</author>
</item>
<item id="002">
<resource url="http://www.sephiroth.it/tutorials/flashPHP/E4X" />
<channel>Flash 9</channel>
<author email="mich@alex.com">
<name>Michael</name>
</author>
</item>
<item id="003">
<resource url="http://www.sephiroth.it/tutorials/flashPHP/scrollRect" />
<channel>Flash 8</channel>
<author email="fk@alex.com">
<name>Frank</name>
</author>
</item>
</items>
</channel>
</rdf>


httpResult.lastResult..item will give all the items in XML fromat:


<item id="001">
<resource url="http://www.sephiroth.it/tutorials.php" />
<channel>FLASH-PHP</channel>
<author email="alex@alex.com">
<name>Alessandro</name>
</author>
</item>
<item id="002">
<resource url="http://www.sephiroth.it/tutorials/flashPHP/E4X" />
<channel>Flash 9</channel>
<author email="mich@alex.com">
<name>Michael</name>
</author>
</item>
<item id="003">
<resource url="http://www.sephiroth.it/tutorials/flashPHP/scrollRect" />
<channel>Flash 8</channel>
<author email="fk@alex.com">
<name>Frank</name>
</author>
</item>

httpResult.lastResult..name.text() will give all names in normal text, without the XML formatting. That's what the .text() is for.

AlessandroMichaelFrank


httpResult.lastResult..item.@id will give the ids of every item:

001002003

httpResult.lastResult..item[1].@id will give the id of the second item. But there's a warning that popped up in the debugger that discourages from using square bracket operator. It recommends using the ArrayCollection.getItemAt() instead.


002

After knowing all that, I can virtually get any value I want. But there's still along way to go in mastering Flex.