1/18/11

HTML Tag Reader : Flash Application

Here is an flash application which reads some of the html tag and then gives the desired result.

I have used Action Script 3 for this application.

In the application you will get to know the usage of action listener (event listener), then Use of URLRequest etc. The rest I have defined below.


Event Handling

Event handling is the process by which any sort of interactivity is created in ActionScript 3.0. This tutorial will teach how to make your movie jump to life, whether it was by reacting to a mouse click, a keyboard stroke, or any event happening in Flash using the Event Handling system of AS3.

An event listener is basically a function created with the very specific purpose of reacting to an event. An object can react to an event using an event listener. This is done by using the .addEventListener method. This method simply registers an Event Listener and an Event to an object.

The process described above is written in ActionScript using in the format shown below:

   myObject.addEventListener(Event, eventListenerFunction);   
Our Event Listener will obviously have to be specified by declaring the function the same way any other function is declared in ActionScript, the only difference is that the listener function must have one argument to represent the event. This event argument can have any identifier as its name, I usually use the letter 'e' for it as shown in the generalized code below:


myObject.addEventListener(Event, eventListenerFunction);

  function eventListenerFunction (e:Event):void{
           //ActionScript statements to be executed when the event happens.
  }

Before we start writing the code, to open the place where you have to write the code go to the first time frame and then press F9, the actions frame will open. Then there write the code.
 
HTML Tag Reader Action Script 3 code:


submit_btn.addEventListener(MouseEvent.CLICK, convert);
heck_btn.addEventListener(MouseEvent.CLICK, fileLoader);
c
eck_btn.enabled=true;
c h
heck_btn.visible=true;
c
var i:uint=1;
var req:URLRequest=new URLRequest("Address of the file(ex. 'format.txt')");
var loaded:URLLoader=new URLLoader();
nction fileLoader(event:Event):void{
f u
navigateToURL(req,'_blank');
}
ion convert(event:MouseEvent):void{
func t
nput_txt.htmlText=(input_txt.text);
i
}


To check the code is proper or not press ctrl+shift+enter or go to the debug menu then debug it.

The below is the video of the HTML reader.


The list of tags it can read are:

SUPPORTED TAGS:

1. <a>

2. <b>

3. <br>

4. <img>

   THE BELOW IS THE SUPPORTED <img> ATTRIBUTES
   -src
   -width
   -height
   -align
   -hspace
   -vspace
   -id
   -checkPolicyFile

5. <font>

THE BELOW IS THE SUPPORTED <font> ATTRIBUTES
   -color(hex form ex: #FFFFFF)
   -face
   -size

6. <i>

7. <textformat>

THE BELOW IS THE SUPPORTED <textformat> ATTRIBUTES
   -blockindent
   -indent
   -leading
   -leftmargin
   -rightmargin
   -tabstops

8. <u>

9. <li>

10. <span>

THE BELOW IS THE SUPPORTED <span> ATTRIBUTES

   -class



SHARE THIS POST: