スタッフブログ株式会社クオリアシステムズ スタッフによるブログ

∧
5


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Flash+XMLキャッシュ

2010-11- 1 / Category :: / Author :: ren | コメント(0) | トラックバック(0)

FlashにXMLを読み込む際に、気をつけなければならないのがキャッシュ。
キャッシュを残さずに毎回訪問する度に新しい情報を表示させなくてはならないので、XMLを読み込む際に一工夫。

//0~9999のランダムな整数randNumをつくる
var randomNum:Number = Math.floor(Math.random()*10000);
//外部XMLファイルの指定
_urlLoader=new URLLoader(new URLRequest("ファイル名.xml?" + randomNum));

こうする事で、読み込まれるXMLのURLの末尾に?から始まる数字列が入る。結構大事な処理かもしれないです。

Flash+Twitter クロスドメインポリシー

2010-10-30 / Category :: / Author :: ren | コメント(0) | トラックバック(0)

Twitterもクロスドメインポリシーの関係でFlashからはAPIに接続できないのでPHP経由で取得
swfと同一階層にphpデータを置いた場合。

var xmlURL:String = "crossdomain-proxy.php?url=この部分を下記に変更"; xmlLoader = new URLLoader(); xmlLoader.load(new URLRequest(xmlURL));

Twitterユーザー全員の発言情報(最新20件)
http://twitter.com/statuses/public_timeline.xml

友達の発言情報(最新20件)
http://twitter.com/statuses/friends_timeline/自分のユーザーネーム か IDナンバー.xml

自分の発言情報(最新20件)
http://twitter.com/statuses/user_timeline/自分のユーザーネーム か IDナンバー.xml

自分の友達のリスト情報
http://twitter.com/statuses/friends/自分のユーザーネーム か IDナンバー.xml

followしてくれているユーザーリスト情報
http://twitter.com/statuses/followers/自分のユーザーネーム か IDナンバー.xml

crossdomain-proxy.phpの内容

<?php
$post_data = $HTTP_RAW_POST_DATA;
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($post_data);
preg_match("/url=(.*)/",$_SERVER['REQUEST_URI'],$params);
$ch = curl_init( $params[1] );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
if ( strlen($post_data)>0 ){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
$response = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
header("Content-type: text/xml; Content-length: ".strlen($response));
print $response;
}
?>

縦書きJavascript2

2010-07-22 / Category :: / Author :: ren | コメント(0) | トラックバック(0)

先日紹介した縦書きのスクリプトにはちょっとした欠点がある。

フォントの装飾方法が大分古めという点。

fontタグを使用して、大きさや色を切り替えなければならない。

何だかHTML初期を彷彿させますね。

縦書きJavascript

2010-07-21 / Category :: / Author :: ren | コメント(0) | トラックバック(0)

ブログや小説系の読み物を中心としたサイトの場合、縦書きの方が読みやすかったりする場合がある。

そこで、発見したのがこの仕組み。結構ユーザーもいるようだ。

まずは、ヘッダ部分に下記スクリプトを記述


<script charset="utf-8" type="text/javascript" 
 
src="http://nehan.googlecode.com/hg/nehan.js"></script>
<script type="text/javascript">
  window
.onload = function(){
   
Nehan.LayoutMapper.start("div", {
     charImgRoot
:"http://nehan.googlecode.com/hg/char-img",
     fontFamily
:"MS ゴシック, Osaka-Mono",
     filter
:"direction",
     noBR
: false,
     onSeek
: function(groupName, seekPercent){ },
     onComplete
: function(groupName){ },
     onCompleteAll
: function(){ }
   
});
 
};
</script>


後は縦書きにしたい部分を下記のように記述。

<div class="lp-vertical lp-width-400 lp-height-300 lp-font-size-12">

ここに縦書きにしたい文章を記述する。

</div>

ルビをふりたい場合は、<ruby><rb><rt>タグを使用すれば、ルビまで縦書きになってくれる。


以上の内容はこのサイトを参考しました。

http://tategakibunko.blog83.fc2.com/blog-entry-411.html

いつか使ってサイトをデザイン、構築したいものです。