Now that we have our methods defined, lets support the strong typing option the is available in Flash MX 2004 for actionscript 2.0. For this we add another folder. Here is the code:
<?xml VERSION="1.0"?>
<customactions>
<actionspanel>
<folder VERSION="6" id="com.ahfx" index="true" name="com.ahfx" tiptext="Contains info for com.ahfx package">
<folder VERSION="6" id="[com.ahfx.ShoppingCart]" name="ShoppingCart" tiptext="ShoppingCart">
<folder VERSION="6" id="Methods" name="Methods" tiptext="Shopping Cart methods">
<string
object="[com.ahfx.ShoppingCart]"
text=".addElement(% object %)"
type="procedure"
version="6"
name="getTotal"
tiptext="Number: returns the total of the price of the Products in the Shopping Cart" />
</folder>
</folder>
<folder name="Types" id="Types" index="true" tiptext="Types that can be used for strong typing">
<string
name="ShoppingCart"
tiptext="ShoppingCart type"
text="ShoppingCart" />
</folder>
</actionspanel>
</customactions>
The key to this folder is having the name be Types, id be Types and index be true. By adding this code you add your custom classes to the dropdown for the class types.
Custom Class Extentions
You´ll notice that we've used my_sc as the shopping cart name. We can get the method dropdown list to appear for anything with our extention (in this case _sc for shoppingcart). This is done by adding the following code to our file:
<?xml VERSION="1.0"?>
<customactions>
<actionspanel>
<folder VERSION="6" id="com.ahfx" index="true" name="com.ahfx" tiptext="Contains info for com.ahfx package">
<folder VERSION="6" id="[com.ahfx.ShoppingCart]" name="ShoppingCart" tiptext="ShoppingCart">
<folder VERSION="6" id="Methods" name="Methods" tiptext="Shopping Cart methods">
<string
object="[com.ahfx.ShoppingCart]"
text=".addElement(% object %)"
type="procedure"
version="6"
name="getTotal"
tiptext="Number: returns the total of the price of the Products in the Shopping Cart" />
</folder>
</folder>
<folder name="Types" id="Types" index="true" tiptext="Types that can be used for strong typing">
<string
name="ShoppingCart"
tiptext="ShoppingCart type"
text="ShoppingCart" />
</folder>
</actionspanel>
<codehints>
<typeinfo object="com.ahfx.ShoppingCart" pattern="*_sc" />
<typeinfo object="com.ahfx.ShoppingCart" pattern="ShoppingCart" />
<typeinfo object="com.ahfx.ShoppingCart" pattern="com.ahfx.ShoppingCart" />
</codehints>
</customactions>
Please notice that there are no square brackets around com.ahfx.ShoppingCart this time. That little nuance caused me a lot of grief while trying to get everything to work.
SUPPORT THIS SITE If this tutorial helped you, show your support and send me something from my wish list. Click on an item below and then choose Adam Hayes (Gift Registry Address) for the Ship to Address. It is that easy!