Posted
Filed under etc
2009/08/20 20:19 2009/08/20 20:19
Posted
Filed under Action Script
//배열 특정 위치 값 제거하기
function array_slice(target_array:Array, target_num:Number){
 for(var i=0; i<target_array.length; i++){
   if(i==target_num){
    target_array.splice(i,1);
   }
 }
}
2009/08/19 11:52 2009/08/19 11:52
Posted
Filed under Action Script
[actions script 2.0 ] 라이브러리에서
rand 7 일 경우 0에서 7 까지 생성

function get_srand(randNum:Number){
 return Math.floor(Math.random() * randNum);
}
2009/08/19 11:14 2009/08/19 11:14
Posted
Filed under Action Script

  
 Advertise|About us|Site map|Syndicate|Search site|Mailing list|View Authors|Become an Author Home  Tutorials  Forums  Articles  Blogs  Movies  Library  Employment  Press  Buy templates
 
 
   home » actionscript library » Search Results
   
 


 Search Results
Your search returned 0 categories and 8 Scripts Actionscripts: 


 Tab control for flash email form 
 
Selection.setFocus("_level0.name");
stop();

// sets tab order down the page of text fields
on (keyPress "<Tab>") {
        if (Selection.getFocus() == "_level0.name") {
                Selection.setFocus("_level0.email");
        } else if (Selection.getFocus() == "_level0.email") {
                Selection.setFocus("_level0.comments");
        } else if (Selection.getFocus() == "_level0.comments") {
                Selection.setFocus("_level0.name");
        }
}


Posted by: Flash Harry | website http://www.webdesignlab.co.uk 
 
 
 
 Setting TextFields to listen for 
 
//Function by missing-link

//create the function with the TextField object, and give it a single parameter
TextField.prototype.setEnterDetection=function(enterFunction){
        //when the text field is selected, it will get the current focus to compare later
        this.onSetFocus=function(){
                tempFocus=Selection.getFocus();
        }
       
        //then, if a key is pressed, this function is run
        this.onKeyDown=function(){
                //if the current focus is on the this textfield
                if(Selection.getFocus()==tempFocus){
                        //if the key pressed was the "enter" key
                        if(Key.isDown(Key.ENTER)){
                                //run the function to be called
                                eval(enterFunction)()
                               
                        }
                }
        }
        //!!!Must add the listener to this object
        Key.addListener(this);
}


Posted by: missing-link | website http://www.evolutionar-e.com 
 
 
 
 Table maker 
 
/////////////////////////////////////////
/////////// CREATE TABLE ////////////////
/////////////////////////////////////////
var tableFormat:TextFormat = new TextFormat();
var tableFormat2:TextFormat = new TextFormat();
tableFormat.font = "_sans";
tableFormat.size = 11;
tableFormat.align = "center";
tableFormat2.bold = true;
tableFormat2.font = "_sans";
tableFormat2.align = "center";
//
this.createTextField("columns_txt", 1, 5, 10, 50, 20);
columns_txt.type = "input";
columns_txt.border = true;
columns_txt.background = true;
columns_txt.text = "3";
//
columns_txt.setTextFormat(tableFormat);
//
columns_txt.onSetFocus = function() {
        columns_txt.text = "";
};
columns_txt.onChanged = function() {
        columns_txt.setTextFormat(tableFormat);
};
//
space = 5;
this.createEmptyMovieClip("tbaleMakerHolder_mc", _root.getNextHighestDepth());
makeHeaders = function () {
        columns_txt.setTextFormat(tableFormat);
        _root.createTextField("rowNum_txt", _root.getNextHighestDepth(), space, 40, 50, 20);
        _root.rowNum_txt.type = "input";
        _root.rowNum_txt.background = true;
        _root.rowNum_txt.border = true;
        _root.rowNum_txt.text = "5";
        rowNum_txt.setTextFormat(tableFormat);
        c = Number(columns_txt.text);
        function doThis() {
                setColumnFunction(c, _root.rowNum_txt);
        }
        if (c != NaN) {
                for (i = 0; i < c; i++) {
                        _root.createTextField("columnHeader" + i, _root.getNextHighestDepth(), (100 * i) + space, space, 90, 20);
                        _Hdr = _root["columnHeader" + i];
                        _Hdr.type = "input";
                        _Hdr.border = true;
                        _Hdr.background = true;
                        _Hdr.html = true;
                        _Hdr.htmlText = "true";
                        _Hdr.text = "Clmn " + Number(i + 1) + " Hdr";
                        _Hdr.setTextFormat(tableFormat2);
                        setHandlers(_Hdr, tableFormat2);
                        _root.header_array.push(_Hdr.text);
                }
                //after column titles have displayed:
                _root.columns_txt.removeTextField();
        }
        makeButton("Add Number of Rows", doThis, 5, 65);
};
//
function setColumnFunction(_c, _txt) {
        _txt.onSetFocus = function() {
                _txt.text = "";
        };
        //_txt.onChanged = function() {
        r = Number(_txt.text);
        _r = 0;
        __c = 0;
        totalRC = r * _c;
        for (z = 0; z < totalRC; z++) {
                _root.createTextField("field_" + __c + "_" + _r, _root.getNextHighestDepth(), (100 * _r) + space, (30 * __c) + (space * 7), 90, 20);
                _T = _root["field_" + __c + "_" + _r];
                _T.type = "input";
                _T.border = true;
                _T.background = true;
                _T.html = true;
                _T.htmlText = "true";
                _T.text = "R " + Number(__c + 1) + " : C " + Number(_r + 1);
                _T.setTextFormat(tableFormat);
                setHandlers(_T, tableFormat);
                __c++;
                if (__c > r - 1) {
                        __c = 0;
                        _r++;
                }
                currentX = _T._x;
                currentY = _T._y;
        }
        //after all is done:
        _txt.removeTextField();
        makeButton("Make A Nice Table", makeTable, 5, currentY + 30);
        //};
}
//
function setHandlers(t, f) {
        t.onSetFocus = function() {
                t.text = "";
                //trace(this);
        };
        t.onChanged = function() {
                t.setTextFormat(f);
        };
        t.onKillFocus = function() {
        };
}
//
var header_array:Array = new Array();
//
//
//
//
//
//
//
//
/////////////////////////////////////////
/////////// POST TABLE //////////////////
/////////////////////////////////////////
//Output
columnSpace = 100;
function makeTable() {
        //make hearders
        traceOutput();
        //function makeOutPut() {
        var tableFormat:TextFormat = new TextFormat();
        _root.createTextField("table_txt", 1, 20, 350, 1100, 600);
        table_txt.wordWrap = true;
        table_txt.multiline = true;
        table_txt.html = true;
        tableFormat.font = "_sans";
        //
        rowHeaders = "";
        for (ttl = 0; ttl < c; ttl++) {
                thisHeader = _root["columnHeader" + ttl];
                rowHeaders += "<b>" + thisHeader.text + "\t</b>";
        }
        rowHeaders += "";
        var _rowHeaders = rowHeaders;
        //make rows
        for (rowNum = 0; rowNum < r; rowNum++) {
                var thisRow = "";
                for (col = 0; col < c; col++) {
                        thisField = _root["field_" + rowNum + "_" + col];
                        //trace(thisField.text);
                        thisRow += thisField.text + "\t";
                }
                if (rows_init != true) {
                        rows_init = true;
                        rows = thisRow + "" + newline;
                } else {
                        rows += thisRow + "" + newline;
                }
        }
        var _rows = rows;
        //make column spacing
        cSpace = "<textformat tabstops='[";
        for (cS = 0; cS < c; cS++) {
                if (cS < c - 1) {
                        cSpace += (Number((cS + 1) * columnSpace)) + ",";
                } else {
                        cSpace += (Number((cS + 1) * columnSpace));
                }
        }
        cSpace += "]'>";
        _cSpace = cSpace;
        //
        table_txt.htmlText += _cSpace;
        table_txt.htmlText += _rowHeaders;
        table_txt.htmlText += _rows;
        table_txt.htmlText += "</textformat>";
        table_txt.setTextFormat(tableFormat);
}
//
function traceOutput() {
        //c comes from set tables as
        rowHeaders = "\"";
        for (ttl = 0; ttl < c; ttl++) {
                thisHeader = _root["columnHeader" + ttl];
                rowHeaders += "<b>" + thisHeader.text + "\t</b>";
        }
        rowHeaders += "\"";
        ttl_init = false;
        for (rowNum = 0; rowNum < r; rowNum++) {
                var thisRow = "";
                for (col = 0; col < c; col++) {
                        thisField = _root["field_" + rowNum + "_" + col];
                        //trace(thisField.text);
                        thisRow += thisField.text + "\\" + "t";
                }
                if (rows_init != true) {
                        rows_init = true;
                        rows = "table_txt.htmlText +=\"" + thisRow + "\";" + newline;
                } else {
                        rows += "table_txt.htmlText +=\"" + thisRow + "\";" + newline;
                }
        }
        rows_init = false;
        cSpace = "table_txt.htmlText = \"<textformat tabstops='[";
        for (cS = 0; cS < c; cS++) {
                if (cS < c - 1) {
                        cSpace += (Number((cS + 1) * columnSpace)) + ",";
                } else {
                        cSpace += (Number((cS + 1) * columnSpace));
                }
        }
        cSpace += "]'>\";";
        outPut = "var tableFormat:TextFormat = new TextFormat();" + newline;
        outPut += "this.createTextField(\"table_txt\", 1, 0, 0, 800, 600);" + newline;
        outPut += "table_txt.wordWrap = true;" + newline;
        outPut += "table_txt.multiline = true;" + newline;
        outPut += "table_txt.html = true;" + newline;
        outPut += "tableFormat.font = \"_sans\";" + newline;
        outPut += cSpace + newline;
        outPut += "table_txt.htmlText +=" + rowHeaders + ";" + newline;
        outPut += rows;
        outPut += "table_txt.htmlText += \"</textformat>\";" + newline;
        outPut += "table_txt.setTextFormat(tableFormat);";
        trace(outPut);
}
//
function makeButton(_nm, _fncn, X, Y) {
        removeMovieClip(_root.button);
        _root.createEmptyMovieClip("button", _root.getNextHighestDepth());
        var btnTxt_frmt:TextFormat = new TextFormat();
        btnTxt_frmt.font = "_sans";
        btnTxt_frmt.size = 11;
        btnTxt_frmt.bold = true;
        btnTxt_frmt.align = "left";
        button.createTextField("button_txt", 1, 5, 5, 1000, 25);
        button.button_txt.text = _nm;
        tX = button.button_txt.textWidth + 30;
        button.button_txt.setTextFormat(btnTxt_frmt);
        button.beginFill(0x0000ff, 30);
        button.lineStyle(.5, 0xff0000, 100);
        button.moveTo(0, 0);
        button.lineTo(tX, 0);
        button.lineTo(tX, 25);
        button.lineTo(0, 25);
        button.lineTo(0, 0);
        button.endFill();
        button._x = X;
        button._y = Y;
        button.onPress = function() {
                _fncn();
        };
}
makeButton("Add Number of Columns", makeHeaders, 5, 35);

Posted by: John Glynn | website http://www.leadminepond.com 
 
 
 
 TextField.prototype.numberOnly 
 
TextField.prototype.numberOnly = function() {
        this.onChanged = function() {
                lastInput  = this.text.length-1
                cValue   = this.text.charCodeAt(lastInput)
                if(cValue < 48 || cValue > 57) {
                        trace("illegal character: "+cValue);
                        trace("removed: "+this.text.charAt(lastInput));
                        this.text = this.text.substring(0,this.text.length-1);
                } else {
                        trace("allowed character: "+cValue);
                        trace("substring: "+this.text.charAt(lastInput)+","+lastInput)
                }
        }
       
}

// FLASHMX - SHiZNiT@ef/#FLASH
//
// create textfield
createTextField("myInput", depth++,0,0,100,21);
myInput.border = true;
myInput.type = "input";
myInput.numberOnly();

// set focus
Selection.setFocus(field)


Posted by: SHiZNiT | website http://www.developemental.com 
 
 
 
 Copy the contents of one textfield and paste them into another 
 
onClipEvent (enterFrame) {
        if (Key.isDown(17) && Key.isDown(67)) {
                Selection.setFocus("_root.text") && Selection.setFocus("_root.text2");
        } else if (Key.isDown(17) && Key.isDown(86)) {
                Selection.setFocus("_root.text2");
                _root.text2 = _root.text;
        }
}

First the user presses control C to copy, then control V to paste to a textfield.
The above example works in HTML and gets around the focus problem by setting the focus at the begining.

Unfortuanately it's not very practical as it doesn't set the focus on the first textfield properly. Maybe when I've a little more time I'll try and work it out.
Posted by: No name | website http:// 
 
 
 
 Make the TAB button setFocus of the next text box in (LEVEL5)- for example 
 
In the following example I load my movie with the text boxes into level5. All the actions focusing the text boxes are in the level 5 movie:
Level 5 Movie:
1) First set the focus of your text box in frame 1: Selection.setFocus("box1");
This means the end user will be presented with a blinking cursor when the movie first loads. 2) Place the following action on an 'invisible button': on (keyPress "<Tab>") {
        if (Selection.getFocus() == "_level5.box1") {
                Selection.setFocus("box2");
        } else if (Selection.getFocus() == "_level5.box2") {
                Selection.setFocus("box3");
        } else if (Selection.getFocus() == "_level5.box3") {
                Selection.setFocus("box4");
        } else if (Selection.getFocus() == "_level5.box4") {
                Selection.setFocus("box1");
        }
}

Change the variable names to the ones of your choice. You could have box1 leading onto box4 etc.
Posted by: No name | website http:// 
 
 
 
 SelectionManager 
 
/**
* @author: Eric Feminella
* @url: http://www.ericfeminella.com
* @copyright: (c)2004 - 2006 code.ericfeminella.com
*/

import mx.controls.TextArea;


class com.displays.SelectionManager
{
       
        public static var caretIndex:Number;
        public static var mouseEvent:Boolean;
        public static var lastIndex:Number = 0;
       
       
        public function SelectionManager()
        {
                this.initUserEvent();
        }
       
       
        private function initUserEvent():Void
        {
                var mouseListenerObject:Object = {};
                mouseListenerObject.onMouseUp = SelectionManager.onSetFocus;
                Mouse.addListener(mouseListenerObject);
        }
       
       
        public static function onSetFocus():Void
        {
                if (Selection.getCaretIndex() != -1)
                {
                        SelectionManager.caretIndex = Selection.getCaretIndex();
                        SelectionManager.mouseEvent = true;
                        SelectionManager.lastIndex = 0;
                }
        }
       
       
        public function insertAtSelectedIndex(stringToInsert:String, selectedTextArea:TextArea):String
        {
               
                var index:Number = this.getIndex(stringToInsert.length);
               
                var originalString:String = selectedTextArea.text;
                var originalStringLength:Number = originalString.length;
               
                var selectionStart:String = originalString.substring(0, index);
               
               
                var selectionEnd:String = originalString.substring(index, originalStringLength);
               
                var newString:String = selectionStart + " "  + stringToInsert + " " + selectionEnd;
               
                return newString;
        }
       
       
        private function getIndex(stringToInsertLength:Number):Number
        {
               
                if (SelectionManager.mouseEvent)
                {
                        var index:Number = SelectionManager.caretIndex;
                        SelectionManager.lastIndex = index + stringToInsertLength + 2;
                }
                else
                {
                        var index:Number = SelectionManager.lastIndex + stringToInsertLength;
                        SelectionManager.lastIndex = index + 2;
                }
               
                SelectionManager.mouseEvent = false;
               
                return index;
        }
}

Posted by: Eric Feminella | website http://www.ericfeminella.com 
 
 
 
 Setting the tab key 
 
onClipEvent (keyDown) {
        if (Selection.getFocus() == "_level0.movieClip.textboxVariable1"&&Key.isDown(Key.TAB)) {
                Selection.setFocus( "_level0.movieClip.textboxVariable2");
        } else if (Selection.getFocus() == "_level0.movieClip.textboxVariable2"&&Key.isDown(Key.TAB)) {
                Selection.setFocus( "_level0.movieClip.textboxVariable3");
        } else if (Selection.getFocus() == "_level0.movieClip.textboxVariable3"&&Key.isDown(Key.TAB)) {
                Selection.setFocus( "_level0.movieClip.textboxVariable1");
        }
}

//Or if you'd rather place the actions on a button, try this:


on (keyPress "") {
        if (Selection.getFocus() == "_level0.movieClip.textboxVariable1") {
                Selection.setFocus( "_level0.movieClip.textboxVariable2");
        } else if (Selection.getFocus() == "_level0.movieClip.textboxVariable2") {
                Selection.setFocus( "_level0.movieClip.textboxVariable3");
        } else if (Selection.getFocus() == "_level0.movieClip.textboxVariable3") {
                Selection.setFocus( "_level0.movieClip.textboxVariable1");
        }
}

 
 
 

   
  

2009/08/19 09:35 2009/08/19 09:35
Posted
Filed under etc
) autorun.inf 파일을 작성한다

①윈도우즈의 보조프로그램 중 "메모장"을 연다.

②아래 내용을 타이핑한다.

        [autorun]

        icon =아이콘파일명.ico -- CD-ROM의 아이콘 이미지 [생략 가능]

        open = 실행하고픈 실행 파일명.exe -- 자동 실행할 파일명




③다른이름으로 저장에서  파일명 autorun.inf 으로 저장한다.




※ 주의 : autorun.inf 파일은 항상 CD의 루트에 있어야 한다.
2009/08/14 11:17 2009/08/14 11:17
Posted
Filed under PHP

$file_name_only = substr($userfile_name,0,strrpos($userfile_name,"."));//파일이름
$file_name_ext = substr($userfile_name,strrpos($userfile_name,"."));//확장자이름

2009/08/13 16:24 2009/08/13 16:24
Posted
Filed under PHP
[원본 주소] - http://cafe.naver.com/suninet.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=548
Excel 다운로드 처리 샘플.

<?
header("Content-Type: application/vnd.ms-excel");
header("Content-Type: application/vnd.ms-excel; charset=euc-kr");
header("Content-Type: application/x-msdownload");
header("Content-Disposition: attachment; filename=$fileName.xls");
header("Content-Description: PHP4 Generated Data");
header("Pragma: no-cache");
header("Expires: 0");
header("Content-Type: file/unknown");
?>


<html>
<head><title>엑셀변환</title>
<script language="javascript">
self.close();
</script>
<style type="text/css">
body {  font-family: "굴림"; font-size: 9pt; color: #595959; line-height:130%}
td {  font-family: "굴림"; font-size: 9pt; color: #595959; line-height:130%}

A:visited { color: #595959; text-decoration: none;}

A:hover { color:#595959; text-decoration: none; }

A:active { color: #595959; text-decoration: none; }

A:link { color: #595959; text-decoration: none; }
</style>
</head>
<body>

<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#DEDBDE">
<tr>
<?
for($i=0;$i<count($fieldName);$i++)
{
 echo "<td align='center' bgcolor='#F7F3F7' height='25'><b>".$fieldName[$i]."</b></td>";
}
?>
</tr>

<?
$sql = str_replace("\\", "", "$sql");
$re = $DB->setResult($sql);

$j = 0;

for($i=0;$i<$re[cnt];$i++)
{
 $row = mysql_fetch_array($re[result]);
 if($j == 0) echo "<TR>";
 for($k=0;$k<count($fieldValue);$k++) { echo "<td align='center' bgcolor='#FFFFFF'>&nbsp;".$row[$fieldValue[$k]]."</td>"; }

 if($j == count($fieldName)) { echo "</tr>"; $j = 0; }
}
?>
</tr>

</table>
</body>
</html>

2009/08/06 13:12 2009/08/06 13:12
Posted
Filed under PHP
  • file_uploads : 파일업로드를 허용할 것인가에 대한 설정.
  • upload_tmp_dir : 파일업로드시에 임시로 저장될 디렉토리지정
  • upload_max_filesize : 업로드시의 허용되는 최대파일사이즈 (default : 1MB)

  • [참고] php에서 post방식으로 업로드를 진행 할 경우 post_max_size 의 크기를 확인 해
    봐야 한다.  upload_max_filesize 크기를 100로 하더라도 post방식으로 업로드를 하게 되면
    post_file_size 도 100로 설정을 해야 한다.
    일반적으로 post_file_size 는 8M로 설정 되어 있다.

    2009/08/05 10:00 2009/08/05 10:00
    Posted
    Filed under Mysql

    MySQL  4.0 이하이 password 함수는 4.1 이상부터는 old_password() 로 변경되었으며
    MySQL 4.1 이상에서 password 함수를 기존의 4.0 이하와 같은 방식으로 사용코자 한다면,
    my.ini 에서 [mysqld] 섹션 아래에 old_password = 1 을 추가 후, MySQL 을 재시작 해야 한다.

    mysql 4.1 대 이후에서는 암호 해쉬 알고리즘이 변경이 되었습니다.
    이전의 알고리즘에 의한 암호화는 old_password() 함수로 제공이 됩니다.

    이 때문에, 이전 버전에 맞게 설계된 프로그램들은 인증 실패가 발생합니다. 해결책으로는 프로그램(Client)의 라이브러리를 변경하거나, 사용자 비밀번호(mysql.user)를 old_password() 로 변경해주는 방법이 있고, 아니면 mysqld 를 --old-passwords 옵션으로 구동하는 방법이 있습니다.

    [원문]
    http://dev.mysql.com/doc/refman/5.1/en/old-client.html

    2009/07/28 15:24 2009/07/28 15:24