Your browser (Internet Explorer 7 or lower) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.

X

Navigate / search

Flex Tutorial: A Quick Course On Actionscript

In the previous chapter we discussed the steps involved in creating flex application. This lesson will discuss actionscript syntax. Actionscript was created by Adobe for their Flash IDE to control 2D animations in flash. The actionscript syntax is very similar to that of Javascript. So if you know Javascript 80% of actionscript you know most of actionscript’s syntax.

In this article I will go into the additional features that are supported by Actionscript.

Variable Declarations

Syntax:

var  variableName;

Sample:

var sample_var = 1;

Variable name rules: Name should not contain spaces, cannot be reserved actionscript keywords like if, for, do, while.

Strings

Strings are assigned to variables using a single quote or double quote.

var name = ‘raj’;
var anothername=”raj”;

Booleans

Booleans are assigned to either true or false. The words are lowercase and are reserved keywords.

var isAMonkey = true;

Strict Data Typing

Although variables are loosely typed it is possible to specify a type for your variables in Actionscript. This is also called variable type annotation. The following statement declares a variable of type Number. You can specify annotations for your own data type declarations also.

var mileage:Number=20;

var Ferrari:Car;

Functions

Functions are defined with the same syntax as Javascript. But actionscript supports specifying return type through type annotations similar to variable type annotations. Shown below are some sample declarations

function findInterest(principal,interest,time):number
{
…
}

Anonymous functions

An anonymous function is the same as normal functions but it is defined similar to declaring a variable.

var testFunction = function() {

doSomethin();

}

testFunction();

The difference is that anonymous functions should be fully defined before being executed but normal functions will get mapped to their definitions even if the definition falls after the part where the function is called.

Flow control and looping

Actionscript supports all the looping constructs that Javascript does:

While loops

while (expression)

{

//do something

}

For Loops

var y:Number=1;
for (var x:Number = 1; x <=5; x++)
{
     y=y*x;
}

Classes And Objects

Actionscript supports classes in a way similar to Javascript. Instead of relying on the function keyword to define functions, actionscript uses the following syntax:

Class Classname
{
   private var varName;
   public function funcName()
   {
   }

}

Here public and private are access specifiers. The first definition within the class is a class attribute. The second is a class method. Instantiating an object:

var newObj = new  ClassName();

If you are familiar with Java you will find actionscript’s syntax of defining classes very similar.

Packages

Packages are used to group related classes together.

package packageName
{

//class definitions

}

Static variables

Static variables are attributes that are defined as part of the class. These variables are not unique to each variable like instance variables. They are accessed by referencing the classname.

class ActionscriptBook
{
 public static pages:Number = 322;
}
var pages = ActionscriptBook.pages;

Getters and Setters

Actionscript supports creating getter and setter functions that control access to class variables.

class  Box {
private var side:Number;
public function get theSide():Number
 {
 return side;
 }
 public function set theSide(theNum:Number):Number
{
 side=theNum;
}
}

In this chapter we have learnt the basic actionscript syntax. In the next chapter, we will learn how to use the various components and how to place them within containers.

Flex Course: Getting Started Writing Flex Applications

In the previous lesson we briefly discussed creating a flex application. In this lesson I will discuss how to create a flex application and walk you through the process of creating one.

Most tutorials and books teach Flex on the assumption that you are going to use Flex Builder to write your flex applications. I prefer to think you will use your own IDE. Therefore, we will focus on making flex UIs using simple text editors like Notepad or TextMate.

Read more

Amazing User Interfaces With Flex – 11 Part Post Series

Creating easy to use user interfaces such as forms is not easy. Creating a easy to use interfaces always means providing features that are available in a desktop user interface. Until now this has been very laborious and difficult to maintain. With Adobe Flex you can create amazing user interfaces with minimal code.

By the end of this post series, you will be able to create amazing user interfaces your clients will love you for and do it in less time than it takes to create them with HTML and Javascript.

How to Customize the Syndicate Feed Icon Block in Drupal

Now a days many blogs have a widget on their right/left sidebar inviting users to subscribe to your blog. Making this a part of the theme traditionally involved creating a block module or going into the admin panel to create the block manually. These are tasks that you may not want to do when you are distributing your theme. This post shows you how to customize the syndicate block so that you can show all relevant subscription options on your theme without the theme user needing to change any code or do any configuration.

WP Responder – E-Mail Subscription And Follow Up Autoresponder WordPress Plugin

Update: WP Responder has been added to the WordPress Plugin repository. You can install WP Responder through the WordPress dashboard through the Plugins > Add New feature. Look for “WP Responder” as the search phrase.

The success of any blog depends on the number of people who are actively reading your blog at any time. To help you get more blog subscribers and monetize your blog, I have been hard at work to create this plugin for the past 15 or so days to make it what it is now.

There are many blog subscription plugins available but none of them did what I wanted them to do. They were all limited in features or were paid software, possibly violating the wordpress license which prohibits creating proprietary wordpress plugins.

You might be wondering why would you offer e-mail subscriptions when most people would rather use RSS. Aren’t emails annoying? Not if you do it right.

Why provide E-Mail Subscription when you can just offer RSS?

All blogs on the internet today brovide RSS subscriptions. For the top blogs such as Techcrunch and mashable, RSS is the primary channel through which their readers read the blog. However, RSS has some limitations. The most important one I see is control. Being able to customize who gets what message.

  • RSS Isn’t Suited To Every Blog’s Audience Outside the world of technology blogs and other blogs that have a tech-savvy audience, providing RSS feeds is simply not enough. Asking them to find and learn to configure a RSS feed reader may be too much of a learning curve just to stay updated with your blog. The medium should not stand between you and your subscribers. E-mail is a very basic application. Anyone who knows how to user the Internet knows how to use e-mail.
  • RSS Feed E-Mail Services Aren’t EnoughServices like FeedBlitz and FeedBurner provide e-mail subscriptions for a blog’s content via E-Mail. They allow blog subscribers to subscribe to your blog via email. But these services cannot be used to send email to your subscribers without making a post on your blog. Although Feedblitz provides the e-mail broadcast feature on a paid subscription. This is essential if you would like to market your products and services to your blog readers.
  • RSS Can’t Filter Recipients – As your readership increases, you will find yourself writing on general topics. The blog becomes less and less relevant to an individual with a specific interest as the reader. This subscriber may only be interested in posts that you file under a specific category. Some posts are better given delivered by e-mail to a small subset of your subscribers.
  • RSS is just one channel to reach you – RSS is just one channel through which people can reach you. You can’t make a posting about

Prospects Need Repeated Exposure To Your Message To Become Customers

Most prospects (who in this case are blog susbcribers) will not buy from you on the very first exposure to your advertisement or sales pitch. They must be exposed to your message 5-7 times before they buy from you.We cannot send these repeated messages through blog posts as our blog will begin to look like a bunch of sales letters and will make us lose subscribers.

We should also be able to reach our readership without making a blog post. This is the motivation to create WP Responder.

What is WP Responder?

Below is the features of this plugin:

  • Create Unlimited Number Of Newsletters – Apart from delivering blog posts to subscribers, you can create newsletters that are meant to be exclusively used for building a audience.
  • Create Unlimited Followup Autoresponders – Usually newsletter subscription plugins support only creating newsletters to which you must send broadcasts manually. With the WP Responder, you can create followup messages to get your prospects ready to buy your product or build a loyal following via E-Mail.
  • Create Post Series – For the longest time, creating a post series has been the way to increase blog subscribers. But most bloggers don’t promote their post series after they have finished up the series. This feature allows you to offer subscribing to a post series (posts filed under a certain category) by e-mail delivered at regular intervals such as once in 2 days.
  • Much More – There are many more features you should look at that will be help you build a readership for your blog if you have one. This blog is currently using this plugin for e-mail subscriptions. The plugin is available for free download here:

Click here to download.

How To Add A Administration Page In WordPress

When adding new features to a wordpress website you may have to create a configuration page for the feature you created.

For example, the twitter plugin (which adds your twitter feed to the sidebar) should be configurable to specify the username and the number of tweets to display. This is important in cases where the plugin will be distributed and be used by non-technical users.

This article will show you:

1. How to create an admin section like the one shown in the image on the right.

2. How to create sub pages for each of those sections

3. Show the content (usually a form) you want when the sub page link is clicked.

What We’ll Create:

This is a part of a module that I am working on right now. This module adds an autoresponder that has most of the features of Aweber.com.

Step 1: Add An Admin Menu Hook

Add an admin_menu callback function in your main PHP file. If you don’t know what a hook is, it is simply a special function that you ask wordpress to call at a particular stage of initializing the output. In this case the stage is building the administration menu.

add_action('admin_menu','wpr_admin_menu');

Step 2: Adding menu items

Adding Admin Section

First we add a separate section called “Newsletters” which can be expanded to show some more links to sub sections (Home, Subscribers in the above picture). To add a section we use this function:

add_menu_page(page_title, menu_title, access_level/capability, file, [function], [icon_url]);

So in our plugin we use:

add_menu_page('Newsletters','Newsletters',8,__FILE__);

If you leave out the [function] parameter, wordpress will display the first sub page under the section when the section is clicked (and not expanded using the small arrow on the right). Click here to read the detailed documentation of the function.

Access Capability

I need this section to be visible only to the admin user therefore I have used access_level as 8. Click here to see other access level values.

Adding Sub Sections

The sub sections – Home, Newsletter, Subscribers, Messages and Reports are added using the following function.

add_submenu_page(parent, page_title, menu_title, access_level/capability, file, [function]);

In our plugin we use:

add_submenu_page(__FILE__,'Newsletters','Newsletters', 8, "newsletter", "wpr_newsletter");

The first parameter is the parent file. This should be the same as the top level menu’s file parameter. Click here to read the detailed documentation of the function. In the parameters, add the parent, page title, menu title and access level capability and then add any unique value for the file attribute

Customizing the first sub section’s link text

When you add sub sections using the add_submenu_page function as shown above, the first section always takes the name of the top-level section itself. To change that to something you want, call the add_submenu_page function as shown below immediately after the add_menu_page function.

add_submenu_page(__FILE__,'Dashboard', 'Home', 8, __FILE__, "wpr_dashboard");

The only difference is the parent attribute and the file attribute in the function are et to the same file. Above function will set the link of the first section to ‘Home’. The wpr_dashboard function will be called when this page is to be displayed.

function wpr_dashbaord()
{
     echo "Dashboard Content Goes here!";
}

Below is the code for the menu in the picture :

add_action('admin_menu','wpr_admin_menu');

function wpr_admin_menu()
{
     add_menu_page('Newsletters', 'Newsletters',8,__FILE__);
     add_submenu_page(__FILE__, 'Dashboard', 'Home', 8, __FILE__,"wpr_dashboard");
     add_submenu_page(__FILE__, 'Newsletters', 'Newsletters', 8, "newsletter","wpr_newsletter");
     add_submenu_page(__FILE__, 'Subscribers', 'Subscribers', 8, "subscribers", "wpr_subscribers");
     add_submenu_page(__FILE__, 'Messages', 'Messages', 8, "messages", "wpr_messages");
     add_submenu_page(__FILE__, 'Reports', 'Reports', 8, "reports", "wpr_reports");
}

Guest Post On BuildInternet : Four Ways To Make Equal Height Columns

One of the most difficult tasks when moving from table based layouts to css based layouts is creating equal height columns. Many newcomers to web design will find these frustrating to create.

I’ve written a guest post at one of my favourite web development blogs – BuildInternet on how to create just that. The article discusses four methods to create equal height column layouts in HTML/CSS. I’m very excited about this article because this is my first guest post on another blog. I will be making many others like this. Please take a look:

Four Methods to Create Equal Height Columns

Drupal Module: Twitter Block – Add Your Twitter Feed To Your Drupal Website

Update: Twitter has disabled the API to which this module was originally interfaced. Please download the new version that works using RSS feeds here. You do NOT have to provide your twitter password to show your tweets in the block.

Why don’t you show how relevant you are to your site visitors and get more followers on twitter? Once they start following you, you can start pointing them to your website again and again now that you have their attention.

Unfortunately there isn’t a simple way to create this block from the existing drupal modules. The procedure to create a Twitter block is very convoluted using Views and what not.

But first, a little rant. It seems like a lot of developers are more focused on being ‘standards complaint’ (politically correct) than create easy to use software as if they create software for other developers.

“Oh! let’s not rehash the code here, that’s not good core re-use. Let’s ask users of our module to download and install 10 other modules on which we will base this module!”

This block is installed through the module (download below).

The block is highly customizable. Check out the options you have in the administrator’s interface.

This interface is found in Administer > Sites Building > Blocks > Twitter Block [configure]

The blocks can be theme using css as each element is enclosed in a <div> of appropriate name.

Download

Click here to download the module.

Installation Steps

1. Install the Module: Just place the module in the modules directory of your drupal site or sites/all/modules/ directory if you have multiple installations. Log in as administrator and go to Site Building > Modules. Scroll to the bottom and find “Other” package. Expand it, check the TwitterBlock one and click Save Changes.

2. Place The Block In A Region: Now go to Administer > Site Building > Blocks. At the bottom of the list you will find Twitter Block. Drag it to the required region and click Save Changes.

3. Enter Username/Password: Once you click save, you will still not see the block, you must enter the username and password. So click on ‘configure’ next to Twitter block and enter your username and password. Choose a appropriate update frequency and click Save.

You’re all done. Your module should be working now. Leave a comment on this post regarding bug fixes and other issues.

License

This module is provided under the GPL license. Read the full version here.