openframeworks – Xcode 4 on os x lion

27:

I’m sure there lots of programmers around who don’t know about anything c++, xcode and openframeworks technologies…So, sometimes we loose tons of time in order to get over very small issues like defining folder paths, potting files into correct place, or doing some operations in correct sequence, etc… And the funny part is, most of the time you can’t find any sources on the web in such situations. Don’t know why. May be it’s just related with me :)

First of all I need to tell my exact system running on my computer, so you check everything and be sure what’s going wrong..

1- donwload the 007 version release of openframeworks

2- my OS is OS X LION

3- Xcode 4

Installing Xcode4 is the most easy part as you expect… There is nothing tricky parts. After installation, place the “of_preRelease_v007_osx” folder anywhere in your hard drive. Xcode 4 is different then previous Xcode versions in terms of GUI. Don’t know it’s good or bad, but after some days I get used to new GUI. I think, it’s really comfortable to manage things easly…

Anyways, to copile and openframeworks examples;

1- Navigate to of_preRelease_v007_osx-> apps -> examples

2- Select one of the example project that you desire and double click to *.xcodeproj file

3- Here is the tricky part :)   ”of_preRelease_v007_osx”  was released before Xcode4 so it doesn’t know anything about the osx 10.7 SDK. Firstly, you need to change BASE SDK for the project. To do that click onto project file and set BASE SDK to MAC OS X 10.6 as follows;

 

 

 

 

 

 

 

 

 

 

 

 

 

4- Hit the Run button to compile and debug the project

In the next tip I’ll explain how to create a new project from scratch..and add addons folders libraries to the header files…

Font Embed Bug on Flash Builder 4.5

posted by on 2011.09.27, under Action Script, Solution Center
27:

Embedding fonts in Flash Builder is so easy as follows. However, in some cases that I have no idea, Flash Builder changes the fonts in your application. To fix that, just goto topbar Project->Clean…Then Flash Builder refreshes your project and everything is gonna be fine :) This is just a reminder for myself. I’m sure, I’ll forget the fix for this issue when I exprience it again.

[Embed(source="com/alptugan/assets/font/HelveticaNeueLTPro-Roman.otf", embedAsCFF="false", fontName="roman", mimeType="application/x-font")]
public var Roman:Class;

[Embed(source="com/alptugan/assets/font/HelveticaNeueLTPro-Bd.otf", embedAsCFF="false", fontName="helvetica-bold", mimeType="application/x-font")]
public var Bold:Class;

[Embed(source="com/alptugan/assets/font/HelveticaNeueLTPro-ThCn.otf", embedAsCFF="false", fontName="helvetica-thin", mimeType="application/x-font")]
public var Thin:Class;

Quick Tip: Is DiplayObject added to stage or not?

posted by on 2011.08.10, under Action Script, Solution Center
10:

Today I’ve been coding with as3 and need to know about a DisplayObject is added to stage or not. Here is a simple way to know that;

myMC = new MovieClip();

trace(this.contains(myMC));
//output: false

addChild(myMC);

trace(this.contains(myMC));
//output: true

Quick Tip: Download Files Via SWFs Using FileReference

posted by on 2011.07.17, under Action Script, Solution Center
17:

I’ve been thinking about writing tutorials at Activetuts+. New tutorials will be coming soon. You can check the fist tutorial that I wrote from here.

Flash Builder – Debug Player Connection Timeout / Wrong Player

posted by on 2011.07.14, under Solution Center
14:

It’s a so common issue for me. Whenever I install a new Flash Player version or a new software (really I don’t know why it’s happening!!), Flash Builder gets confused about debugging. And I start to experiment with the problem endless hours..In some way, I make it work. But most of the time, the solition is uninstall all of the Flash Player and Debugger versions and also Flash Builder from my computer. Then, re-install everything again..What a suffer..

I couldn’t find any consistant fix for that issue. I wrote many e-mails to Adobe, but no chance!!!

Few hours ago, it’s happened again, and I lost 6 hours or something more. Because of that issue I couldn’t finish my client’s work also. At last, I realised that the solition is so simple. Hope it helps someone else who is suffering from the debugging issue in Flash Builder appearing randomly. And it’s a reminder for me also. Don’t wanna loose hours for the next time. It really pissed me of this time.

Well, the solution as follows;

1- Turn back to defaults for every preferences in the Flash Builder

 

 

 

 

 

 

 

Delete the text in the “Standalone Adobe Flash Player” and Web browser” fields.

 

 

 

 

 

 

 

 

2- This is the magic part (!) Just right click on a swf file in your computer and select “get info”

 

 

 

 

 

 

 

 

 

Select the desired latest Flash Player/Debugger that you want. For me, Flash Builder located to Flash Player 10.1..But, my sdk was Flex_4.5.1. The minimum player version has to be 10.2 in order to use flex_sdk_4.5.1. I chose “Flash Player Debugger 10.3″ from the list.

 

 

 

 

 

 

 

 

And DO NOT FORGET to hit “Change All…” button inthe info window.

 

 

 

 

That’s all!

3- Turn back to Flash Builder and hit “Debug” icon. It should work.

 

 

 

 

 

 

 

 

If you know the reason is why, just please tell me :) I’ve been using Flash Builder/Flex for two or three years and have no idea about the problem. May be it’s related with the location.

 

Update (November/12/2011)

if the method that I mentioned above, you can try to connect flash debugger player manually. To do that;

1- Run/Debug your application from Flash Builder

2- When the progress tab stucks at 57% or something else, wait for the flash player/debugger window appears.

3- On the browser or the window, right click on it and select “Debugger” (To do that you have to have Flash Debug Player Version both for browser and stand alone application. You can download debugger version of Flash Player from adobe’s web site)

 

 

 

 

 

4- Select “At IP Address” and type “127.0.0.1″, hit continue. It should work. I hope :) At least worked for me

 

 

List of XML and HTML character entity references

posted by on 2010.11.23, under Action Script, Solution Center
23:

Quick post for myself :) While I’m writing xml files, always always forget how to type entities. Here is the link from wikipedia

Sometimes, in xml attributes I need to use “&” character, but it can be problematic. And, I can’t find any solution for this issue. We can use  <![CDATA[ ]]> for xml nodes, but not for attributes. So for me the only possible way is to use character entities. eg:

//in xml node
<content><![CDATA[me & others]]></content>

//in xml node
<content title="me amp&; other"/>

			
		

Quick Tip – Return Vector Array

posted by on 2010.11.09, under Action Script, Solution Center
09:


If you try to return a Vector typed array in flash, you’ll get the following error.

public function getMainItems():Vector
{
	//Length of Main items
	MainItemLn = xml.item.length();

	//Vector class of MainItems
	var MainVO:Vector     = new Vector.<VOItem>(MainItemLn,true);

	for(var i:int = 0; i < MainItemLn; ++i)
	{
		MainVO[i]        = new VOItem();
		MainVO[i].id     = i;
		MainVO[i].title  = xml.item[i].@title;
		MainVO[i].img = xml.item[i].@img;
	}

	return MainVO
}

1067: Implicit coercion of a value of type __AS3__.vec:Vector.<com.Gallery:VOItem> to an unrelated type __AS3__.vec:Vector.

It is because Vector.<VOItem> isn’t the same type as Vector. That means;

public function getMainItems():Vector.<VOItem>
{
	//Length of Main items
	MainItemLn = xml.item.length();

	//Vector class of MainItems
	var MainVO:Vector     = new Vector.<VOItem>(MainItemLn,true);

	for(var i:int = 0; i < MainItemLn; ++i)
	{
		MainVO[i]        = new VOItem();
		MainVO[i].id     = i;
		MainVO[i].title  = xml.item[i].@title;
		MainVO[i].img = xml.item[i].@img;
	}

	return MainVO
}

And you can get your Vector array values like;

trace(getMainItems()[0].title);
//or
trace(getMainItems()[1].title);
//and so on..
.
.
.

**Note: VOItem is my custom Value Object Class. It doesn’t matter what it is. It can be movieclip, sprite, etc…

Some Usefull Shorcuts for Flex/Flash Builder

posted by on 2010.11.07, under Action Script, Solution Center
07:

Sometimes, looking for some variable or function in the program can be very hard find. For me, this issue always distracts my focus on application. Or, I can be very lazy to comment out /* */ some code block. Anyway, I would like to tell you some of the life and time savers of the shorcuts that I’m using frequently.

1. Cmd + Shift + O: Removes all of the unused imports from your file.

2. Cmd + Shift + C: Comments out the selected block or line with /* */ chars.

3. Control + Alt + H: I think this is the most wonderful one. Searches the selected function name in your project and lists all of them line by line.

4. Cmd + M : Maximizes Flash Builder/Flex window to view only editor window. You can switch back to previous view with the same shortcut also.

5. Cmd + L : When you type this. A little pop-up appears and asks you to type a line number. When you type the number and hit enter, it jumps directly to this line.

6. Cmd + Left Mouse Click : e.g, you have an instance name like “foo”. But you forgot the decleration of the variable. To find the decleration, just press Cmd and move mouse pointer onto “foo”. Then “foo” turns to “foo” underlined in blue color. If you click on it, you will jump directly to the decleration of the variable. Besides that, if you click onto decleration while holding down Cmd key, action Script class of the decleration will be opened in the editor.

7. Control + Tab: Switches between editors/tabs.

8. Cmd + O: Shows you all of the vars, function, methods, etc… in the class. And you search specific names from the opened window.

Please note if I am missing another usefull shortcut.
By the way, there is also a shorcut to view all of the showtcuts :)
Cmd + Shift + L

Redirecting domains to www with .htaccess file

posted by on 2010.08.02, under Solution Center
02:

If you have Linux server on your web site, you can easily redirect your “domain.com” to “www.domain.com” with .htaccess file. Every Linux based servers have .htaccess file. However, because of the “.”, it’s a hidden file. So, you can’t view unless you set your ftp client’s “view” property to “show invisible files”. You can turn on “show invisible files” with most of the ftp clients such as FileZilla, Transmit and etc…Even if you enable “show invisble files”, can’t you see the file? So there is an easy way. Just create by yourself in one of the text edit software such as Textedit or Notpad.

1- Open a blank document file with Notepad or Text Edit.

2-

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

**change domain.com and www.domain.com with your domain name.

3- Save the file as .htaccess without any extension.

4- Upload the file to your server with your ftp client

that’s all. Now check your browser and it’ll work. If you type onto your browser “http://domain.com”, it will be redirected to “http://www.domain.com”

Online Font Converter Tool

posted by on 2010.07.24, under Solution Center
24:

This is a great tool for converting font types online. The best part is you don’t have to sign up or be a member of the web site. Cool!

link

pagetop


Get Adobe Flash playerPlugin by wpburn.com wordpress themes