October 26, 2008


Filed under: OOP — iBen @ 7:05 pm

A signature is the definition of a method NAME a methods ARGUMENTS and a methods RETURN TYPE in totality.


Filed under: OOP — Tags: , , , , , — iBen @ 2:47 am

Literally translated into many faces, this word is a crucial strategy for creating flexible and scalable code.

Polymorphism is not something you build into your classes but rather an idea to build your classes around which is what makes it so powerful. Making something polymorphic is as simple as creating a TYPE.

All of the following have something in common:
Object, String, Array, Dictionary, Vector.

They are all Objects.

Anywhere a type Object is used , I will be able to supply all of the above in its stead. Certainly an Array has different methods and properties than an Object does but because it derives from Object, the compiler knows that when i speak of the object OBJECT it has properties and methods which Array must possess as well thus enabling me to use Array in its place.

Now note, Polymorphism is not used to trick the compiler by an means. If you are seeking ways to pass in any type regardless of its context, I suggest you only use the type Object in any of your systems. The reason to use Typing is to make your life and the lives of other developers more streamline when it comes time to debugging or extending.

Type is a luxury not a necessity in as3 so i suggest you use it the way its intended.

So what is all the hubbub and bugaloo about polymorphism? The concept polymorphism along with the use of similar types allows a developer to create multiple types of CONCRETE classes that will be interchangeable either during run time or when the time comes to making changes.

A very powerful concept to remember when abstracting your classes and enforcing encapsulation.

October 22, 2008

Latin I Characters

Filed under: AS 2 — Tags: , , — iBen @ 3:26 am

Frequently any flash developer may be asked to add particular characters into a text field, either to accommodate legal or just as a desire from the client to match the exact name of a product.

As you know, flash has the ability to read both Unicode as well as Ascii characters, which is a good thing because as long as these are understood, our lives are made easier when implementing such characters like TM.

Unicode was added into flash for multilingual purposes, all keys on the keyboard have Ascii code attached to them and both can be used to arrive at the given character we are attempting.

Although, Ascii can only be read by a text field when htmlText is used, while Unicode can be used and interpreted in either htmlText or regular text. This makes Unicode the preferred way to insert unique characters into a textfield.

How do you find Unicode values or Ascii Values?
On a pc machine in accessories, there is a character-map application that allows you to choose a font and browse its unicode selections. This will be denoted in the lower left corner with a U+(somnumbers) to add this character into a body of text make sure that you use the regular expression for unicode “\u(somNumbershere)”. No matter if you were applying this to text or htmlText as long as you have that character embedded in your font that character is guaranteed to appear. The CopyRight and Registered are generally found in the Latin I fonts when specifying which characters to embed.
When choosing the Unicode, to the right of the application you will find Alt-(someNumbers) Which is the Ascii equivalent if you add it into flash as “&#(someNumbers);” The font remember must have the character embedded within, as well as this can only be inserted in htmlText to use.

If for some reason you want to turn Ascii into Unicode you can by calling the static method fromCharCode on the String class and passing only the numbers as a paramater.


So why can ascii only be read as htmlText? Actually it has more to do with 2 things than just the htmlText. While html=true; it allows htmlText to interpret the <>&# characters as having expressions in a given order. If html=false, the following line will show a different line than you may have expected :

htmlText=’<'font'>‘ HELLO ‘<'font'>‘

What you may have expected to see because it was added into the htmlText property is HELLO within the field, but because html is not turned on, the < (less than sign) is interpreted as exactly that rather than the beginning tag to an html attribute.

October 11, 2008


Filed under: SourceCode — Tags: , — iBen @ 6:39 pm

What is the point of scale9 if it is only good for vector drawings? Recently I threw this together to make my life easier with having the ability to now apply scale9 to bitmaps without having any distortion.

This current version is as2, and the interface is through a movie Clip. I would have rather made it a class but the use that I had for it was specifically used to interface with a movieclip.

The use is to attach the movieClip to the stage and pass a reference to your bitmap that you wish to apply scale9_plus, give it a proper rectangle as you would with regular scale9, and lastly give it the new width and new height and you will have scale9_plus applied automatically.

For those that don’t know how to create the scale9 rectangle but know how to do it via a movieClip with the hash lines, you can do this to a movieClip and then supply that movie clip’s scale9Grid property as the rectangle to use with your scale9_plus.

4 bitmaps with scale9_plus applied

4 bitmaps with scale9_plus applied

Download Scale9_Plus Source

Powered by WordPress