'Study/Actionscript 3.0'에 해당되는 글 73건
- 2011.05.10 re: 동영상 링크 질문입니다 9
- 2011.04.13 window.open() (scrap) 6
- 2011.04.11 flash builder에서 작업올리기 4
- 2011.02.05 Line3D.addControlVertex [scrap] 1
- 2011.02.04 메모리관리
- 2011.02.02 Netstream error [ scrap ]
- 2011.02.02 Error #2148 (scrap)
- 2011.01.31 video controll as3.0 2
- 2011.01.15 Embed Vimeo Videos in Flash 1
- 2010.10.18 Adobe Flex 3 backup and export for web 3
http://multimedia.kaywon.ac.kr:2009/2005_1/%C0%CE%C5%CD%B3%DD2/04%B0%AD/window_open.htm
팝업창을 만들어 주는 window.open() 메소드를 보겠습니다. window.open() 메소드의 사용법은 다음과 같습니다.
window.open("팝업창으로 보여줄 문서","팝업창의 이름","옵션")
|
이 예문은 http://www.dreamwiz.com 페이지를 가로 500픽셀, 높이 300 픽셀의 크기로 왼족위 모서리에 붙게 팝업창으로 열어줍니다. 두 번째 인자인 "dreamwiz" 는 뭐냐구요? 이 부분은 팝업창의 이름을 말하는 것으로 프레임 문서에서 타겟(target) 처럼 사용할 수 있습니다.. 즉, <a href="xxx.html" target="dreamwiz">열기</a> 처럼 사용하게 되면, 현재 드림위즈 홈페이지가 열려있는 팝업창에 xxx.html 문서가 열리게 되는 것이랍니다. 이 두 번째 인자에 아무것도 입력하지 않으려면 그냥 "" 만 표시 해 줍니다. (예) : window.open("http://www.dreamwiz.com", "", "옵션들")
세 번째 인자에는 옵션들을 설정 합니다. 이곳에서 사용할 수 있는 옵션에는 아래와 같은 것들이 있습니다
menubar | yes/no, 1/0 | 메뉴바를 보여주거나 숨깁니다 |
toolbar | yes/no, 1/0 | 도구막대를 보여주거나 숨깁니다 |
directories | yes/no, 1/0 | 디렉토리바를 보여주거나 숨깁니다 |
scrollbars | yes/no, 1/0 | 스크롤바를 보여주거나 숨깁니다 |
status | yes/no, 1/0 | 상태표시줄을 보여주거나 숨깁니다 |
location | yes/no, 1/0 | 주소표시줄을 보여주거나 숨깁니다 |
width | 픽셀 | 팝업 윈도우의 가로크기를 지정합니다 |
height | 픽셀 | 팝업 윈도우의 높이를 지정합니다 |
left | 픽셀 | 팝업 윈도우의 x축 위치를 지정합니다 |
top | 픽셀 | 팝업 윈도우의 y축 위치를 지정합니다 |
resizable | yes/no 1/0 | 팝업윈도우의 크기를 사용자가 임의로 수정할 수 있는지 여부를 지정합니다 |
fullscreen |
| 전체화면 모드로 열어줍니다 |
channelmode |
| 채널모드 창으로 열어줍니다 |
옵션인자를 지정하지 않으면 현재 창의 모양과 같은 형태로 팝업윈도우가 열리게 되고, 어느 한가지 옵션만 지정하면 나머지는 모두 디폴트 값으로 no 가 설정 됩니다.
버튼을 클릭하면 아무런 옵션이 없는 팝업 윈도우가 열리게 하는 코드는 아래와 같습니다
|
위에서 보듯이 옵션을 사용하지 않으면 <a href="xxx.html" target="_blank">열기</a> 처럼 태그를 사용한 것과 같은 효과를 줍니다. 이 옵션 인자는 지정하지 않아도 되지만, 두 번재 인자인 name 은 사용하지 않더라도 반드시 "" 으로 표시해 주어야 한다는 것은 명심하기 바랍니다.
그럼, 이번에는 몇가지 옵션만 선별적으로 주는 예를 보겠습니다
|
위의 예에서 보듯이 특정 옵션을 지정하면 나머지 옵션값은 자동으로 no를 준 것과 같은 효과를 나타냅니다. 옵션을 줄때 주의할점은 절대 공백을 주어서는 안됩니다. 공백을 주게되면 네츠케이프 등에서는 에러를 발생시킬 수 있습니다
이번에는 잘 이용하면 아주 요긴하게 사용될 수 있는 fullscreen 모드와 channelmode 옵션으로 팝업윈도우를 열어보도록 하겠습니다
|
package org.papervision3d.core.geom { /** * <p> * The Lines object is a DisplayObject3D that is designed to contain and handle the rendering of * Line3D objects. A Line3D is defined by two 3D vertices; one for each end. A line's start and end * vertices are converted into 2D space and rendered using the Flash drawing API lineTo method. * * Line3D can also render curves; add a control vertex using the Line3D.addControlVertex(...) method. * The line's control vertex is then converted into 2D space and rendered using the Flash drawing API * curveTo method. * * The line's appearance is defined by its LineMaterial. * * </p> * * <p> * Example: * </p> * <pre><code> * * //This example creates a Lines3D DisplayObject3D and adds 100 lines into it. * * var numLines : int = 100; * * var lines3D : Lines3D = new Lines3D(); * var lineMaterial : LineMaterial = new LineMaterial(0xff0000, 0.8); * var lineWeight : Number = 5; * * for(var i : int = 0; i<numLines; i++) * { * var startVertex : Vertex3D = new Vertex3D(Math.random()*200, Math.random()*200, Math.random()*200); * var endVertex : Vertex3D = new Vertex3D(Math.random()*200, Math.random()*200, Math.random()*200); * * var line : Line3D = new Line3D(lines3D, lineMaterial, lineWeight, startVertex, endVertex); * * lines3D.addLine(line); * * } * scene.addChild(lines3D); * * </code></pre> * </p> * * <p> * See also : LineMaterial * </p> * * @Author Ralph Hauwert * @Author Seb Lee-Delisle * @Author Alan Owen * */ import org.papervision3d.core.geom.renderables.Line3D; import org.papervision3d.core.geom.renderables.Vertex3D; import org.papervision3d.core.log.PaperLogger; import org.papervision3d.core.render.command.RenderLine; import org.papervision3d.core.render.data.RenderSessionData; import org.papervision3d.core.render.draw.ILineDrawer; import org.papervision3d.materials.special.LineMaterial; import org.papervision3d.objects.DisplayObject3D; public class Lines3D extends Vertices3D { public var lines:Array; private var _material:ILineDrawer; /** * @param material The default material for this Lines3D. If ommitted then the default * LineMaterial3D is used. * @param name An identifier for this Lines object. */ public function Lines3D(material:LineMaterial = null, name:String=null) { super(null, name); if(!material) this.material = new LineMaterial(); else this.material = material; init(); } private function init():void { this.lines = new Array(); } /** * Converts 3D vertices into 2D space, to prepare for rendering onto the stage. * * @param parent The parent DisplayObject3D * @param renderSessionData The renderSessionData object for this render cycle. * */ public override function project( parent :DisplayObject3D, renderSessionData:RenderSessionData ):Number { // Vertices super.project( parent, renderSessionData ); var line3D:Line3D; var screenZ:Number; var rc:RenderLine; for each(line3D in lines) { if(renderSessionData.viewPort.lineCuller.testLine(line3D)) { rc = line3D.renderCommand; rc.renderer = line3D.material; rc.size = line3D.size; screenZ += rc.screenZ = (line3D.v0.vertex3DInstance.z + line3D.v1.vertex3DInstance.z)/2; rc.v0 = line3D.v0.vertex3DInstance; rc.v1 = line3D.v1.vertex3DInstance; renderSessionData.renderer.addToRenderList(rc); } } return screenZ/(lines.length+1); } /** * Adds a Line3D object to this Lines3D container. * @param line The Line3D object to add. * */ public function addLine(line:Line3D):void { lines.push(line); line.instance = this; if(geometry.vertices.indexOf(line.v0) == -1) { geometry.vertices.push(line.v0); } if(geometry.vertices.indexOf(line.v1) == -1) { geometry.vertices.push(line.v1); } if(line.cV){ if(geometry.vertices.indexOf(line.cV) == -1) { geometry.vertices.push(line.cV); } } } /** * Creates a new line from the parameters passed and adds it. * @param size The weight of the line. * @param x0 The line's start x position. * @param y0 The line's start y position. * @param z0 The line's start z position. * @param x1 The line's end x position. * @param y1 The line's end y position. * @param z1 The line's end z position. * @return The line just created. * */ public function addNewLine(size:Number, x0:Number, y0:Number, z0:Number, x1:Number, y1:Number, z1:Number) : Line3D { var line:Line3D = new Line3D(this, material as LineMaterial, size, new Vertex3D(x0,y0,z0), new Vertex3D(x1,y1,z1)); addLine(line); return line; } /** * This is identical to addNewLine, except it breaks up the line into several shorter line segments * that together make up the full line. This would be useful for improved z-depth sorting. * * @param size The weight of the line. * @param segments The number of segments to break up the line into * @param x0 The line's start x position. * @param y0 The line's start y position. * @param z0 The line's start z position. * @param x1 The line's end x position. * @param y1 The line's end y position. * @param z1 The line's end z position. * @return An array of the lines just created. * */ public function addNewSegmentedLine(size:Number, segments:Number, x0:Number, y0:Number, z0:Number, x1:Number, y1:Number, z1:Number) : Array { //Do line interpolation, and add a bunch of segments for it. var xStep:Number = (x1-x0)/segments; var yStep:Number = (y1-y0)/segments; var zStep:Number = (z1-z0)/segments; var newLines : Array = new Array; var line:Line3D; var pv:Vertex3D = new Vertex3D(x0,y0,z0); var nv:Vertex3D; for(var n:Number = 0; n<=segments; n++){ nv = new Vertex3D(x0 + xStep*n, y0+yStep*n, z0+zStep*n); line = new Line3D(this, material as LineMaterial, size, pv, nv); addLine(line); newLines.push(line); pv = nv; } return newLines; } /** * Removes a line. * @param line The line to remove. * */ public function removeLine(line:Line3D) : void { var lineindex : int = lines.indexOf(line); if(lineindex>-1) { lines.splice(lineindex,1); } else { PaperLogger.warning("Papervision3D Lines3D.removeLine : WARNING removal of non-existant line attempted. "); } } /** * Removes all the lines. * */ public function removeAllLines():void { while ( lines.length > 0 ) { removeLine( lines[0] ) ; } } } }
폴더를 옮겨서 실행시키시는거죠?
보안상 이유로 Flex Builder 의 Flex Project 디렉토리 외부에서 로컬파일 접근은 안됩니다.
c:\Documents and Settings\Administrator\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust\
가 flash player 가 접근할 수 있는 디렉토리 들이 기록되있는 곳일 거구요.
Flex Builder 는 Flex Project 의 workspace 디렉토리를 저 파일에 자동으로 기록해 놓습니다.
플렉스에서 다음과 같이 xml 파일을 읽어 들이지 못하는 이유는 보안 박스 와 관련된
오류 입니다.
이러한 오류를 수정하기 위해서는 다음과 같이 하면 됩니다.
SecurityError: Error #2148: SWF file file:///C:/Documents and Settings/UserProfile/Desktop/flexstore/bin-release/flexstore.swf cannot access local resource myFile.swf. Only local-with-filesystem and trusted local SWF files may access local resources.
플렉스 메뉴에서
Project > Properties > Flex Complier 를 선택합니다.
Additional complier Arguments 에서
local 이라는 메뉴를 지우고
-use-network=false
라고 넣어줍니다.