2次ベジェを3次ベジェにする
とりあえずコントロールポイントを
アンカーポイント方向に1/3移動してやればよし
アンカーポイント方向に1/3移動してやればよし
import fl.motion.BezierSegment
import flash.geom.Point;
import flash.display.Sprite;
var pntA:Point=new Point(50,200)
var pntB:Point=new Point()
var pntC:Point=new Point(500,200)
var spr:Sprite=addChild(new Sprite())as Sprite
spr.addEventListener(Event.ENTER_FRAME,onFrame)
function onFrame(e){
pntB.x=mouseX
pntB.y=mouseY
with(spr.graphics){
clear()
lineStyle(1,0x55FFFF)
moveTo(pntA.x,pntA.y)
curveTo(pntB.x,pntB.y,pntC.x,pntC.y)
moveTo(pntA.x,pntA.y)
lineStyle(1,0xFF5555)
}
var bez:BezierSegment=new BezierSegment(pntA,Point.interpolate(pntA,pntB,1/3),Point.interpolate(pntC,pntB,1/3),pntC)
for(var i=0;i<=1;i+=1/10){
pntB=bez.getValue(i)
spr.graphics.lineTo(pntB.x,pntB.y)
}
}
AS3のクラスファイルから関数一覧表をつくる
半分AS3の話
AS3のクラスファイルからInDesignで↓のような表を作る為のJSX

まだもうちょっとスタイルいれたりとかするつもりなんですが
コレぐらいのほうがちょうどいいのかなとも思う
コレに限らずですが動作の保証はできません
僕の書いたコードではちゃんと動いただけ
AS3のクラスファイルからInDesignで↓のような表を作る為のJSX

まだもうちょっとスタイルいれたりとかするつもりなんですが
コレぐらいのほうがちょうどいいのかなとも思う
#target "InDesign"
main()
function main(){
var doc=app.documents.add()
var codeBox=doc.textFrames.add()
var tableBox=doc.textFrames.add()
var file=File.openDialog ("ASのコードファイルを選択")
codeBox.geometricBounds=[20,20,277,190]
tableBox.geometricBounds=[20,20,277,190]
//選択ボックスを空にして行送りを0に
codeBox.contents="your code here"
codeBox.paragraphs[0].leading=0
file.open("r")
codeBox.contents=file.read()
file.close()
//強制改行を全て改段落に
codeBox.contents=codeBox.contents.replace(/[\n\r]+/g,"\r")
//コメントを削除
codeBox.contents=codeBox.contents.replace(/\/\*.*?\*\//g,"")
codeBox.contents=codeBox.contents.replace(/\/\/.*?([\n\r]+)/g,"$1")
//行頭スペースを削除
while(codeBox.contents.match(/\r\s+/))codeBox.contents=codeBox.contents.replace(/\r\s+/g,"\r")
//クラス定義部分を抽出
codeBox.contents=codeBox.contents.replace(/package.*?\{.*?class.*?\{(.*)\}.*?\}/g,"$1")
//なくなるまで{....}を削除
while(codeBox.contents.match(/\{[^\{]*?\}/))codeBox.contents=codeBox.contents.replace(/\{[^\{]*?\}/g,"")
//内容を表に移す
var tbl=tableBox.tables.add(LocationOptions.AT_END,null,{columnCount:3,bodyRowCount:1})
with(tbl.rows[0]){
autoGlow=true
minimumHeight=2
cells[0].contents="関数"
cells[0].width=30
cells[1].contents="戻り値"
cells[1].width=20
cells[2].contents="引数"
cells[2].width=120
}
for(var i=0;i<codeBox.paragraphs.length;i++){
var codeln=codeBox.paragraphs[i].contents
if(codeln.search(/^[^=]*?function.*?\(.*\).*$/)!=-1){
var tgtRow=tbl.rows.add(LocationOptions.AFTER,tbl.rows.lastItem())
with(tgtRow){
cells[0].contents=codeln.replace(/^.*?function\s*(.*?)\(.*$/,"$1")
cells[1].contents=codeln.replace(/^.*?\(.*?\).?(.*)\r/,"$1").replace(/\s+/,"")
cells[2].contents=codeln.replace(/^.*?\((.*?)\).*$/,"$1")
}
}
}
codeBox.remove()
}
コレに限らずですが動作の保証はできません
僕の書いたコードではちゃんと動いただけ

