'플래시 연구소'에 해당되는 글 24건

  1. 2010/05/22 액체 위에 국기 모양의 공이 떠있는 현상 시뮬레이션 플래시 (2)
  2. 2010/03/02 누구나 따라해볼 수 있는 플렉스 애플리케이션 만들기 동영상
  3. 2008/10/09 플래시, 외부 파일 데이터 가져오기 통신 샘플 소스 #2 (1)
  4. 2008/10/06 플래시, 외부 파일 데이터 가져오기 통신 샘플 소스 #1 (2)
  5. 2008/10/04 막대 그래프 만들기, 플래시 차트 소스
  6. 2008/10/01 학습용 배너 이미지 슬라이더 플래시 소스 (2)
  7. 2008/09/23 초간단 플래시 디지털 시계 만들기 동영상 (15)
  8. 2008/09/22 나만의 아날로그 플래시 시계를 직접 만들어 보자. (4)
  9. 2008/06/15 플래시 액션 스크립트 3.0, 고성능 3D 데모 (5)
  10. 2008/01/03 플래시를 제어하는 자바스크립트 소스 코드 (1)
  11. 2007/11/08 플래시에서 책장 넘기는 효과 내는 학습 자료. (1)
  12. 2007/07/10 팩맨 플래시 게임 소스 2종 (1)
  13. 2007/07/01 현란한 동영상을 손쉽게 만들자! 플래시 모션 트위닝 #2.
  14. 2007/06/27 현란한 동영상을 손쉽게 만들자! 플래시 모션 트위닝. (7)
  15. 2007/06/26 플래시 다운로드 및 복사 방법 이모저모에 동영상과 부연설명 추가 (5)
  16. 2007/06/21 벽돌깨기 플래시 게임 소스코드 (3)
  17. 2007/06/13 플래시 다운로드 및 복사 방법 이모저모 (8)
  18. 2007/06/13 추천 플래시 홈페이지 #3
  19. 2007/06/12 추천 플래시 홈페이지 #2
  20. 2007/06/11 플래시로 만든 비쥬얼이 멋진 홈페이지 (1)
  21. 2007/05/30 초미니 플래시 테트리스 소스 코드 (965 바이트) (5)
  22. 2007/05/17 흥미로운 플래시 애니 2가지&플래셔 친구 찾아요. (19)
  23. 2007/05/06 플래시의 활용도가 날로 높아지는 듯 합니다. (9)
  24. 2007/04/04 플래시 이펙트 천여가지 예제 (2)
물리엔진으로 실감나는 생생한 플래시 게임을 만들어 보려고 이런 저런 테스트 중에 부력 시뮬레이션도 테스트 해볼 수 있게 되어 간단한 동작을 하는 플래시를 빌드해봤습니다. 하단에 놓여진 유체 위에서 부력이 작동하여 그 위에서 공이 떠있는 현상을 테스트 한 것입니다. 공에는 여러나라 국기의 모습이 입혀져 있으며 처음에는 20개의 공이 한꺼번에 떨어지며 3초 간격으로 추가로 공이 한개씩 떨어지도록 되어 있습니다. 그리고 떨어진 공들은 마우스로 드레그해서 움직일 수 있습니다. 유체 위에 공이 떨어지면 유체가 출렁이는 현상이 생기면 좋겠다는 아쉬운 부분도 있어 약간의 이펙트를 줘서 개선해 보면 좋을 것 같다는 생각도 들고 약간의 규칙을 적용해서 게임을 만들어 보면 어떨까 하는 생각도 해보게 됩니다.
부력 테스트를 위해 Box2DFlash 물리엔진과 b2BuoyancyController 를 사용했으며 물리엔진에 관심있는 분들은 관련 샘플 소스를 참고해서 개성있는 플래시 제작에 활용해보시기 바랍니다. 물리엔진을 처음 접하시는 분들은 관련 메뉴얼을 먼저 읽어보셔야 할 것이며 함께 포함된 예제 소스를 실행해보시면 도움이 될 것입니다.

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/614

[연관 포스트]
아이폰 게임 제작을 위한 2D 그래픽 엔진 Cocos2D 설치 및 실행 동영상
아이폰 아이팟 코코아 터치 애플리케이션 개발 샘플 동영상
직장인을 위한 아이폰 게임 디자인 스터디를 추진해 봅니다.
직장인을 위한 아이폰 앱 개발 Cocos2D 스터디를 추진합니다.

이올린에 북마크하기(0) 이올린에 추천하기(0)
이 전에 포스팅한 "아이폰 아이팟 코코아 터치 애플리케이션 개발 샘플 동영상" 게시물에서 소개하고 있는 아이폰 애플리케이션과 비슷한 기능을 하는 플렉스 애플리케이션을 만드는 과정을 동영상으로 캡쳐해봤습니다. 우리가 알고 있는 플래시를 좀더 손쉽고 체계적으로 개발 할 수 있게 해주는 플렉스 프레임워크를 활용하면 비교적 적은 노력으로 유저 인터페이스를 좀더 세련되게 제작할 수 있게 됩니다. 동영상에는 플렉스 빌더가 등장하며 디자인 모드에서 라벨(Label)과 버튼(Button) 컨트롤을 플렉스 애플리케이션 컨테이너 위에 올리고 이 버튼을 클릭하면 웹브라우져로 어도비(Adobe) 홈페이지를 여는 매우 간단한 프로그램을 만드는 과정을 영상으로 담은 것입니다. 드림위버 같은 툴로 HTML과 자바스크립트를 다루는 느낌과 유사해 보이지만 실제 개발을 하기 위해서는 훨씬 많은 학습이 필요합니다.



웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/596
이올린에 북마크하기(0) 이올린에 추천하기(0)
플래시로 외부 파일 데이터를 가져오기 위한 웹서버와 통신하기 두번째 샘플 소스 코드입니다. 플래시 액션스크립트 초급자를 위해 학습용으로 부담없이 테스트할 수 있도록 만들었으므로 차근 차근 살펴 보시면 이해에 도움이 될 것이라 생각됩니다. 아래 예제 처럼 LoadVars 객체를 이용해서 통신을 하는 것이 먼저 소개해드렸던 XML 객체를 이용하는 것 보다는 좀더 손쉽게 사용될 수 있습니다. 그러나 전달해야할 데이터가 복잡한 구조를 가질 경우 XML 객체를 이용하는 것 보다 혼란스러울 수 있으며 눈으로 손쉽게 데이터를 해석하기 어려울 수 있습니다. 아래 제공하는 샘플 소스 코드를 필요에 맞게 수정하고 개선해보면 어떻게 사용하는 것인지 이해하기 쉽습니다. 잘 익혀두었다가 사용자의 데이터를 등록하고 갱신하는 응용 프로그램 모양의 플래시를 만드는데 활용해보세요.

[product.txt]
title=system&attribute=name|price|total|date&product=desktop|380000|10|2008-10-01,monitor|270000|5|2008-10-04,printer|160000|2|2008-09-28,notebook|870000|15|2008-10-06,mouse|12000|20|2008-09-20

[product_txt.fla]
System.useCodepage = true;
var product_vars = new LoadVars();
product_vars.onLoad = function(success) {
    if (success) {
        var attribute_str = this.attribute;
        var product_str = this.product;
        var attribute_array = this.attribute.split('|');
        var tmp_array = product_str.split(',');
        var product_array = [tmp_array[0].split('|'), tmp_array[1].split('|'), tmp_array[2].split('|'), tmp_array[3].split('|'), tmp_array[4].split('|')];
        tf_textarea.text += '[text file tester]\n';
        tf_textarea.text += '01: ' + this.title + '\n';
        tf_textarea.text += '02: ' + this.attribute + '\n';
        tf_textarea.text += '03: ' + this.product + '\n';
        tf_textarea.text += '\n';
        tf_textarea.text += '04: ' + this.attribute.split('|')[0] + '\n';
        tf_textarea.text += '05: ' + this.attribute.split('|')[1] + '\n';
        tf_textarea.text += '06: ' + this.attribute.split('|')[2] + '\n';
        tf_textarea.text += '07: ' + this.attribute.split('|')[3] + '\n';
        tf_textarea.text += '\n';
        tf_textarea.text += '08: ' + this.product.split(',')[0] + '\n';
        tf_textarea.text += '09: ' + this.product.split(',')[1] + '\n';
        tf_textarea.text += '10: ' + this.product.split(',')[2] + '\n';
        tf_textarea.text += '11: ' + this.product.split(',')[3] + '\n';
        tf_textarea.text += '12: ' + this.product.split(',')[4] + '\n';
        tf_textarea.text += '\n';
        tf_textarea.text += '13: ' + this.product.split(',')[0].split('|')[0] + '\n';
        tf_textarea.text += '14: ' + this.product.split(',')[0].split('|')[1] + '\n';
        tf_textarea.text += '15: ' + this.product.split(',')[0].split('|')[2] + '\n';
        tf_textarea.text += '16: ' + this.product.split(',')[0].split('|')[3] + '\n';
        tf_textarea.text += '\n';
        tf_textarea.text += '17: ' + tmp_array[1].split('|')[0] + '\n';
        tf_textarea.text += '18: ' + tmp_array[1].split('|')[1] + '\n';
        tf_textarea.text += '19: ' + product_array[1][2] + '\n';
        tf_textarea.text += '20: ' + product_array[1][3] + '\n';
        tf_textarea.text += '\n';
        textarea += '21: ' + product_array[2][0] + '\n';
        textarea += '22: ' + product_array[2][1] + '\n';
        textarea += '\n';
        //trace(this.title);
    } else {
        //trace('error');
    }
}
product_vars.load("product.txt");

[product_txt.swf]



[product_txt.html]
<embed src="http://www.hompydesign.com/flash/sample/product_txt.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="520" height="420" base="http://www.hompydesign.com/flash/sample/"></embed>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
플래시로 외부 파일 데이터를 가져오기 위한 웹서버와 통신하기 샘플 소스 코드입니다. 플래시 액션스크립트 초급자를 위해 학습용으로 부담없이 테스트할 수 있도록 만들었으므로 차근 차근 살펴 보시면 이해에 도움이 될 것이라 생각됩니다. XML 로 규격화된 자료 파일을 플래시에서 읽을 수 있다는 것은 자료에 근거하여 어플리케이션 처럼 동작하는 동적 플래시를 만들 수 있는 장점이 있습니다. 플래시로 XML 객체를 어떻게 다루는지 잘 익혀두시고 차후에 쓸만한 플래시 만드는 일에 잘 활용해보세요.

[product.xml]
<?xml version="1.0" encoding="euc-kr" ?>
<product>
    <item>
        <name>desktop</name>
        <price>380000</price>
        <total>10</total>
        <date>2008-10-01</date>
    </item>
    <item>
        <name>monitor</name>
        <price>270000</price>
        <total>5</total>
        <date>2008-10-04</date>
    </item>
    <item>
        <name>printer</name>
        <price>160000</price>
        <total>2</total>
        <date>2008-09-28</date>
    </item>
    <item>
        <name>notebook</name>
        <price>870000</price>
        <total>15</total>
        <date>2008-10-06</date>
    </item>
    <item>
        <name>mouse</name>
        <price>12000</price>
        <total>20</total>
        <date>2008-09-20</date>
    </item>
</product>


[product_xml.fla]
System.useCodepage = true;
function product_loader() {
    var product_xml = this.firstChild.childNodes;
    var product_len = product_xml.length;
    var item_xml = product_xml[0].childNodes;
    var item_len = item_xml.length;
    var name_xml = item_xml[0].childNodes;
    var name_len = name_xml.length;
    tf_textarea.text += '[xml file tester]\n';
    tf_textarea.text += '01: ' + product_len + "\n";
    tf_textarea.text += '02: ' + product_xml + "\n";
    tf_textarea.text += '03: ' + item_len + "\n";
    tf_textarea.text += '04: ' + item_xml + "\n";
    tf_textarea.text += '05: ' + name_len + "\n";
    tf_textarea.text += '06: ' + name_xml + "\n";
    tf_textarea.text += '\n';
    tf_textarea.text += '07: ' + item_xml[0].nodeName + "\n";
    tf_textarea.text += '08: ' + item_xml[0].firstChild.nodeValue + "\n";
    tf_textarea.text += '07: ' + item_xml[1].nodeName + "\n";
    tf_textarea.text += '08: ' + item_xml[1].firstChild.nodeValue + "\n";
    tf_textarea.text += '09: ' + item_xml[2].nodeName + "\n";
    tf_textarea.text += '10: ' + item_xml[2].firstChild.nodeValue + "\n";
    tf_textarea.text += '11: ' + item_xml[3].nodeName + "\n";
    tf_textarea.text += '12: ' + item_xml[3].firstChild.nodeValue + "\n";
    tf_textarea.text += '\n';
    textarea += '13: ' + product_xml[3].childNodes[0].nodeName + "\n";
    textarea += '14: ' + product_xml[3].childNodes[0].firstChild.nodeValue + "\n";
    textarea += '15: ' + product_xml[3].childNodes[1].nodeName + "\n";
    textarea += '16: ' + product_xml[3].childNodes[1].firstChild.nodeValue + "\n";
    textarea += '17: ' + product_xml[3].childNodes[2].nodeName + "\n";
    textarea += '18: ' + product_xml[3].childNodes[2].firstChild.nodeValue + "\n";
    textarea += '19: ' + product_xml[3].childNodes[3].nodeName + "\n";
    textarea += '20: ' + product_xml[3].childNodes[3].firstChild.nodeValue + "\n";
    tf_textarea.text += '\n';
    textarea += '21: ' + product_xml[3].firstChild.nextSibling.nodeName + "\n";
    textarea += '22: ' + product_xml[3].firstChild.nextSibling.nextSibling.nodeName + "\n";
    /*
    trace('product len = ' + product_len);
    trace('product xml = ' + product_xml);
    trace('item len = ' + item_len);
    trace('item xml = ' + item_xml);
    trace('name len = ' + name_len);
    trace('name xml = ' + name_xml);
    */
}
my_xml = new XML();
my_xml.onLoad = product_loader;
my_xml.ignoreWhite = true;
my_xml.load("product.xml");

[product_xml.swf]
 

[product_xml.html]
<embed
src="http://www.hompydesign.com/flash/sample/product_xml.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="520" height="420" base="http://www.hompydesign.com/flash/sample/"></embed>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
오늘 오후에 있을 플래시 스터디 과제인 막대 그래프 만들기에 대한 이해를 돕기 위해 간소화 시킨 플래시 차트 소스를 준비했습니다. 그래프 막대로 사용하기 위해 다섯 가지 색상의 무비클립을 만들었습니다. 차트에 적용할 데이터는 2차원 배열에 담았고 Tween 클래스를 활용해 막대 그래프에 활력을 불어 넣었습니다. 여러가지 Tween 클래스 효과를 실험하기 위해 onEnterFrame 이벤트를 이용해 5가지 다른 스타일을 일정한 시간 간격으로 보여주고 있습니다. 플래시 입문자들은 아래 소스를 수정하고 개선해 보시면 플래시 액션스크립트 학습이 도움이 될 것입니다. 뭐든 직접 해보는 것이 중요하므로 손수 멋진 디자인을 입혀서 자신만의 개성있는 막대 그래프를 만들어보세요.

 


import mx.transitions.Tween;
import mx.transitions.easing.*;

var chart_array = Array(
    Array('80','94','70','80','60')
    ,Array('60','100','78','50','80')
    ,Array('90','80','100','75','95')
);

var style_array = Array(
    Strong.easeOut, Elastic.easeOut, Bounce.easeOut, Regular.easeOut, Back.easeOut
);

var menu_max = chart_array.length;
var part_max = chart_array[0].length;
var time_step = 0, style_pos = 0;

function show_chart(set_style){
var i, j, y1, y2, style, mc;
    y1 = 0;
    for (i=0;i<part_max;i++) {
        for (j=0;j<menu_max;j++) {
            mc = this['mc_bar_'+j+'_'+i];
            y2 = chart_array[j][i] * 2;
            style = style_array[set_style];
            new Tween(mc,"_yscale",style,y1,y2,20,false);
        }
    }
}

this.onEnterFrame = function(){
    if (time_step>100) time_step = 0;
    if (time_step==0) {
        show_chart(style_pos);
        style_pos = (style_pos+1)%5;
    }
    time_step ++;
}

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
이미지 슬라이더는 좁은 공간에 좀더 많은 것을 보기 좋게 보여주기 위해 유용한 유저 인터페이스입니다. 아래 소개하는 내용은 이번 플래시 스터디 과제를 해결하기 위한 힌트이기도 하며 플래시 액션스크립트 초급자를 위한 학습용 플래시 소스이기도 합니다. Tween 클래스를 사용해서 매끄러운 배너 이동에 적용했으며 주기적으로 반복해서 함수를 실행하게 해주는 setInterval 함수를 이용해 일정 시간 간격으로 배너를 교체하도록 하였습니다. 그리고 마우스를 배너 위에 올렸을 경우 clearInterval 함수로 반복하는 것을 중지 하도록 했고 마우스가 배너 위를 벗어났을 때 다시 setInterval 함수를 이용해 다시 반복 하도록 했습니다. 배너의 갯수(menu_max), 배너의 폭(menu_width), 이동 시간 간격(show_time), 어떤 스타일로 이동할 것인지(show_style)를 변경할 수 있는 변수도 적용하였습니다.
백번 설명하는 것 보다 한번 직접 해보는 것이 플래시 액션스크립트 학습의 지름길입니다. 자신의 필요나 구미에 맞게 아래 플래시 소스를 수정 보완 해보시면 학습에 도움이 될 것입니다. 이렇게 만들어진 플래시는 블로그나 홈페이지 배너로 사용하면 보기 좋을 것이며 실제 많이 사용하고 있기도 합니다.







import mx.transitions.Tween;
import mx.transitions.easing.*;

var menu_pos = 0;
var menu_max = 4;
var menu_width = 200;
var show_style = 0;
var show_time = 4000;
var
menu_distance = menu_width * -1;
var time_id = setInterval(_root,"do_next", show_time);
mc_screen.onRollOver = function (){
    clearInterval(time_id);
}
mc_screen.onRollOut = function (){
    time_id = setInterval(_root,"do_next", show_time);
}
mc_screen.onRelease = function (){
    getURL("http://hompy.info/507","_blank");
}
function do_next(){
    var pos1, pos2, x1, x2;
    pos1 = menu_pos;
    menu_pos = menu_pos + 1;
    pos2 = menu_pos;
    x1 = pos1 * menu_distance;
    x2 = pos2 * menu_distance;
    menu_pos = (menu_pos) % menu_max;
    switch (show_style){
        case 1: new Tween(mc_screen,"_x",Elastic.easeOut,x1,x2,20,false); break;
        case 2: new Tween(mc_screen,"_x",Bounce.easeOut,x1,x2,20,false); break;
        case 3: new Tween(mc_screen,"_x",Regular.easeOut,x1,x2,20,false); break;
        case 4: new Tween(mc_screen,"_x",Back.easeOut,x1,x2,20,false); break;
        default: new Tween(mc_screen,"_x",Strong.easeOut,x1,x2,20,false); break;
    }
    trace (menu_pos+":"+x1+"->"+x2);
}

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
플래시 입문자를 위해 초간단 플래시 디지털 시계 만들기 동영상을 만들어보았습니다. 동영상에서 나오는 화면 대로 따라하면 디지털 시계 하나가 만들어집니다. 플래시 제작이 어렵게 느껴졌던 분들이 있다면 동영상을 보고 욕심을 내보시면 어떨까 생각됩니다. 저는 취미로 플래시 제작을 즐기는 편인데 요즘 업무에 바빠서 취미 생활에 소홀해졌습니다. 플래시 제작을 취미로 즐기실 분이 있으시면 언제든 저와 함께 해요.^^
 



아래는 동영상에 사용된 플래시 디지털 시계 소스 코드입니다.

function display_clock(){
    var noon= 'PM';
    var ctime = new Date();
    var chour = ctime.getHours();
    var cmin = ctime.getMinutes();
    var csec = ctime.getSeconds();
    if (chour<12) noon = 'AM';
    if (chour>12) chour = chour - 12;
    if (chour<10) chour = '0' + chour;
    if (cmin<10) cmin = '0' + cmin;
    if (csec<10) csec = '0' + csec;
    tf_clock.text = noon+ ' '+chour+':'+cmin+' '+csec;
    delete ctime;
}

this.onEnterFrame = display_clock;


웹프로그래머의 홈페이지 정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
나만의 아날로그 플래시 시계를 만들어보고 싶다면 아래 액션스크립트 소스 코드를 참고하세요. 보시면 아시겠지만 플래시 시계 소스 코드는 생각보다 간단하며 구현방법 또한 복잡하지 않습니다. 우선 중심점이 스테이지 중앙에 맞춰진 시침, 분침, 초침에 해당하는 무비클립을 만들고 Date 객체의 getHours, getMinutes, getSeconds 메소드를 이용해서 시간을 구하고 준비된 개별 시계 바늘에 부여된 이름의 무비클립 객체 회전각 속성 _rotation 값을 적절하게 계산하여 주기적으로 변경합니다. 소스 코드에서는 각 무비클립 마다 onEnterFrame 이벤트를 발생하게 하였으나 한개의 메소드로 통합하셔도 좋습니다. 여기까지 작업 하시고 실행하면 원하는 플래시 시계가 완성됩니다. 그리고 여러분의 취향에 맞는 멋진 시계 배경과 이쁜 시계 바늘을 디자인해서 적용하시면 개성있는 시계가 될것입니다. 나만의 멋진 시계를 만들어서 자신의 블로그 위젯으로 활용해보세요.

액션스크립트 용어와 객체 활용 샘플 코드 참고 자료 ==▶ http://cafe.naver.com/q69/86171






function
clock_sec_mc_func(){
    var nowDate = new Date();
    this._rotation = nowDate.getSeconds() * 6;
    delete newDate;
}

function clock_min_mc_func(){
    var nowDate = new Date();
    this._rotation = nowDate.getMinutes() * 6;
    delete newDate;
}

function clock_hour_mc_func(){
    var nowDate = new Date();
    this._rotation = nowDate.getHours() * 30 + (this._rotation = nowDate.getMinutes() * 0.5 % 30);
    delete newDate;
}

mc_clock_hour.onEnterFrame = clock_hour_mc_func;
mc_clock_min.onEnterFrame = clock_min_mc_func;
mc_clock_sec.onEnterFrame = clock_sec_mc_func;

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
플래시 액션 스크립트 3.0, 3D 라이브러리로 만들어진 고성능 모션 그래픽스 데모입니다. 최근 PaperVision3D 라는 플래시용 3D 라이브러리에 관심을 가지고 활용해볼 기회만 보고 있었는데 같이 일하는 디자이너가 알려준 링크에서 아래와 같은 플래시를 보니 욕심이 더 생기더군요. 시간을 쪼개서 3D 플래시에 대해 탐구하고 활용방안에 대해 생각해봐야겠습니다.
http://temp.roxik.com/datas/perform/index.html
http://code.google.com/p/papervision3d/

웹프로그래머의 홈페이지정보 블로그 http://hompy.info

이올린에 북마크하기(0) 이올린에 추천하기(0)

웹페이지에서 플래시(flash)를 제어하는 자바스크립트(javascript) 소스 코드입니다. 동영상 캡쳐 프로그램 같은 것으로 캡쳐해서 만든 플래시 처럼 별다른 액션 없이 프래임(frames)만 순차적으로 재생되는 플래시일 경우 재생 및 정지 버튼을 붙이고 싶을 때가 있습니다. 자바스크립트로 재생, 정지, 되감기, 줌 버튼등을 구현하였으며 현재 재생중인 프래임 번호도 표시해줍니다. 시간이 허락하는 분은 민밋한 버튼을 이미지나 플래시로 구현해서 재생할 플래시 위해 표시하는 프로그램으로 업그레이드 해보면 좋을 듯 합니다. 지금 재생되고 있는 동영상은 나름 재미있는 추천 디펜스 게임 VR디펜더Y3K 게임 실행 화면 입니다.

[플래시 제어 자바스크립트 소스 HTML]
<html>
<head>
<title>자바스크립트로 플래시 제어</title>
<script language="javascript">
var swf_timer_id, flash_obj, flash_frame_total, flash_frame_pos;
function swf_is_playing(){
 return flash_obj.IsPlaying();
}
function swf_stop(){
 flash_obj.StopPlay();
}
function swf_play(){
 flash_obj.Play();
}
function swf_rewind(){
 flash_obj.Rewind();
}
function swf_zoom(percent){
 flash_obj.Zoom(percent);
}
function swf_is_loaded(){
 return flash_obj.PercentLoaded();
}
function swf_timer(){
 var obj = document.getElementById('flash_play_bt_id');
 if (swf_is_playing()) {
  obj.value='stop';
  obj.onclick = swf_stop;
 } else {
  obj.value='play';
  obj.onclick = swf_play;
 }
 var obj = document.getElementById('flash_status_bt_id');
 obj.value = flash_obj.TCurrentFrame('/');
}

function swf_init(){
 flash_obj = document.getElementById('flash_swf_id');
 //flash_frame_total = flash_obj.TotalFrames();
 setInterval(swf_timer,30);
}
</script>
</head>
<body LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onload="javscript:swf_init();">

<table cellspacing=0 cellpadding=0 border=0 bgcolor=#efefef>
<tr>
 <td>
  <embed id=flash_swf_id src="flash_movie.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="558" height="446" allowScriptAccess="always" wmode="transparent" autoplay="0" loop="0"></embed>
  </div>
 </td>
</tr>
<tr>
 <td>
  <table>
   <tr>
    <td><input id=flash_play_bt_id type="button" value="stop"></td>
    <td><input type="button" value="rewind" onclick="javascript:swf_rewind();"></td>
    <td><input type="button" value="90%" onclick="javascript:swf_zoom(50);"></td>
    <td><input type="button" value="100%" onclick="javascript:swf_zoom(0);"></td>
    <td><input id=flash_status_bt_id type="button" value="0"></td>
   </tr>
  </table>
 </td>
</tr>
</table>
</body>
</html>



웹프로그래머의 홈페이지정보 블로그 http://hompy.info

이올린에 북마크하기(0) 이올린에 추천하기(0)
인터넷 서핑하다가 발견한 책장 넘기기 효과, 전자책(e-book) 스타일 효과를 표현하기 위해 사용될 수 있는 플래시 구현 원리와 방법론 그리고 플래시 액션스크립트입니다. 책장 넘기기(page flip) 효과를 구현할 수 있도록 도와주는 유/무료 라이브러리를 사용하면 보다 간단히 만들 수도 있겠지만 때론 원리와 방법론을 알고 싶을 때가 있고 이를 알고 구현해보는 것이 자신의 기술적인 퀄리티를 높여줄 수 있습니다.

The Page Turn Effect in Flash MX

by Sham Bhangal, author of Flash Hacks
09/03/2004

In Hack #25 of Flash Hacks, I talk in general terms about how symmetry can aid the thought and design processes when you are developing scripted effects, because symmetry is a very common feature in both natural and man-made effects. I go on to show how to deconstruct one of the most recent "How is that done?" effects, the page turn, by looking for symmetry in the effect. What I don't cover is how to develop code that can be used to create the page turn effect. This article provides that part of the equation.

The development of the page turn hack is a useful exercise to develop, because it contains three of the most common tricks in Flash motion graphics effects--property-based animation, embedded movie clips, and masking. The last two are features that seem to confuse developers coming to Flash from other web programming languages. Having a good understanding of how these two features are used in the page turning exercise is instructive in learning how complex graphical effects are built up in Flash, because you can rarely create such effects using traditional property-based animation alone.

The source files developed in this article can be found on the download page for the Flash Hacks book. Although the code presented in this article is for Flash MX 2004, you will also find additional source files that are compatible with Flash MX for this hack (and almost all of the other hacks in the book) on the download page.

Symmetry and Page Turning

The symmetry of a turning page is shown below. Assuming that the turning page is folded right over, the shape of the two revealed pages is always symmetrical around the fold.

사용자 삽입 이미지
Four stages in a page turn. The dotted line shows the page fold, and this is also the line of symmetry

In any coded version of the page turn effect, creating this line of symmetry is a crucial first step.

During the page turn, a number of things happen.

The first is that the original page (area a) slowly disappears, and is replaced by the reverse edge of the turning page (area c). As the original page disappears, the page underneath it appears (area b).

사용자 삽입 이미지
The changes that occur as the page turns

The second step in working out how to create the code is in deciding which of the three areas (a, b, or c) that our code has to control. Symmetry tells us that we will have a much easier life if we chose to consider b and c. How do I know that a is irrelevant?

  • Area a is not symmetrical and is also an irregular shape. This would make it difficult to form equations that describe area a.
  • Areas b and c are symmetrical images of each other. We can immediately see from this that areas b and c must be part of the same process, and this makes their motion easier to implement in code.

Not only does symmetry help us deduce the way the page turn works, but considering symmetry also helps us to find the easiest solution!

We can now split the process of finding a programmed solution to animating the page turn effect into three parts:

  • Creating the line of symmetry.
  • Creating the animation of area b.
  • Creating the animation of area c.

We will tackle each in turn below.

Creating the Line of Symmetry

Looking at the previous diagrams, we see that the line of symmetry in the page turn effect starts at 45 degrees and moves towards the book spine. As it reaches the spine, the line of symmetry is at 90 degrees (straight up), giving us a fully open page on either side of the line of symmetry.

The interactive diagram below shows the required motion for the line of symmetry. Click-drag the circle at the bottom of the dotted line to see the line of symmetry move as per the final effect.

사용자 삽입 이미지
The source .fla for this animation, pageTurn01.fla, is on the download page for the Flash Hacks book. Click on the image above to open the animation in a new window.

When interacting with this diagram, you should see that:

  • The line of symmetry is constrained between the left and right edges of the page-- PAGE_SPINE and PAGE_EDGE.
  • The line is at 90 degrees when it is at PAGE_SPINE.
  • The line is at 45 degrees when it is at PAGE_EDGE.

This gives us the following equation for the angle of the line of symmetry, assuming that we have created this line as a movie clip with instance name line:


line._rotation = 45*(line._x-PAGE_SPINE)/page._width;

(Note: the line movie clip points straight up when it is at 90 degrees; hence, the above equation is really subtracting an angle between 0 and 45 degrees as the position of the line is moved between PAGE_SPINE and PAGE_EDGE.)

The rest of the code in the listing is pretty self-explanatory. The function pageTurn runs as the onMouseMove handler for the instance line (given that onMouseMove is more efficient than an onEnterFrame when you are dragging), and pageRelease acts as the onRelease handler.

Within pageTurn, the if statement constrains the line between the limits PAGE_EDGE and PAGE_SPINE. The updateAfterEvent() makes sure that the line is animated whenever the mouse moves. (This is usually much faster than every frame, thus ensuring smoother animation than if we had used an onEnterFrame, as per Hack #71 in the Flash Hacks book, which talks about a performance budget and the best use of each event to build responsive animation.)

The pageRelease function simply deletes the onMouseMove handler, which makes sure that animation stops when you release the line movie clip.


function pageTurn():Void {
  line.onMouseMove = function() {
      line._x = _xmouse;
      if (line._x>PAGE_EDGE) {
        line._x = PAGE_EDGE;
      } else if (line._x<PAGE_SPINE) {
        line._x = PAGE_SPINE;
      }
    line._rotation = 45*(line._x-PAGE_SPINE)/page._width;
    updateAfterEvent()
  };
}
function pageRelease():Void {
  delete line.onMouseMove;
}
var PAGE_SPINE:Number = page._x;
var PAGE_EDGE:Number = page._x+page._width;
var lineAngle:Number = 45;
line.hotspot.onPress = pageTurn;
line.hotspot.onRelease = pageRelease;
line.hotspot.onReleaseOutside = pageRelease;


Creating the First Page (Area b)

The easiest page to create is the page under the one being turned, or area b in the previous diagrams. As stated in the book, this area is a mask that is placed to the right of the line of symmetry. As the line of symmetry is moved from PAGE_EDGE to PAGE_SPINE, the page underneath the one being turned is revealed. In the interactive diagram below, the page being revealed is the one with the "2" on it.

사용자 삽입 이미지
The source .fla for this animation, pageTurn02.fla, is on the download page for the Flash Hacks book. Click on the image above to open the animation in a new window.

When interacting with this diagram, you should see that:

  • The grey rectangle will move with the line of symmetry. This is because it is embedded within the movie clip for the line (thus, no code is required to make the rectangle follow the line).
  • When you click the red text ("click here to activate the mask"), the rectangle will start masking the page with "2" over it.
  • The lower page ("2") is in reality above what appears to be the upper page ("1"). This is due to the way Flash masking works, which is the inverse of what you would expect. When the mask is not over the "2" (when the line of symmetry at the 45 degree position), the "2" is invisible, or "fully masked." When the mask is totally covering the mask (with the line of symmetry at the 90 degree position) the "2" is fully visible, or "unmasked." Because of this inverse action, we have to mask the "2" page rather than the "1" page, and this is why the "2" page is above the "1."

In terms of implementation, the mask clip is within the instance line and has the instance name rightMask. To make this rectangle start acting as the mask for the "2" page (which has an instance name bottomPage), we use the line:


 bottomPage.setMask(line.rightMask);
You can see this (the file pageTurn02.fla) being used in the onRelease event handler for the button corresponding to the "click here to activate the mask" button (button activate);:

activate.onRelease = function() {
  bottomPage.setMask(line.rightMask);
};

It should now be becoming clear what area we have chosen to ignore (area a). For those that have not worked it out, all will be revealed when we look at area c.

Creating the Second Page (Area c)

Creating the second page area, the reverse edge of the turning page, is harder to create than the previously completed one. This is not because of the code involved, but has more to do with visualizing what the mask that reveals this page needs to do.

Not to fear, because you can visualize what needs to happen via the interactive animation below. This adds the second mask area and the reverse of the turning page (area c). Again, click the "click here to activate the mask" text to make the mask start working.

사용자 삽입 이미지
The source .fla for this animation, pageTurn03.fla, is on the download page for the Flash Hacks book. Click on the image above to open the animation in a new window.

The area corresponding to the part we want to reveal as the page turns (A) is shown in green hatching in the diagram below. It is created by masking the reverse of the turning page (C) with a mask to the left of the line of symmetry (B).

사용자 삽입 이미지
Creating the reverse side of the turning page

The equation of the reverse side of the turning page (C) has much the same equation as the line of symmetry, except that it starts at 90 degrees instead of 45, giving us the equation for the rotation of the back of the page (as represented by the dotted red line) of:


backPage._rotation = 90*(line._x-PAGE_SPINE)/page._width

The back of the page is actually an embedded movie clip--an instance of backPage that contains a second movie clip, page. The instance page contains the actual page graphic. As backPage rotates, page moves with it, but page also moves relative to its own x axis (noting that this axis is also rotating). In the diagram, the movement of page relative to the red dotted line shows the result of this embedded movement. The embedding allows us to create the fairly complex rotational motion required of the turning page without having to resort to trigonometry, which would 1) be something that many designers hate and 2) potentially slow down the effect (accurate trig calculations are slow because they use a rather long binomial series to give the result).

사용자 삽입 이미지
The embedded animation that creates the back of the turning page

The interactive animation also shows us why we were able to get away with not considering the area a in the page turn effect; it is simply what is left over when areas b and c are added! As long as we place the top page below the other movie clips, it will naturally get obscured by the turning page. By realizing this (or rather, assuming it is unimportant because of symmetry early on), we have avoided having to animate it at all!

Note: to keep the discussion simple, I have made the pages single-sided (the pages only have content on one side, and in the effect so far, the back if the turning page is seen as a blank page.). You can easily create double-sided pages by making the movie clip back change per page turn.

Completing the Effect

The page turn doesn't look accurate at the moment, because of our approximation of assuming a perfect fold. Although we could fix this mathematically, Flash just doesn't have the performance needed to support the calculations to simulate curved pages. Readers of the Hacks book will know the fix to this--think of a hack to get around the problem.

In this case, the illusion of flexible pages is provided by some static alpha shadows that are applied to the pages as they turn. Although these are approximated shadows, they give the effect a real feeling of volume, and lift the animation towards realism considerably.

This is a major issue with much of Flash design--although you can do a lot with ActionScript, you almost always need some artistic ability to know how to create the graphical approximations needed to get beyond the code and create stuff that looks cool and/or realistic.

사용자 삽입 이미지 사용자 삽입 이미지
사용자 삽입 이미지 사용자 삽입 이미지
The page turn with faux shading created via alpha gradients superimposed over the pages

The interactive diagram below shows the effect with some shading added to the movie clips. Click-drag on the reverse of the page (the curled page area to the lower right) to turn the page.

사용자 삽입 이미지

The source for this example is available as pageTurn04.fla from the Flash Hacks download page. The final effect, pageTurn.fla, shows the same effect, but with multiple pages. You can download it from the same page. Click on the image above to open the animation in a new window.

Conclusion

The page turn effect described in this article shows how a fairly complex effect can be created through ActionScript.

As shown with this example, Flash retains its roots as a visual authoring tool even if you are using code to drive your motion graphics. The effect also relies heavily on other graphical features in addition to the code. These include embedded movie clips, masking, and faux 3D shading.

If you want to create compelling scripted motion graphics in Flash, being able to use the drawing tools is usually not that far away from being able to use ActionScript in relative importance.

You may be interested to know that a fully featured and open source page-turning .fla file is available at www.iparigrafika.hu/pageflip. The URL is well worth a visit if you want to create a commercial site based around the page turn effect quickly (that is, without further extending our version). Although it was created for Flash MX, the downloadable file extends the effect to include tear-off pages, solid pages (for book covers), and page cutouts.

Sham Bhangal is an author of and contributor to numerous books on Flash and ActionScript, including Foundation ActionScript for Flash MX, Flash MX Designer's ActionScript Reference, and Macromedia Flash MX Upgrade Essentials.

http://www.oreillynet.com/pub/a/javascript/2004/09/03/flashhacks.html

웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
초창기 오락실에서 인베이더, 갤러그, 디그더그, 방구차 등과 함께 인기를 누렸던 팩맨(pacman) 게임과 플래시 게임 소스입니다. 아래 파일 링크를 클릭해서 다운로드 받아 학습해보시고 나만의 개성이 담긴 팩맨 게임을 만들어보세요. 게임 방법은 다들 아실테지만 길에 놓여 있는 먹거리를 적의 공격을 피해가며 남김 없이 먹어주면 됩니다. 때론 막다른 골목에서 희망의 끈을 놓아야 하는 상황도 생기지만 새생명으로 다시 시작할 수 있습니다.^^

Flash_Pa-Francesc-7069.zip Pacman-Chebbi_M-3681.zip

[pacman-pastore.swf]

[pacman.swf]

웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
사용자 삽입 이미지
저번 포스팅 "현란한 동영상을 손쉽게 만들자! 플래시 모션 트위닝."에 이어 두번째 동영상을 만들었습니다. 보다 적은 용량으로 손쉽게 동영상을 만들게 해주는 플래시를 시연 동영상을 통해 알아보자. 직접 해보고 싶은 분들이 있다면 플래시 툴을 설치하시고 아래 fla 소스 파일을 실행해보세요.
아래 강좌(?) 동영상을 보고 플래시에 관심이 생겼다면 플래시 카페 또는 플래시 검색을 통해서 플래시의 기초를 다져보고 필요하다면 플래시 관련 책자를 구입해서 배워보자. 이미 플래시에 대해 잘 알고 있는 분이라면 웹프로그래머와 함께 팀을 만들어 하단 애니메이션 동영상과 같은 멋지고 재미있는 작품을 만들어보면 어떨까? 앞으로 플래시로 할 수 있는 것들에 관련해서 강좌 동영상을 만들어 소개할 생각이다. 생각보다 시간이 많이 소요되는 일이지만 플래시 매니아 친구들을 많이 만들기 위해 노력해봐야겠다.

[소스:flash_motion_20070701.fla / 동영상:flash_motion_20070701.swf]

[Flash] http://factor.kr/attachment/dl193.swf


[Flash] http://factor.kr/attachment/dk43.swf

http://factor.kr/attachment/dk43.swf
http://factor.kr/attachment/dk44.swf

웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
사용자 삽입 이미지
최근 UCC 열풍으로 많은 분들이 동영상 제작에 관심을 두고 있다. 방송 동영상 같은 것들을 짜깁기해서 UCC 동영상을 만들 수 있겠지만 저작권이 날로 중요해지고 있어 별로 추천하지 않는 방법이고 캠코더로 직접 촬영해서 UCC 동영상을 만들 수 있겠지만 표현할 수 있는 영상에 한계가 있고 나 같이 캠코더가 없는 사람은 동영상 UCC 제작을 포기해야 할까? 좋은 대안으로 현란한 동영상을 보다 손쉽게 만들고 보다 작은 용량의 동영상을 만들게 해주는 플래시(flash)라는 툴을 추천한다. 플래시에서는 모션 트위닝(motion tweening)이라는 기능으로 비교적 간단하게 움직이는 영상을 만들게 해준다. 아래 플래시 동영상에서 모션 트위닝으로 어떤 것을 할 수 있고 어떻게 제작하는 것인지 감상해보자. 아래 강좌(?) 동영상을 보고 플래시에 관심이 생겼다면 플래시 카페 또는 플래시 검색을 통해서 플래시의 기초를 다져보고 필요하다면 플래시 관련 책자를 구입해서 배워보자. 이미 플래시에 대해 잘 알고 있는 분이라면 웹프로그래머와 함께 팀을 만들어 하단 애니메이션 동영상과 같은 멋지고 재미있는 작품을 만들어보면 어떨까? 앞으로 플래시로 할 수 있는 것들에 관련해서 강좌 동영상을 만들어 소개할 생각이다. 생각보다 시간이 많이 소요되는 일이지만 플래시 매니아 친구들을 많이 만들기 위해 노력해봐야겠다.

[flash_motion.swf]

[Flash] http://factor.kr/attachment/cl187.swf


[Flash] http://factor.kr/attachment/cl187.swf

http://factor.kr/attachment/dk43.swf

[Flash] http://factor.kr/attachment/cl187.swf

http://factor.kr/attachment/dk44.swf

웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
얼마전 플래시 "플래시 다운로드 및 복사 방법 이모저모" 라는 포스팅을 했었고 플래시 복사법에 관련한 동영상을 첨부해본다고 했었다. 오늘 태그(TAG,HTML) 입문자들이 플래시 위젯을 블로그 스킨에 붙이는 것을 어려워 하는 것 같아 도움이 될만한 참고 동영상을 만들었다.  플래시와 웹문서에 관련해서 위지윅에디터로 3가지 모드에서 보여주고 있다. 기본 모드는 위지윅 모드로 마우스나 키보드로 웹문서를 바로 편집하고 바로 확인할 수 있고 HTML 모드는 웹문서의 실제 코드(HTML)를 편집해주는 모드이고 미리보기 모드 실제 웹브라우져에서 출력되는 화면을 보여주는 모드이다. 플래시를 웹브라우져에 표현하기 위해서는 <EMBED> 태그와 <OBJECT> 태그를 사용하고 있고 여러가지 브라우져와 여러가지 포털 블로그에서 제대로 플래시를 보여주기 위해서는 두가지 태그를 혼용해서 사용해야 하며 인터넷 익스플로러(IE) 의 경우 설명한 태그만 사용해서는 플래시가 활성화되지 않아 테두리가 생기므로 외부 자바스크립트를 별도로 불러서 처리해줘야 한다. 테두리 문제는 태그를 사용해서 자동으로 프로그램을 활성화 시키는 기술에 대한 저작권 분쟁에서 벗어나기 위해 마이크로소프트가 익스플로러(IE) 를 패치해서 생긴 문제이다. 그래서 별도의 자바스크립트 파일을 만들어 플래시 태그를 출력해주는 과정이 필요하다. 위지윅 모드에서는 플래시의 크기 조절을 할 수 있고 다른 웹페이지의 내용을 복사해서 붙여 넣기 할 수 있다. 개인적으로 위지윅에디터와 EDITPLUS 를 주로 활용하고 있으나 드림위버 또는 나모에디터로 편집하는 것을 선호하는 분들도 있다.
참고로 위지윅 에디터는 자바스크립트만으로 구성한 에디터로 많은 게시판이나 블로그 글쓰기 기능에서 볼 수 있으며 포털 게시판, 카페, 블로그에서도 볼 수 있으나 포털에 따라 태그를 직접 편집할 수 없게 하거나 일부 태그 또는 자바스크립트를 사용할 수 없게 막아서 아래 동영상과 같은 화면을 체험할 수 없을 수 있다.
아직 잘 이해가 안되시는 분들은 아래 참고링크의 웹에디터(위지윅에디터)를 이용해서 직접 테스트해보길 바라며 조만간에 플래시 활용에 관련된 추가 동영상을 편집해서 이해를 돕도록 해보겠습니다.

[위지윅에디터 참고링크]
http://www.interspire.com/devedit/demonx/demo1.php
http://www.fckeditor.net/demo
http://www.chcode.com/cheditor/demo.shtml

[Flash] http://factor.kr/attachment/dl190.swf



웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
아주 심플한 벽돌깨기를 만들 수 있는 기본 뼈대가 되는 플래시 게임 소스코드는 첨부파일을 받으면 되고 실행화면은 아래 플래시에서 미리 볼 수 있다. 핵심이 되는 소스 코드는 제일 하단에 볼 수 있고 스스로 플래시 툴을 가지고 개성에 맞게 수정하고 실험하다보면 멋진 벽돌깨기 게임을 만들 수 있지 않을까? 플래시 및 액션스크립트 입문자를 위해 필요하다면 공개 프로젝트(?) 형태로 함께 벽돌깨기 게임을 만들어 볼 수도 있다. 다른 게임 소스가 필요하다면 아래 링크로 찾아가 검색해보고 맘에 드는 소스를 받아서 공부해볼 수 있다.
http://www.hompydesign.com/club/flash_movie.php?menu0=Games

웹프로그래머의 홈페이지정보 블로그 http://hompy.info

[Flash] http://factor.kr/attachment/dl173.swf


[주요 액션스크립트 소스코드]

_root.score = 0;

sndHit1 = new Sound();
sndHit1.attachSound("snd_hit2");

sndHit2 = new Sound();
sndHit2.attachSound("snd_hit1");

Mouse.show();
//start positions
x=300;
y=200;
stickX = 0;

//boundaries
boundaries = new Object();
boundaries.minX = 22;
boundaries.maxX = 527;
boundaries.minY = 22;
boundaries.maxY = 385.9;

//directions
direction = new Object();
direction.offsX = 0;
direction.offsY = 3;
direction.stick = 0;

//bricks
bricks = new Object();
bricks.x = 19;
bricks.y = 6;
bricks.cornerArea = 0.4;
bricks.stickEdge = 0.2;

init();

//functions

//count next position of X and Y of the object
function returnXY(x,y)
{
 var collision = false;
 //stick collision
 if (_root.ball.hitTest(_root.stick) && direction.offsY >= 0) {

  collision = true;
  direction.offsY *= -1;
  offset = _root.stick._width/2*(1-bricks.stickEdge);
  leftEdge = _root._xmouse - offset;
  rightEdge = _root._xmouse + offset;  
  if (_root.ball._x <= leftEdge && direction.offsX >= 0) {
   direction.offsX = -3;
  } else if (_root.ball._x < _root._xmouse && direction.offsX <= 0) {
   direction.offsX = -2;
  } else if (_root.ball._x >= rightEdge && direction.offsX <= 0) {
   direction.offsX = 3;
  } else if (_root.ball._x > _root._xmouse && direction.offsX >= 0) {
   direction.offsX = 2;
  }
 }
 //screen collision
 if (x >= boundaries.maxX || x<= boundaries.minX)
 {  
  direction.offsX *= -1;
 }
 if (y <= boundaries.minY)
 {
  direction.offsY *= -1;
 }
 //down fall
 if (y >= boundaries.maxY) {
  gotoAndPlay(2);
 }
 
 //brick collision
 hitten = getCollision();
 if (hitten != false) {
  collision = true;  
 
  if (eval(hitten)._totalframes == eval(hitten)._currentframe) {
   removeMovieClip(hitten);
   _root.score += 10;
   if (_root.score == bricks.x*bricks.y) {
    gotoAndPlay(1);
   }
  } else {
   _root.score += 5;
   eval(hitten).nextFrame();
  }
  //if (_root.ball._x > eval(hitten)._x - eval(hitten)._width/2 && _root.ball._x < eval(hitten)._x + eval(hitten)._width/2) {
   direction.offsY *= -1;
  //}
  offset = eval(hitten)._width*(1-bricks.cornerArea);
  leftEdge = eval(hitten)._x - offset;
  rightEdge = eval(hitten)._x + offset;

  if (_root.ball._x <= leftEdge && direction.offsX > 0) {
   direction.offsX *= -1;
  } else if (_root.ball._x >= rightEdge && direction.offsX < 0) {
   direction.offsX *= -1;
  } 
 }
 x+= direction.offsX;
 y+= direction.offsY;

 returnObj = new Object();
 returnObj.x = x;
 returnObj.y = y;
 
 if (collision)
 {
  var snd = Math.round(Math.random());
  if (snd)
   sndHit1.start();
  else
   sndHit2.start();
 }
 
 return returnObj;
}

//makes bricks
function init() {
 _root.brick1._visible = false;
 
 for (j=0; j<bricks.y; j++) {
  amount = bricks.x;
  i=0;
  while (amount>0) {
   duplicateMovieClip (_root.brick1, "mc_"+i+"_"+j, i+j*bricks.x);
   setProperty ("mc_"+i+"_"+j, _x, _root.brick1._x - i*_root.brick1._width);
   setProperty ("mc_"+i+"_"+j, _y, _root.brick1._y + j*_root.brick1._height);
   i++;
   amount--;
  }
 }
}

//detects collisions
function getCollision() {
 for (i=0; i<bricks.y; i++) {
  for (j=0; j<bricks.x; j++) {
   if (_root.ball.hitTest(eval("mc_"+j+"_"+i))) {
    return "mc_"+j+"_"+i;
   }
  }
 }
 return false;
}

이올린에 북마크하기(0) 이올린에 추천하기(0)
웹서핑을 하다보면 간혹 맘에 드는 플래시들을 보게 되고, 그 플래시를 내 블로그나 홈페이지에 가져오고 싶어질 때가 있다. 우리 같은 IT에 관련된 사람들은 손쉽게 가져올 수 있지만 관련 지식이 부족한 비전문가의 입장에서는 어려운 작업일 수 있다. 하지만 초보자들도 손쉽게 사용할 수 있는 플러그인이 있다. 아래 파일링크를 클릭하면 관련 플러그인을 받을 수 있고 이를 설치하면 브라우져에 "내가 원하는 폴더로 플래시를 다운로드할 수 있게 해주는" 버튼이 생긴다. 인터넷 익스플로러(IE)용과 파이어폭스(Firefox)용 2가지 버전이 있으며 설치방법은 IE 용의 경우 압축을 풀고 실행파일을 실행해서 설치해주면 된다. 파이어폭스용은 설치 메뉴얼을 참고하기 바란다. 자세한 내용은 아래 링크들을 클릭하면 볼 수 있다.

Sothink SWF Catcher for IE
Sothink SWF Catcher for Firefox

리눅스(linux) 나 유닉스(unix)에서 플래시(flash) 파일을 받고 싶다면 명령 프롬프트 상태에서 wget 툴을 사용할 수 있다. 사용법은 간단하다. wget "플래시URL" 이라고 명령하면 받고 싶은 플래시 파일을 현재 폴더로 가져와 파일로 생성시켜준다. wget 은 플래시 뿐만 아니라 웹페이지는 물론 동영상 파일 같은 것도 가져올 수 있다. 아래 예제를 참고하기 바란다.

[예제]
wget http://factor.kr/attachment/cl141.swf -O flash1.swf
wget http://factor.kr/attachment/dl142.swf -O flash1.swf
wget http://factor.kr/attachment/dl143.swf -O flash1.swf
wget http://www.sothinkmedia.com/download/swfcatcher_IE.zip
wget http://www.sothinkmedia.com/download/swfcatcher.xpi
wget http://www.tistory.com -O tistory.html

굳이 파일을 가져올 필요 없이 플래시를 내 블로그 게시물로 저장하고 싶다면 웹페이지에서 원하는 플래시의 상단에서 드래그 해서 하단으로 마우스를 가져오면 블럭이 설정되고 [CTRL] 키와 [C] 키를 동시에 눌러 복사를 하고 블로그 글쓰기의 (위지윅) 편집기 내부에 마우스를 위치시킨 후 마우스 버튼을 클릭한 후 [CTRL] 키와 [V] 키를 동시에 눌러 붙여 넣기를 하면 플래시 복사 작업이 끝난다. 플래시 뿐만 아니라 게시물과 동영상 등 홈페이지에 보이는 대부분의 것을 가져올 수 있다.

그러나 위지윅 편집기가 아닌 경우에는 플래시 태그를 가져와야 한다. 플래시가 포함된 홈페이지 내부에 마우스를 위치한 후 마우스 오른쪽 버튼을 클릭하고 소스 보기 메뉴를 선택하면 HTML 로 구성된 홈페이지 소스를 윈도우즈 편집기로 확인할 수 있다. 윈도우즈 편집기 검색 기능을 사용해서 "swf" 를 키워드로 검색하면 원하는 플래시 태그를 찾을 수 있고 "<object" 로 시작해서 "</object>" 로 끝나는 부분이 플래시 태그 소스이며 간혹 "<embed" 로 시작해서 "</embed>" 로 끝나는 태그 소스도 있다. 이 플래시 태그를 복사하면 된다. 아래는 플래시 태그 소스 예제이며 이런 구성으로 된 태그를 찾아야 한다.

[예제#1] object 만으로 구성된 플래시 태그
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="848" height="424"><param name="wmode" value="transparent"/><param name="movie" value="http://factor.kr/attachment/dl143.swf"/><!--[if !IE]> <--><object type="application/x-shockwave-flash" wmode="transparent" data="http://factor.kr/attachment/dl143.swf" width="848" height="424"><p><a href="http://factor.kr/attachment/dl143.swf">[Flash] http://factor.kr/attachment/dl143.swf</a></p></object><!--> <![endif]--></object>

[예제#2] embed 만으로 구성된 플래시 태그
<EMBED pluginspage=http://www.macromedia.com/go/getflashplayer src=http://www.hompydesign.com/club/blogkeyword.swf width=190 height=200 type=application/x-shockwave-flash quality="high">

[예제#3] embed 와 object 를 혼합해서 구성된 플래시 태그
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="190" height="200"><param name="FlashVars" value="skin=http://hompy.us/club/images/sample.jpg"><param name="movie" value="http://www.hompydesign.com/club/blogmemo.swf"><param name="wmode" value="opaque"><embed src="http://flash.pe.kr/club/blogmemo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="300" height="200" wmode=opaque FlashVars="skin=http://hompy.us/club/images/sample.jpg"></embed></object>

[팁]
태그 소스 예제를 Editplus(편집기) 에 붙여 넣기 한 후 [CTRL]+[B] 키를 누르면 태그가 적용된 모습을 내장브라우져로 볼 수 있다. [CTRL]+[A] 키를 누르고 [CTRL]+[C] 키를 누르면 플래시를 복사 할 수 있고 블로그 위지윅 에디터에서 [CTRL]+[V] 를 눌러 붙여 넣기 할 수 있다. 물론 다른 에디터에서도 비슷한 기능이 있으므로 활용해볼 수 있다.

복사해서 붙여 넣기를 하다보면 플래시가 제대로 동작하지 않는 경우가 있다. 포털 카페나 블로그에서는 태그(HTML)를 일부 제한 하는 경우가 있어 플래시 태그을 수정해야 할 경우가 생긴다. 그럴 경우에 위에 팁에서 소개한 에디터로 편집을 하고 테스트를 해본 후에 붙여 넣기 해야한다. 때로는 플래시 태그 내에 플래시 파일의 주소가 정확하지 않아서 플래시가 제대로 보이지 않을 수 있다. 예를 들면 http://www.hompydesign.com/club/blogmemo.swf 와 같은 절대주소로 되어 있어야 하지만 /club/blogmemo.swf 나 ./blogmemo.swf 또는 blogmemo.swf 와 같은 상대주소 되어 있는 경우가 있다. 이럴 경우에는 도메인이 포함된 정확한 주소로 바꿔서 제대로 보이는 지 확인해봐야 한다. 모든 것이 완벽하지만 제대로 동작하지 않는 경우도 있다. 같은 홈페이지가 아닌 경우 파일을 읽을 수 없도록 보안 조치 했을 경우이다. 이럴 경우에는 파일을 다운로드 받아서 사용해야 한다.

팁에서 소개한 편집기나 HTML 소스 보기가 가능한 위지윅 웹에디터를 준비한다면 웬만한 플래시는 내 게시물로 만들 수 있다.
단, 필요에 의해 복사해야 할 때가 있겠지만 항상 저작권 문제로 다툼이 없도록 주의해야 할 필요가 있겠다.

오늘 소개한 내용은 플래시를 복사 하고 싶어하는 비전문가를 위한 팁이다. 하지만 오늘 소개한 내용도 어려운 분들이 있을 수 있다. 그래서 조만간 플래시 복사법에 대해 동영상으로 만들어 첨부해볼까 한다.


웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
그림판 형태로 구성된 네이게이션이 이색적인 플래시로 만들어진 홈페이지입니다. 메뉴를 클릭하면 화면이 줌인 되면서 서브 메뉴들이 보이는군요. 이런 스타일의 네비게이션도 괜찮아보입니다. 만들고 싶은 플래시가 하나 더 늘었네요. 저번처럼 미리 볼 수 있도록 시연 화면을 캡쳐해서 동영상으로 만들어보았습니다. 관심있는 분들은 아래 링크를 클릭하셔서 이것 저것 클릭해보세요. 그리고 외국 사이트에 한국 브랜드(삼성)가 보이니 반갑네요^^

http://www.leoburnett.ca/


웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
어제 추천한 비쥬얼이 멋진 플래시 홈페이지 만큼이나 멋지게 포장된 플래시 홈페이지 입니다. 미리 볼 수 있도록 홈페이지의 일부를 캡쳐해서 동영상으로 만들었습니다. 직접 감상을 하시려면 아래 링크를 클릭하시면 됩니다. 플래시로 만든 멋진 홈페이지들을 발굴하고 감상하다보면 좋은 아이디어도 생기고 좋은 작품도 나올 수 있겠죠? 물론 보는 것만으로 충분하지 않습니다. 직접 작은 것이라도 하나 하나 만들어 보는 것이 더 중요하겠지요.

http://www.vodafonejourney.com/

[Flash] http://factor.kr/attachment/dl142.swf




웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
플래시 관련해서 검색을 하다가 비쥬얼이 멋진 플래시 홈페이지를 발견해서 소개 합니다. 태그만 가져와서 보여줄 수 없는듯 싶어 동영상 캡쳐해서 미리 볼수 있도록 해봤습니다. 관심 있는 분들은 아래 링크를 클릭하시면 해당 페이지를 볼 수 있습니다. 이런 플래시를 만들려면 어떤 툴이 좋은지 궁금하네요. 이런 스타일로 플래시 홈페이지를 만들어 보신 분이 있다면 참고 자료 흘려두고 가세요. 언젠가는 만들어보고 싶다는 욕심이 생기는군요^^

http://www.travelersinsynch.com/challenge_popup.html

[Flash] http://factor.kr/attachment/dl143.swf




웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
어느 사이트에서 플래시 테트리스(tetris) 게임 소스 길이를 줄이려는 노력을 하고 있더군요. 아래는 965 바이트 용량의 테트리스 게임 소스입니다. 자신만의 테트리스 게임을 만들어보고 싶은 분들은 소스를 실행해보시고 수정하시다보면 작품 하나 만드실 수 있을듯 합니다. 새 플래시 도큐먼트를 만드시고 액션창에 소스를 붙여 넣기 하신 후 [CTRL]+[ENTER]키를 누르시면 실행화면을 감상할 수 있습니다. 플래시를 잘모르시는 초보 여러분들을 위해 별도로 tetris.fla 파일을 첨부하겠습니다. 플래시(flash)에 흥미가 생긴 분들이 있다면 제가 운영하는 플래시 카페(http://flashcafe.org) 도 많이 애용해주세요. 그리고 다른 플래시 게임 자료가 필요하신 분들은 여기(http://www.hompydesign.com/club/flash_movie.php?menu0=Games) 에서 찾아보세요.
* 참고 : 자작게임중 한자게임(http://hompy.info/6)도 있는데 가장 방문자가 많고 반응도 좋은 포스팅이에요.

웹프로그래머의 홈페이지정보 블로그 http://hompy.info/

[Flash] http://hompy.info/attachment/1171130202.swf



//--- Mini Game 1Kb by Strille. Version 1.5, 965 bytes
//--- Paste this code on frame 1, set scene size to 240x360, frame rate to 18 and Flash version to 7
//--- The code is not written with speed in mind, only small .swf size

createTextField("t", 1, 0, 300, 239, 24);
function c(a, b, g, h) {
        for (x=0; x<16; x++) {
                if (s[x] & 1 << g) {
                        if (q == 300) {
                                m[a+(x%4)+(b+(x>>2))*15] = -h;
                                continue;
                        }
                        if (m[a+(x%4)+(b+(x>>2))*15]>0 or b+(x>>2)>19 or a+(x%4)<0 or a+(x%4)>9)
                                return 1;
                        if (q < -1) {
                                m[a+(x%4)+(b+(x>>2))*15] = h;
                                if (b+(x>>2)<0) {
                                        delete onEnterFrame;
                                        t.text = z + "\tPress a key";
                                }
                        }
                }
        }
}
t.onKeyDown = function() {
        q = Key.getCode();
        if (!onEnterFrame) {
                w = z = 0;
                s = [4325376,178954464,8653312,null,89458032,268435455,89520863,
                83886080,2183168,178937791,1615119,null,null,167772160];
                m = [];
                i = random(28);
                d = random(16777215);
                v = -(u=3);
                onEnterFrame = function () {
                        t.text = z;
                        if (q == 37) {
                                u--;
                                if (c(u, v, i, d))
                                        u++;
                        }
                        if (q == 38) {
                                q = i++;
                                if (!(i%4))
                                        i -= 4;
                                if (c(u, v, i, d))
                                        i = q;
                        }
                        if (q == 39) {
                                u++;
                                if (c(u, v, i, d))
                                        u--;
                        }
                        q = 300;
                        c(11, 3, d%28, 0xeeeeee);
                        c(u, v, i, d);
                        clear(); beginFill(0xeeeeee); lineStyle(0); lineTo(151, 0);
                        lineTo(151, 301); lineTo(0, 301); endFill(); lineStyle(2);
                        while (q--) {
                                if (m[q]) {
                                        beginFill(m[q]);
                                        if (m[q]<0) {
                                                beginFill(-m[q]);
                                                delete m[q];
                                        }
                                        moveTo(1+(q%15)*15, 1+int(q/15)*15); lineTo(15+1+(q%15)*15, 1+int(q/15)*15);
                                        lineTo(15+1+(q%15)*15, 15+1+int(q/15)*15); lineTo(1+(q%15)*15, 15+1+int(q/15)*15); endFill();
                                }
                        }
                        if (!(w++%(3-2*Key.isDown(40)))) {
                                v++;
                                if (c(u, v, i, d)) {
                                        v--;
                                        q--;
                                        c(u, v, i, d);
                                        for (i=0; i<20; i++) {
                                                for (x=0; m[x+i*15];x++) {}
                                                if (x == 10) {
                                                        m.splice(i*15, 15);
                                                        m.unshift(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
                                                        z += x;
                                                }
                                        }
                                        i = d%28;
                                        d = random(16777215);
                                        v = -(u=3);
                                }
                        }
                };
        }
};
t.onKeyDown();
Key.addListener(t);

//--- 출처: http://www.strille.net/works/tetris_1Kb/
이올린에 북마크하기(0) 이올린에 추천하기(0)
사용자 삽입 이미지
다시 봐도 흥미로운 플래시 애니메이션이다. 대략 키 프레임으로 프레임 하나 하나 수작업을 한 것 같은데, 플래시 말고 또 다른 툴을 사용했을지는 알 수 없지만 이런 작품 하나 정도는 만들어 소장하고 싶어진다. 이런 스타일의 플래시는 만들어 본적이 없어서 플래셔와 애니메이터 친구를 만들어 같이 제작해보면 어떨까 싶다. 액션은 내가 맡고 디자인과 모션을 맡긴다면 역할 분담을 통해 만드는 시간도 절약할 수 있어 어느 정도 수준의 작품은 만들 수 있지 않을까? 이왕 만들꺼라면 수준이 떨어지지 않는 선에서 만들고 싶다. 이런 작품 만들고 싶은 플래셔, 애니메이터, 블로거가 있다면 흔적 남겨주면 좋겠다. 꼭 이것 만은 아니더라도 플래시 관련된 정보나 프로젝트를 서로 공유할 수 있으면 좋겠다. 나의 주된 관심사는 플래시로 어플리케이션 수준의 응용 프로그램을 만드는 것(RIA?)과 블로그나 홈페이지에 위젯 등으로 쓸 수 있는 플래시 악세사리를 만드는 것이다. 생각해둔 것도 많고 이미 구현해본 것도 어느 정도 있다. 플래시의 버젼과 성능이 날로 향상되고 있고 네티즌들의 컴퓨터 사양이 기하급수적으로 높아지고 있으며 포탈을 비롯한 많은 사이트들이 플래시를 다양한 용도로 활용하고 있다. 그래서 플래시를 배워두는 것도 나쁘지 않을 것이다. 플래시에 대해 아직 모르는 분들이 있다면 포털 검색에서 플래시 또는 flash 라고 검색 해보면 수 많은 커뮤니티와 웹페이지 들이 쏟아져 나올 것이다. 그것을 참조 하거나 운영하고 있는 커뮤니티(http://flashcafe.org 또는 http://플래시.kr/)를 참조할 수 있다. 플래시 제작 툴을 받고 싶다면 아도브사의 다운로드 페이지에서 받을 수 있다. 플래시 예제가 필요하다면 플래시 소스 자료실에서 소스를 받을 수 있고 직접 수정해가며 플래시를 제작할 수 있다.
끝으로 플래시를 다소 전문적(?)으로 다루고 플래시가 두렵지(?) 않고 재미있다고 생각하는 분들이 있다면 서로 왕래하면서 지내면 좋겠다.

[Flash] http://factor.kr/attachment/dk43.swf

http://factor.kr/attachment/dk43.swf
http://factor.kr/attachment/dk44.swf

웹프로그래머의 홈페이지정보 블로그 http://hompy.info/
이올린에 북마크하기(0) 이올린에 추천하기(0)
요즘 웹서핑을 하다가 보면 플래시를 활용하는 곳이 눈에 띄게 많이 보였다. 네이버 같은 경우 로그인 부분에 플래시를 이용하고 있었고 티스토리와 테터툴즈는 멀티 파일 업로드 모듈과 뮤직 플레이어 모듈로 플래시를 사용하고 있었으며 동영상 UCC 사이트들은 동영상 플레이어를 플래시로 사용하는 것이 일반적인 것 같았다. 싸이월드 홈2의 경우 위젯들을 플래시로 구성하고 있다. 플래시의 이와 같은 선전으로 MS 같은 회사에서 플래시와 경쟁하는 툴을 만든다고 했던 뉴스 기사도 생각이 난다.
플래시(flash)의 장점은 어느 정도 사용법을 익힌 사용자라면 손쉽게 동적이면서 화려한(?) 홈페이지를 만들 수 있다는 것이다. 그리고 조금 전문적인 지식을 익히면 웬만한 응용프로그램 수준의 홈페이지를 만들수도 있다. 이를 RIA(Rich Internet Application)라고 부르며 AJAX(Asynchronous JavaScript + XML)와 비교되곤 한다.
난 그동안 꾸준히 플래시로 할 수 있는 것들을 실험하고 그 중에 몇몇은 내 블로그와 홈페이지에 올려 놓곤 했다. 회사에서는 전세계 과학자 데이타베이스를 구축하는 서비스를 단독 플래시로 구성하기도 했다. 웹프로그래머다 보니 주로 만드는 플래시는 모션쪽 보다는 웹서버나 데이타베이스서버 또는 채팅서버와 연동하는 쪽에 비중을 두게 된다.
최근 블로그 스킨에 나만의 개성을 담기 위해 대대적인(?) 수정 작업에 들어갔다. 아직 마음에 들 정도는 아니지만 작지 않은 변화를 준 상태다. 나만의 개성있는 블로그 스킨을 만들고 싶은 것은 블로거라면 누구나의 가질 수 있는 바램이다. 그것을 생동감 있게 만드는 것으로 플래시만한 것이 없다.
플래시란 물건이 단점이 없는 것은 아니지만 아직 플래시를 활용하고 있지 않다면 앞으로 플래시를 활용해 볼 것을 추천한다.
아래 보이는 플래시는 네이게이션이 포함된 나만의 블로그 스킨이다.

급조한 상태라 아직 원하는 만큼 구성된 상태는 아니지만 어느 정도 블로그의 분위기를 바꾸는 정도의 역할은 해냈다.

웹프로그래머의 홈페이지정보 블로그 http://hompy.info
이올린에 북마크하기(0) 이올린에 추천하기(0)
* 플래시 무비 1115작품 (Flash movies:Effects:) *
3D , Animations , Basics , Effects , Games , Interfaces , Scripting , Smart_Clips , Sound ,
Third_Party , Utilities
(참고:다운받기를 클릭할 때, 새창이 열리면 F5를 누르시고 파일수신하세요.)

 Very beautiful wires trailer - can c...

 In this movie, the lasers trace out ...

 simple masking use in gallery...

 This is a Special effect tutorial in...
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
이올린에 북마크하기(0) 이올린에 추천하기(0)