Introduction to Object-Oriented Programming–1 (Classes)

24 May, 2009 – 11:31

Although “Object-Oriented Programming” combination of these words is scary for beginning programmers, but after beginning the OOP it turns out that all process is not so hard actually. I think the difficult part for beginner is always adaptation process. For making this process little easier I will make a short introduction to object-oriented programming. In this and the next few sections I will explain the basic terms and they part of work in object oriented programming.

Classes and Objects

Classes are code snippets which do simple tasks for us. To do a specific job, sometimes one, sometimes several different classes at the same time can be used. For using these classes we have to create an Object of a class.

For example, let say there is an image animation that you use in every project you’re working on, which is working with 40 lines of codes. Normally (when writing code in timeline), you have to copy and paste these 40 lines of code every time you want to use the animation. Rather than that you can write bit of more code and turn that animation code as a single ActionScript file. In this case has been developed a Class. You can use the animation of this class file in Timeline or in another Class structure. But whenever you use the Class file you have created you are actually creating and using Object. Which means an Object is instance of a class file.

Read the rest of this article »

Transition from Procedural Programming to Object Oriented Programming

6 March, 2009 – 22:47

There are few small topics that you have to learn before you start programming OOP. Before I start I want to mention a feature which same with Flash CS3. With Flash CS3 we were not able to write codes on Buttons or MovieClips. This was not a good feature for lots of developers. But I find this feature very useful, because as a developer I am not favor of seeing 100 pieces of code all around of one simple project. Of course there is no such a rule which say; you have to write all code in 1 frame”, but writing code on each button and movie clip which is added to project is also not a good work style. Anyway in this article I will cover how to use Document Class, Library Objects and Classpath.

Document Class

With Flash CS3 new feature introduced called “Document Class”. With this feature now we can integrate class files without adding any code in timeline. Of course if you want you can still use timeline but as a developer you have to decide it is necessary or not.
Usage of Document Class is very simple. First you have to make a class file that you want to use as a Document Class. Than you have to add name of this class in the Document Class property of the flash document which you can reach from Properties panel.

Here is a simple class for purpose of testing;

Read the rest of this article »

What is Object Oriented Programming?

4 February, 2009 – 21:35

Before starting to the topic I want to mention this is a first part of series article about Object Oriented Programming (OOP). As is not easy to cover OOP with detail in couple articles I thought would be better to divide to the pieces. First I will be covering basics of OOP and than I am planning to write about Design Patterns.

Object Oriented Programming

In basic understanding OOP is; making objects from pieces of solution out of existing problem. The goal is to having those objects ready to use for similar problems in future. The advantage of OOP is that you could manipulate each piece of solution fast and easy. Because solution of problem divided many useful pieces, manipulating single piece of solution it’s also fast and easy. Manufacturing systems will be good example for this.

Read the rest of this article »

Programming and Education about Programming

5 January, 2009 – 01:15

The main target of this article is to answer different questions that I get about programming and process of learning programming. The questions are usually comes from people who working in different programming language and want to learn to new one, information about programming academies, about programming, and how hard is language. That’s why I think article may help to people who want to start to learn new programming language and who all ready did start. (The article mostly about how I think and about experience that I had. Generally I don’t think there might be the so much different between different countries, but this is also open topic)

Programming and Being Professional in Programming Language

Programming basically is not an easy but therefore an enjoyable work/job.  Of course this is relative to the language you use, work you do, application you do and so on. Anyway as a description I could say Programming is not learning a programming language, programming is learning to be able to program. I think programmer should be able to see programming language it is not as a target that have to reach, instead have to see as a tool that he/she have to use. A programmer should be able to work in more than one programming language. If you are able to use ActionScript 3.0 there is no reason why you can not program in Java or JavaScript. Of course syntax of those languages may be close to each other but my point is if you are able to program in certain programming language you should also be able to program with some other language too. The key point is the learning basics of the language, with other term learning the syntax. Rest of the knowledge you need you will get it piece by piece when you need it.

I don’t want you to get wrong. Being able to programming and being professional in certain language is totally different things. Being good in programming will help you to work with different platforms much more easily. But being professional in programming language means developing your self in certain field. Being professional in certain language is always give you chance to work in the better place and certain kind of works with it.

Read the rest of this article »

Using Actionscript 3 Language Reference in Flash CS4

18 December, 2008 – 21:03

Being able to program with an language is not mean you have knowledge of all the methods, parameters, structure etc. I would say; good is as language documentation is easy to find and use the functionality of the language from developer perspective. I love ActionScript 3.0 language reference, first was bit on not understandable but currently is everything I need. In Flash CS3 you can simply press F1 and see the language reference. Of course you can reach that also online;

http://help.adobe.com/en_US/Flash/10.0_UsingFlash/

The main problem I had was the when I press F1 in Flash CS4 instead of help panel my default browser was trying to connect the online documentation. Of course now days you can find internet everywhere but I still do prefer to reach language reference on my computer. For just getting information about an event or an method I have to connect internet wait for page to be open, than click over and over again. For me this is such a waste of time and simply I don’t like it. But there is a solution for this problem. The copy of language reference is being installed when you install copy of Flash CS4. There is two ways to reach this documentation, first is finding on operating file system.

On windows operating system path is;
C:\Program Files\Common Files\Adobe\Help\en_US\AS3LCR\Flash_10.0\index.html

On Mac operating system path is;
/Library/Application Support/Adobe/Help/en_US/AS3LCR/Flash_10.0/index.html

On Linux operating system path is;
/Library/Application Support/Adobe/Help/en_US/Flash/10.0_UsingFlash/index.html

Read the rest of this article »

Digital Dictionary with Adobe AIR

1 December, 2008 – 00:02

I am using Adobe AIR since beta testing process. For me AIR is midpoint of desktop and web programming, which is one of the basic idea of Adobe AIR. I want to use soon as AIR 1.0 released and last week give it my first official AIR application to one of the software company’s that I am working with.

Digital Dictionary

We design a dictionary (Metallurgy Technical Terms Dictionary) application with AIR, the offer came to me at the first week of march. Same week I designed the working system and functionality. It is a Turkish-English Technical Terms Dictionary which has more than 98.000 terms and 125.000 explanations. Each explanation has it own field, formulas, signs some other explanation part. Of course the numbers of terms are total number of both languages. I use is SQLLite database system which is with all data is 6.34 MB.

The Dictionary has a live searching feature. When a user starts to type a term number of matching terms come up automatically, and this is a great feature of dictionary.

Read the rest of this article »

Reflection Class

28 November, 2008 – 15:41

Reflection effect is not something new but I accept that is effective and cool. For my current project I need it a Reflection effect. I found two on internet, but I had problems while I am trying them. One of them made problem for dynamic creation, and other one had problem with size of effect when were scaled down. If movie clip was 400×300 and scaled down to 200×150 it was creating normal size of effect and that was a huge problem. Because of those two problems I write my own Reflection class. It works fine for now but I may add some more functionality in future. If you need or just want to try you can download source code and you can use it for free. You can use example or read the below for detail and usage;

Read the rest of this article »

Security Violation of Swf Files

23 November, 2008 – 22:58

Loading external files in Flash is simple process. First you need to create a Loader object and than give address of material which is have to be loaded to Loader object. This is simple process which supposes to be work fine but there is a high chance that you may get in error. Especially when you try to reach the files under different domain names or same domain name but when you don’t type www to beginning of the domain name. For example lets say we have two different domain name and we want to keep common files in one server.

Farklı sunuculardan dosya yüklemek

The swf file under Server A is tyring to get images from server B. For server A to reach server B there muse be an crossdomain.xml file under Server B. When swf file works in Flash Player, swf file will try to get images from server B. Flash Player will check the crossdomain.xml file for which domain name is allow and which is not. Basically this xml file allows different domains to access to files. Xml file is look like this;

Read the rest of this article »

Using The Pixel Bender Filters in Actionscript 3.0

18 November, 2008 – 15:50

The best thing about Pixel Bender filters is soon we will have more amazing effects. I am not a person which is has a great background of math and I never work with image processing or with C. But the great part of Pixel Bender is you can use filters which is been created from someone else. This is similar like using classes in action script. Someone wrote good class and opens for public and everybody is using. So even if you are not the one who wrote filter still is good to know how to use them.

In this article I will explain how to use Pixel Bender Filters in Flash Player. Well probably you know that Pixel Bender filters can be use in Flash and After Effects. But if you want to use in flash you have to export the Pixel Bender file for flash. For exporting .pbj file you have to select “Export Kernel Filter For Flash Player” in File menu. I assume you all ready did that and I am passing the code which will be use in Flash.

Read the rest of this article »

Beginning To Pixel Bender - 2

7 November, 2008 – 16:24

This is a second part of “Beginning To Pixel Bender” article. If you didn’t read first one you can reach form the link at below.
http://enginyoyen.com/blog/eng/index.php/beginning-to-pixel-bender-1/

Colour Channels

32-Bit of image is have 4 color channels (A:alpha, R:red, G:Greeen, B:blue). Getting color channels in Pixel Bender is really easy. For reaching the channel color of pixel first you have to reach to pixel. For getting the pixel we can use sampleNearest() function. All we have to do is create a new variable and set data type as a pixel4. For assigning value to variable we will use the sampleNearest() function.

  1. pixel4 channels= sampleNearest(src,outCoord());

Read the rest of this article »