1 2 3 4 5 6 7 8 | stop(); function frameEvent():void{ tf.text = "This textfield is on frame 2."; } addFrameScript(1, frameEvent); gotoAndStop(2); |
Oct 242007
You can add ActionScript codes to a specific frame using MovieClip.addFrameScript() method. The method is not documented, like setTimeout in the earlier version. And, mind that the frame numbering is zero-based.
특정 프레임에서 다른 프레임에 액션스크립트를 지정할 수 있는 메소드가 있었네요. MovieClip.addFrameScript()가 바로 이런 기능을 하는 메소드인데, 액션스크립트 도움말에는 포함되어 있지 않은, 미공개 메소드입니다 (이전 버전의 setTimeout 처럼 말이죠). 단, 프레임 번호는 0부터 시작한다는 것만 주의하면 됩니다.
特定フレームにActionScriptコードを追加出来るメソッドが在ったんですね。それはMovieClip.addFrameScript()です。このメソッドはヘルプには記載されていません。(以前バーゾンのsetIntervalのように…)。ただ、フレーム番号は0から始まるんですよ。
Oct 222007
I made a watermark effect. I added addWatermark() method to BMPFunctions.as file which I revealed earlier. You can download the class file from the following link.
비트맵데이터에 워터마크를 넣는 효과를 만들어 보았습니다. 전에 공개한 BMPFunctions.as 클래스 에 addWatermark() 메소드를 추가한 것으로, 아래 링크에서 BMPFunctions.as 파일을 다운로드 하세요.
BitmapDataにウオーターマークを増すエフェクトを作ってみました。以前に公開したBMPFunctions.asクラスにaddWatermark()メソッド追加したんです。下のリンクからBMPFunctions.asファイルをダウンロードします。
http://hangunsworld.com/classes/com/hangunsworld/as3/util/
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 | import com.hangunsworld.as3.util.BMPFunctions; var wm:BitmapData = new WatermarkSource(0, 0); var bd:BitmapData = new BitmapData(mc.width, mc.height, true, 0×00); bd.draw(mc); var bmp:Bitmap = new Bitmap(bd); bmp.x = mc.width + 5; addChild(bmp); add_btn.addEventListener(MouseEvent.CLICK, btnClick); function btnClick(evt:MouseEvent):void{ var mar:uint = uint(margin_txt.text); var off:uint = uint(offset_txt.text); var sca:Number = uint(scale_txt.text); var rot:uint = uint(rotation_txt.text); rot = rot%360; rotation_txt.text = rot.toString(); var alp:Number = uint(alpha_txt.text); alp = Math.min(alp, 100); alpha_txt.text = alp.toString(); sca /= 100; alp /= 100; bd.draw(mc); bd = BMPFunctions.addWatermark(bd, wm, mar, off, sca, rot, alp); } |
Oct 082007
I added floodFill() to the BMPFunctions.as, released yesterday. This method is an enhanced version of BitmapData.floodFill(). It changes pixels similar to the selected pixel’s color. And you can choose the contiguous option.
You can download the BMPFunctions.as file in the following link.
어제 공개한 BMPFunctions.as 클래스에 BitmapData.floodFill() 메소드를 개선한 floodFill() 메소드를 추가했습니다. 선택한 좌표의 픽셀과 비슷한 색상의 픽셀들을 원하는 색상으로 변경할 수 있습니다. 또한 연속된 영역만 변경하도록 선택할 수 있습니다.
클래스 파일은 아래 페이지에서 BMPFunctions.as를 다운로드하면 됩니다.
昨日公開したBMPFunctions.asクラスにfloodFill()メソッドを追加したんです。これはBitmapData.floodFill()メソッドを改善したので、つながっている領域だけを変更するか、イメージ全体的に変更するか選択できます。
下のリンクのページで BMPFunctions.asファイルをダウンロードできます。
http://hangunsworld.com/classes/com/hangunsworld/as3/util/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import com.hangunsworld.util.BMPFunctions; var bd:BitmapData = new BitmapData(mc.width, mc.height, true, 0×00000000); bd.draw(mc); var bmp:Bitmap = new Bitmap(bd); addChild(bmp); bmp.x = mc.width; mc.buttonMode = true; mc.addEventListener(MouseEvent.CLICK, mcClicked); function mcClicked(evt:MouseEvent):void{ bd.draw(mc); var c:uint = bd.getPixel32(mc.mouseX, mc.mouseY); c1_txt.text = c.toString(16).toUpperCase(); var c2:uint = uint(“0x” + c2_txt.text); var t:uint = Math.max(0, Math.min(255, uint(t_txt.text))); var cont:Boolean = cont_cb.selected; bd = BMPFunctions.floodFill(bd, mc.mouseX, mc.mouseY, c2, t, cont); } |
Oct 062007
I made an effect similar to the paint bucket feature in Photoshop. This replace colors similar to a user defined color with a specific color.
You can download the BMPFunctions.as file in the following link.
포토샵의 페인트 버켓 툴과 비슷한 효과를 만들어 보았습니다. 지정된 색과 비슷한 색상을 찾아서 원하는 색상으로 바꿔줍니다.
클래스 파일은 아래 페이지에서 BMPFunctions.as를 다운로드하면 됩니다.
PhotoshopのPaint Bucketのような物を作ってみました。選んだ色に似ている色をほかの色に変わります。
下のリンクのページで BMPFunctions.asファイルをダウンロードできます。
http://hangunsworld.com/classes/com/hangunsworld/as3/util/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import com.hangunsworld.as3.util.BMPFunctions; var bd:BitmapData = new BitmapData(mc.width, mc.height, true, 0×00000000); bd.draw(mc); var bmp:Bitmap = new Bitmap(bd); addChild(bmp); bmp.x = mc.width; // Replace Color button event listener replace_btn.addEventListener(MouseEvent.CLICK, doReplace); function doReplace(evt:MouseEvent):void{ var c1:uint = uint(“0x” + c1_txt.text); var c2:uint = uint(“0x” + c2_txt.text); var t:uint = Math.max(0, Math.min(255, uint(t_txt.text))); t_txt.text = t.toString(); // draws original image bd.draw(mc); // replaces colors bd = BMPFunctions.replaceColor(bd, c1, c2, t); } |
Aug 302007
Flickr changes its cross domain policy and allows Flash applications to load images from Flickr server and to modify bitmap data of the images. The new cross domain ploicy file(http://static.flickr.com/crossdomain.xml) lets Flash applications on any servers to access Flickr images.
Before the change, you can load images from Flickr server. But, you can not access the bitmap data of the images and can not make bitmap data using BitmapData.draw() method. Now, it is possible.
Before the change, you can load images from Flickr server. But, you can not access the bitmap data of the images and can not make bitmap data using BitmapData.draw() method. Now, it is possible.
To access the bitmap data, you have to set LoaderContext.checkPolicyFile to true.
플리커가 플래시 어플리케이션에서 플리커의 이미지를 로드하는 것은 물론 비트맵데이터도 제어가 가능하도록 크로스 도메인 정책을 오픈하였습니다. 새로운 크로스 도메인 정책 파일(http://static.flickr.com/crossdomain.xml)은 모든 서버의 플래시 어플리케이션에서 접근이 가능하도록 바뀌었습니다.
이전에는 이미지를 로드하더라도, 비트맵데이터를 가공하거나 BitmapData.draw() 메소드를 이용하여 이미지를 비트맵데이터로 변환할 수 없었지만, 이제 가능하게 되었습니다.
이전에는 이미지를 로드하더라도, 비트맵데이터를 가공하거나 BitmapData.draw() 메소드를 이용하여 이미지를 비트맵데이터로 변환할 수 없었지만, 이제 가능하게 되었습니다.
그러나 다른 서버로 부터 로드된 이미지를 가공하려면, 다음과 같이 AS3에서 LoaderContext.checkPolicyFile 설정을 해주어야 합니다.
Flickrはクロスドメイン政策を変更して、フラッシュアプリケ―ションがFlickrサ―バ―のイメージをダウンロードしてBitmapDataを改めることができました。新たなクロスドメイン政策ファイル(http://static.flickr.com/crossdomain.xml)はあらゆるサーバーからのアクセスを許します。
以前には、Flickrサーバーからイメージをロードしても、BitmapDataを修正することとBitmapData.draw()メソッドを使ってBitmapDataを作ることはできなかった。今なら出来ます。
以前には、Flickrサーバーからイメージをロードしても、BitmapDataを修正することとBitmapData.draw()メソッドを使ってBitmapDataを作ることはできなかった。今なら出来ます。
BitmapDataにアクセスするためには、LoaderContext.checkPolicyFile設定をしなければならないんです。
1 2 3 4 | public var context:LoaderContext; context = new LoaderContext(); context.checkPolicyFile = true; loader.load(loaderUR, context); |
Recent Comments