jQueryでイメージのソースを変更する。

2009年05月26日(火)

この記事には誤りが含まれていますので改正しました。
JQueryでイメージのソースを変更する。改正記事

JQueryでイメージのソースを変更する場面はよくあるので
メモっときます。


photo=$("#photo");
document.photo.src='test.jpg';

//クラス名や複数の場合は
thumbs=$(".thumbs");
thumbs[2].src="thumb.jpg";

こんなことゆーのは憚られますが、
つかえばつかうほど、jQueryはよくできてるのだと思います。

AS3 TextFormat setTextFormatの種明かし編

2009年05月26日(火)

kayacさんの開発者ブログにあってよかったです。

それによると、

setTextFormat( ) でセットした場合は、今入力されている文字に適応されます。
が、それ以降入力されたものには適応されません。

defaultTextFormat でセットした場合は、現在入力されてる文字には適応されず、それ以降入力された文字に適応されます。

だそうです。
・・・
・・・
・・・。
つまりsetTextFormatは、TextField.textで内容を変更した後に
setTextFormat(TextFormat)であれば適用されるのですね。
その後textプロパティが変更されると、defaultのTextFormatが適用されると。

AS3 TextFormatでfontを変更して適用した

2009年05月26日(火)

テキストフォーマットをsetTextFormatと一生懸命やってたのに
全然適用されないのはなぜでしょう。

var textformat=new TextFormat();
textformat.font="_sans";
//テキストフィールド作成
var tf=new TextField();
tf.defaultTextFormat=textformat;

SQLiteにはDate型がないのかしら?

2009年05月24日(日)

どーりで、SQLiteManagerで入らないと思ったのです。
さぐりさぐりやってると、ものすごく基本的なところでつまづきます。

!important

2009年05月24日(日)

Style sheet designers can increase the weights of their declarations:

H1 { color: black ! important; background: white ! important }
P  { font-size: 12pt ! important; font-style: italic }

In the example above, the first three declarations have increased weight, while the last declaration has normal weight.

A reader rule with an important declaration will override an author rule with a normal declaration. An author rule with an important declaration will override a reader rule with an important declaration.

http://www.w3.org/TR/REC-CSS1/#important

要するに、! importantがある属性は、後からのオーバーライドを無視します
といった内容だと。

syntaxhighlighterのCSSを変更しようと試みたときにふと気づきました。
!importantってなんじゃらほいと。
よくみるのですが、CSSをずいぶんおざなりにしていたせいでしょうか。
すっかり存じ上げませんでした。

MySQLのDATE_FORMAT

2009年05月22日(金)

これを!こいつを!
いつも忘れてしまってるので、もう忘れないように!!
ものすごく基本的なところなのにね。恥ずかしい。

SELECT *,DATE_FORMAT(reservation_date,'%Y年%c月%e日') as `input_date` FROM reservation ORDER BY reservation_id DESC

http://dev.mysql.com/doc/refman/4.1/ja/date-and-time-functions.html

AS3 Timer

2009年05月21日(木)

var duration=5000;//ミリ秒

var myTimer:Timer=new Timer(duration,3);

//5秒おきに実行
myTimer.addEventListener(TimerEvent.TIMER, timerHandler);

//3回終了した時に実行
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteHandler);
myTimer.start();

AS3 XML要素の数取得

2009年05月21日(木)

children().length()ってのがあまりみたことなかったので。

import XMLloader;

//xml読み込み
var xmlloader=new XMLloader("sample.xml",true);
xmlloader.addEventListener(xmlloader.LOAD_COMPLETE,loadxml);

//全てのアクションは、XMLロード後に行う
function loadxml(event) {
	var my_xml=event.target.getXML();
	trace(my_xml.children().length());
}

AS3 Rectangle

2009年05月18日(月)

ふわりとしたイメージで使っていましたが
Rectangleとは
x,yとwidth,heightで定義される矩形だったんですね。
あんまり知りませんでした。恥ずかしい。

参考:http://help.adobe.com/ja_JP/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7dc9.html

import flash.geom.Rectangle;
var rect1:Rectangle = new Rectangle(x1, y1, width1, height1); 

//DisplayObjectのメソッドでgetBounds()、getRect()というものもありました。
var bounds=getBounds(mc);
var rect=getRect(mc);

trace(bounds,rect);

AS3 TextFieldの選択可否

2009年05月18日(月)

またまたでました。
選択させんじゃないよ。


textFiled.mouseEnabled = false;