ダイナミックテキスト(スクリプトで生成した)のテキスト入力が一部のブラウザで日本語入力ができなかったり、
文字入力が全くできない現象に遭遇。

まずMac OSのSafariの場合Flash PLayerがdebuggerだと起こるみたいなので
通常のFlashPlayerに変更したら解決。

あと、Windows XP ,7のChromeの場合は
swfを埋め込むさいの設定でwmodeをtransparentもしくは未設定だと起こるらしく、
wmodeをwindowに設定で解決。

方法:
http://cocoasaurus.com/blog/2009/10/as3textfiled.html

それでもなおらない場合はChrome独自のFLashPlayerが原因と考えられるので、
Chromeの設定から独自のFlashPlayerを無効のすると解決するかも。

方法:
http://getnews.jp/archives/97367

| | トラックバック(0)

X線カメラで作品を撮る写真家さん

NICK VEASEY

NICK VEASEY

Official Site
http://www.nickveasey.com/

| | トラックバック(0)

最近、案件で慣れないjavascriptをゴニョゴニョしていたらIEでsetAttributeが効かなかった。
調べてみたら、いつものIEのバグだったという。

下記のように属性値を設定しようとする場合右のように小文字と大文字を組み合わせて書いたら動いた。

element.setAttribute("bgcolor","#ffffff"); → element.setAttribute("bgColor","#ffffff");

bgcolorとか今だに使ってるの?という苦情は一切受け付けません。

| | トラックバック(0)

久しぶりにCSSやったら初歩的な部分ではまった。

こんな感じでグローバルナビゲーションをマークアップすると思うのですが

<div id="globalNavi">
<ul>
<li>画像</li>
<li>画像</li>
<li>画像</li>
<li>画像</li>
</ul>
</div>
<div id="contentArea">
</div>

CSSで liに対してfloatさせると

#site #globalNavi {
	border-top: solid 4px #000;
	clear: both;
}
#globalNavi ul{

}
#globalNavi li{
	float: left;
}

#globalNaviと#contentAreaの間にマージンが空いてしまう。

イロイロやってみた結果。
DOCTYPE宣言が原因だったみたいなので。とりあえずDOCTYPE宣言を

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

にして

#globalNavi ul{
	line-height:0;
}

CSSでulにたいしてline-height:0;を指定したらなおった。

| | トラックバック(0)

Fash,PHPで検索が多いので簡単なサンプルをアップしました。

フラッシュからPHPに変数を送りPHP側でデータベースに送られて来た変数を保存してデータベースを元に
XMLを書き出しフラッシュ側でXMLを読み込み表示といった流れです。

※ソースは整理してからアップします。

以下サンプル
名前とコメントを入力してメッセージを送信すると下の部分に情報が反映されます。
(最新4件を表示してます。)

| | トラックバック(0)

FlashDevelpp3.2.1にアップデートして使ってたら
swfを書き出す時に「Cannot find output file」ってダイアログが出てくるようになった。
急いでる時とかとてもうっとしいので直したいと思いググッてたら。
下記のサイトで解決策がのっていた。
http://www.flashdevelop.org/community/viewtopic.php?f=6&t=6713&start=0

1
下の画像の赤枠の部分をクリックして開く。

flashdevelop

2
そーするとプロジェクトのPropertiesの画面が開く。
Outputタブの中の
No output, only run pre / post build commands.
のチェックをはずす。

3
で、Generalの中のOutput file:にswfファイルのパスを設定する。

4
2:ではずしたチェックを元に戻す。
これでダイアログは出なくなりました。

場合によって最初セキュリティソフトから警告画面が出ますが
一回許可すればそのあとは問題なく使えました。

| | トラックバック(0)

勉強がてらiPhoneアプリでシンプルなRSSリーダーを作ってみたみました。
右のAO TESTと書かれたアイコンがそうです。

アイコンをタップすると左の画像ようにスライドして画面が切り替わります。
(今回はgizmodo japanさんのxmlを拝借しました。)

タイトルをタップすると横にスライドしフィードのタイトル一覧が表示されます。
(今見るとページのタイトルが若干違いますが気にしないでください。)

気になるタイトルをタップするとSafariが起動しウェブサイトが表示されます。

ActionScriptと比べて、これだけの機能を実装するのにどんだけ面倒なんだよってちょっと思ってしまいましたが、
慣れればどうってことなくなるだろうと思うのでコツコツやることにします。

以下XMLを読んで表示するソース。
(行ごとの解説は後ほど書きます。)

#import "ViewController2.h"


@implementation ViewController2

//! メモリワーニングをした際に呼ばれるメソッド
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

-(void)viewDidLoad{
	
	[super viewDidLoad];
	
	
	if(m_read_dat){
		[m_read_dat release];
	}
	if(m_table_dat){
		[m_table_dat release];
	}
	if(m_section_dic){
		[m_section_dic release];
	}
	if(m_index_ary){
		[m_index_ary release];
	}
	
	
	NSURL *url = [NSURL URLWithString:@"http://feeds.gizmodo.jp/rss/gizmodo/atom.xml"];
	NSXMLParser *ps = [[NSXMLParser alloc] initWithContentsOfURL:url];
	
	[ps setDelegate:(id)self];
	[ps setShouldProcessNamespaces:FALSE];
	[ps setShouldReportNamespacePrefixes:FALSE];
	[ps setShouldResolveExternalEntities:FALSE];
	
	
	m_read_dat = [[NSMutableArray alloc] init];
	m_readable = FALSE;
	[ps parse];
	[ps release];
	
	
	//Create Table
	NSMutableDictionary *indexed_name_dic = [[NSMutableDictionary alloc] init];
	
	self.title = @"gizmodo japan";
	
	for (NSDictionary *dic in m_read_dat){
	
		NSString	*name = [dic objectForKey:@"title"];
		NSString	*site = [dic objectForKey:@"blog_url"];
		NSString	*published = [dic objectForKey:@"published"];
		NSString	*group_key = [published substringWithRange:NSMakeRange(2,5)];
		
		NSMutableArray *group_name_ary = [indexed_name_dic objectForKey:group_key];
		
		
		if(group_name_ary == NULL){
			group_name_ary = [[NSMutableArray alloc] init];
			[indexed_name_dic setObject:group_name_ary forKey:group_key];
			[group_name_ary release];
		}
		
		NSDictionary *add_dic = [[NSDictionary alloc] initWithObjectsAndKeys:name,@"title",site,@"blog_url",nil];
		[group_name_ary addObject:add_dic];	
	}
	
	int		ct = 0;
	NSArray *ary = [[[indexed_name_dic allKeys] sortedArrayUsingSelector:@selector(compare:)] retain];
	
	m_index_ary = [[NSMutableArray alloc] init];
	for(ct = [ary count] - 1; ct >= 0; --ct){
		
		[m_index_ary addObject:[ary objectAtIndex:ct]];
		
	}
	
	[ary release];
	
	NSSortDescriptor   *sort_desc = [[NSSortDescriptor alloc] initWithKey:@"title" ascending:NO];
	NSArray				*sort_desc_ary = [NSArray arrayWithObject:sort_desc];
	NSMutableArray		*temp = [[NSMutableArray alloc] init];
	
	for(NSString *index_char in m_index_ary){
		NSMutableArray *group_name_ary = [indexed_name_dic objectForKey:index_char];
		[group_name_ary sortUsingDescriptors:sort_desc_ary];
		
		NSDictionary *char_dic = [[NSDictionary alloc] initWithObjectsAndKeys:index_char,@"index",group_name_ary,@"name_ary",nil];
		[temp addObject:char_dic];
		[char_dic release];
	}
	[sort_desc release];	
	m_table_dat = temp;
}

//! テーブルビューのセクション数を返すメソッド
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
	return [m_table_dat count];
}

//! テーブルビューのセクションにある行の数を返すメソッド
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
	NSDictionary	*dic = [m_table_dat objectAtIndex:section];
	NSArray			*ary = [dic objectForKey:@"name_ary"];
	
	return [ary count];
}

//! テーブルビューのセクションヘッダの文字列を返すメソッド
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
	NSDictionary	*section_dic = [m_table_dat objectAtIndex:section];
	
	return [section_dic valueForKey:@"index"];
}

//! テーブルビューのセクションインデックスのタイトル文字列の配列を返すメソッド
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
	return [m_table_dat valueForKey:@"index"];
}

//! インデックスをタッチした際に呼ばれるメソッド
- (NSInteger)tableView:(UITableView *)tableView 
sectionForSectionIndexTitle:(NSString *)title 
			   atIndex:(NSInteger)index {
	return [m_index_ary indexOfObject:title];
}

//! テーブルにセルが表示される(出現する)際に呼ばれるメソッド
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }
    
    // Set up the cell...
	NSDictionary	*dic = [m_table_dat objectAtIndex:indexPath.section];
	NSArray			*ary = [dic objectForKey:@"name_ary"];
	NSDictionary	*name_dic = [ary objectAtIndex:indexPath.row];
	
	cell.textLabel.text = [name_dic objectForKey:@"title"];
	
    return cell;
}


//! セルが選択される直前に実行されるメソッド

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath{
	static NSString *MyIdentifier = @"Cells";
	
	// Try to retrieve from the table view a now-unused cell with the given identifier
	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
	
	// If no cell is available, create a new one using the given identifier
	if (cell == nil) {
		cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
	}
	
    // Set up the cell...
	NSDictionary	*dic = [m_table_dat objectAtIndex:indexPath.section];
	NSArray			*ary = [dic objectForKey:@"name_ary"];
	NSDictionary	*dic2 = [ary objectAtIndex:indexPath.row];
	
	// Safariを開いて、サイトに飛ぶ
	UIApplication *app = [UIApplication sharedApplication];
	[app openURL:[NSURL URLWithString:[dic2 objectForKey:@"blog_url"]]];
	
	return indexPath;
}

- (void)parser:(NSXMLParser *)parser 
didStartElement:(NSString *)elementName 
  namespaceURI:(NSString *)namespaceURI 
 qualifiedName:(NSString *)qName 
	attributes:(NSDictionary *)attributeDict
{
	// 要素名を保存(タグの名前)
	m_element_name = elementName;
	// タグ開始、辞書追加、フラグON
	if([elementName isEqualToString:@"entry"]){
		NSMutableDictionary		*dic = [[NSMutableDictionary alloc] init];
		
		[m_read_dat addObject:dic];
		m_readable = TRUE;
	}
	// タグ
	if(m_readable && [elementName isEqualToString:@"link"]){
		int		index;
		
		// 配列のインデックスを取得
		if([m_read_dat count] == 0){
			return;
		}
		index = [m_read_dat count];
		index = index - 1;
		if(index <= 0){
			index = 0;
		}
		
		// 配列から辞書を取り出す
		NSMutableDictionary	*dic = [m_read_dat objectAtIndex:index];
		if(dic == nil){
			return;
		}
		
		// 辞書にURLを追加
		[dic setObject:[attributeDict valueForKey:@"href"] forKey:@"blog_url"];
	}
}

- (void)parser:(NSXMLParser *)parser 
 didEndElement:(NSString *)elementName 
  namespaceURI:(NSString *)namespaceURI 
 qualifiedName:(NSString *)qName{     
	// タグ終了、フラグOFF
	if([elementName isEqualToString:@"entry"]){
		m_readable = FALSE;
	}
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
	int		index;
	
	// 配列のインデックスを取得
	if([m_read_dat count] == 0){
		return;
	}
	index = [m_read_dat count];
	index = index - 1;
	if(index <= 0){
		index = 0;
	}
	
	// 配列から辞書を取り出す
	NSMutableDictionary	*dic = [m_read_dat objectAtIndex:index];
	
	if(dic == nil){
		return;
	}
	
	// フラグ
	if(!m_readable){
		return;
	}
	
	// タグならば辞書に追加
	if([m_element_name isEqual:@"title"] || [m_element_name isEqual:@"published"]){
		[dic setObject:string forKey:m_element_name];
	}
	// 要素名を空にする
	m_element_name = @"";
}


@end
| | トラックバック(0)

最近はずっとiPhoneアプリ開発の勉強中。

やる前はよくAS3と全然違ってて意味不明というような噂を耳にしましたが
実際やってみて思ったのは見た目が違うだけで全く違うってのは言いすぎな気がした。

で、iPhoneアプリ開発用に現在3冊の本を購入。
最初に購入したのがこちら↓↓↓

iPhoneプログラミングUIKit詳解リファレンス

iPhoneプログラミングUIKit詳解リファレンス

まずUIKitって意味をわからず買ったのですが、
初心者でも序盤はなんとか着いて行ける感じです。
この本の特徴はインターフェースビルダーを使わずガンガン
コーディングしていくというスタンスなのでそんなハードコア
に最初からは無理って人は↓で紹介している本
ライトウェイト・プログラマのためのiPhoneアプリ開発ガイド
を読むといいと思います。
がUIKitに特化した本なのでこれは持っておいた方がいいと思います。

iPhoneアプリケーションプログラミング

iPhoneアプリケーションプログラミング

この本は結構、解説おおめでした。
特に序盤は睡魔が牙を剥いて襲ってきます。
はじめに基本概念から固めたい人や夜眠れない人に
オススメな気がしました。

が、一冊目の本で手動かしてやってた分、
細かい部分で理解が深まった感もあります。
この本の活用法としては電車の中とかでゆっくり読み進める用
にしてモヤモヤしてる部分がだんだんスッキリしてくる効果を
狙うのがいいかと思います。漢方みたいに。

で次に買った本がこれ

ライトウェイト・プログラマのためのiPhoneアプリ開発ガイド

ライトウェイト・プログラマのためのiPhoneアプリ開発ガイド

ジャケ買いです。
今まさに読書中なのですが、最初に買うならこの本だなと思います。
解説がわかりやすいしサンプルが充実してる。

| | トラックバック(1)

ピカソというとよくキュビズムの作品がクローズアップされがちだけど個人的には↓の頃の絵が大好き。

海辺を走る二人の女(駆けっこ)

[海辺を走る二人の女(駆けっこ)]

この絵の爽快感がたまらない。
居間とかに飾ったら空間そのものがドカーンと広がった気分にしてくれそう。
まだ生でみた事がないのでいつかじっくりとぼんやりと眺めたい一枚。

コリーダ:闘牛士の死

[コリーダ:闘牛士の死]

闘牛士がどえらい事になってます。しかも馬が乱入してる(笑)。
とにかく画面全体にパワーが凝縮されたような絵。
個人的にはピカソの中でもダントツで好きな作品の一つ。

こちらは10年位前に竹橋かどこかの美術館で見たんだけど意外とサイズは小さい。

F12号ぐらいだった。
これぐらいパワーにあふれた絵を100号くらいで描いてみたい。

| | トラックバック(0)