Buy my XML based flex shopping cart for mere USD 17

ActiveDen is sure a great marketplace for buying and selling flash/flex items.

 

Have a look at my latest upload to the marketplace

 THE shop

It is an XML based shopping cart.

This is built on the Mate framework.

A few highlights:

Got suggestions or comments? Feel free to contact me.

XML e4x and the attributes issue (Error #1065)

Hi All,

The e4x syntax for working with XML and XML data in Flex is widely common now.

However, last week I encountered one error – the error #1065 – claiming that one of the attributes is not defined in the XML.

Here is what actual problem was:
I was using the e4x syntax to find a few nodes in the XML which have a particular attribute value.

Here is the XML that I was using:

<?xml version="1.0" encoding="utf-8"?>
<catalog>
    <album artistCode="001" artistName="Artist1">
        <name>Album 1</name>
    </album>
    <album artistCode="002" artistName="Artist2">
        <name>Album 2</name>
    </album>
    <album artistCode="001" artistName="Artist1">
        <name>Album 3</name>
    </album>
    <album artistCode="002" artistName="Artist2">
        <name>Album 4</name>
    </album>
    <album artistCode="003">
        <name>Album 5</name>
    </album>
</catalog>

now, If I am referring to the above XML by the name of dataXML:XML inside the script, then by writing the following, I can get all the nodes as an XMLList for a particular artistCode (001 in the following case):

dataXML.album.(@artistCode=="001")

This works correctly, I get Album 1 and 4 in the XMLList. But what if I want to search based on the name, then code is modified as follows:

dataXML.album.(@artistName=="Artist1")

But… When I do this, I get an error:

ReferenceError: Error #1065: Variable @artistName is not defined.

 

This is because if you see the last node of album doesn’t have the artistName attribute et al. So how to fix this.

This is actually not too difficult to fix, simply change the code to:

dataXML.album.(attribute("artistName")=="Artist1")

Writing the above code will simply ignore the nodes which do not have that particular attribute and hence will cause no error.

So to conclude, it is important to note that, if you are using XML.node.(@attributeName=’SomeValue’); to search for nodes in your XML data, make sure that all the nodes have that particular attribute, even a blank value is fine, but if the attribute is completely missing, then a run time error will occur. And to avoid it, instead of using the @attribute syntax switch over to (attribute(“attributeName”)) syntax.

I hope this helps someone.

Cheers and wish you all a very happy and prosperous 2010.

It’s Official! I helped making Adobe Flex Better

Well, One of the proud possessions that I have is a T-Shirt from Adobe which has the names of people written on it who participated in making Adobe Flex better. And why I am proud? Because I am one those people.

See the artwork here – it contains my name (my real name)

makingFlexBetter 

(Click on the image to see a bigger image)

And how I became one of these people? By logging bugs into the flex bug base. If you feel that you are facing a bug in Flex, please report it at https://bugs.adobe.com/flex/ and Adobe is generous enough to have you rewarded!

Installing the ClearCase plugin for Adobe Flex builder

About Rational ClearCase
Rational ClearCase is a tool used for revision control of the source code or other development assets. It is developed by the Rational Software Division of IBM. Learn more about ClearCase by clicking here.

Installing the ClearCase Plugin for Adobe Flex Builder
If you are already using (or planning to use) ClearCase as your revision control tool in your flex application development, it will be a good idea to install the ClearCase plugin inside the flex builder, so that all the commands (like check-out, check-in, hijack and much more) can be directly invoked from the Flex Builder.

First, you will need to download the plugin, to download please go to the ClearCase plugin download page.

You will see a list of available plugins. From this list, download Plug-in: Adapter for Eclipse 3.1: Windows.

After downloading the ZIP, extract it onto your local disk drive.

You will notice that there are two folders within the eclipse folder of the downloaded content, Namely, plugins and features.

Now open the folder where the flex builder is installed (Typically, C:\Program Files\Adobe\Flex Builder 3).

Copy the contents of features folder from the downloaded content to the features folder under Flex Builder 3 folder. (Note: Copy the folders itself and not the content within folders, there will be total two folders under this folder).

Copy the contents of plugins folder from the downloaded content to the plugins folder under Flex Builder 3 folder. (Note: Copy the folders itself and not the content within folders, there will be total three folders under this folder).

And That’s it, you are done. Launch the Flex builder.
You can now see the ClearCase SCM Adapter inside Flex Builder.
To open the ClearCase SCM Adapter preferences, go to Windows –> Preferences –> Team –> ClearCase SCM Adapter.

Now if you keep the contents of your snapshot view at the same place as the flex project folder, you can do many ClearCase operations by doing the following:

In the ClearCase SCM Adapter – select ‘Automatically connect’ – Restart Flex Builder
Right click on any resource in Flex-Navigator, point to ‘Team’, the sub-menu will show many of the commonly used ClearCase commands.

Have any questions? Post me a comment.