Adobe® Flash® Platform용 ActionScript® 3.0 참조 설명서
 |  패키지 및 클래스 목록 숨기기 |  패키지  |  클래스  |  새로운 내용  |  색인  |  부록  |  영어로 표시되는 이유
필터: AIR 30.0 이하, Flash Player 30.0 이하, Flash Lite 4
Flex 4.6 이하, Flash Pro CS6 이하
필터 숨기기
flash.display 

Graphics  - AS3

패키지x

최상위 레벨
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

언어 요소

전역 상수
전역 함수
연산자
명령문, 키워드 및 지시문
특수 유형 연산자

부록

새로운 내용
컴파일러 오류
컴파일러 경고
런타임 오류
ActionScript 3으로 마이그레이션
지원되는 문자 세트
MXML 전용 태그
모션 XML 요소
Timed Text 태그
사용되지 않는 요소의 목록
액세스 가능성 구현 상수
ActionScript 예제 사용 방법
법적 고지 사항
패키지flash.display
클래스public final class Graphics
상속Graphics Inheritance Object

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

Graphics 클래스에는 벡터 모양을 만들 때 사용할 수 있는 각종 메서드가 포함되어 있습니다. 드로잉을 지원하는 표시 객체 중에는 Sprite 객체 및 Shape 객체가 있습니다. 이 클래스 각각에는 Graphics 객체인 graphics 속성이 있습니다. 편리한 사용을 위해 drawRect(), drawRoundRect(), drawCircle()drawEllipse()와 같은 도우미 함수가 제공됩니다.

ActionScript 코드에서 직접 Graphics 객체를 만들 수 없습니다. new Graphics()를 호출하면 예외가 발생합니다.

Graphics 클래스는 최종 클래스이므로 하위 클래스를 만들 수 없습니다.

예제 보기



공용 속성
 속성정의 주체
 Inheritedconstructor : Object
지정된 객체 인스턴스의 클래스 객체 또는 생성자 함수에 대한 참조입니다.
Object
공용 메서드
 메서드정의 주체
  
beginBitmapFill(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void
비트맵 이미지로 드로잉 영역을 채웁니다.
Graphics
  
beginFill(color:uint, alpha:Number = 1.0):void
드로잉에 다른 Graphics 메서드(예: lineTo() 또는 drawCircle())에 대한 후속 호출을 사용하는 단순한 단색 채우기를 지정합니다.
Graphics
  
beginGradientFill(type:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix = null, spreadMethod:String = "pad", interpolationMethod:String = "rgb", focalPointRatio:Number = 0):void
해당 객체에 대해 이후에 lineTo() 또는 drawCircle() 등의 다른 Graphics 메서드를 호출할 때 사용되는 그래디언트 채우기를 지정합니다.
Graphics
  
beginShaderFill(shader:Shader, matrix:Matrix = null):void
해당 객체에 대해 이후에 lineTo() 또는 drawCircle() 등의 다른 Graphics 메서드를 호출할 때 사용되는 셰이더 채우기를 지정합니다.
Graphics
  
이 Graphics 객체에 그린 그래픽을 지우고 채우기 및 선 스타일을 다시 설정합니다.
Graphics
  
copyFrom(sourceGraphics:Graphics):void
소스 Graphics 객체의 모든 드로잉 명령을 호출하는 Graphics 객체에 복사합니다.
Graphics
  
cubicCurveTo(controlX1:Number, controlY1:Number, controlX2:Number, controlY2:Number, anchorX:Number, anchorY:Number):void
현재 드로잉 위치에서 지정된 앵커 포인트까지 3차 베지어 곡선을 그립니다.
Graphics
  
curveTo(controlX:Number, controlY:Number, anchorX:Number, anchorY:Number):void
현재의 선 스타일을 사용하여 현재의 드로잉 위치에서 (anchorX, anchorY) 위치까지 2차 베지어 곡선을 그립니다. 제어점으로는 (controlX, controlY) 위치를 사용합니다.
Graphics
  
원을 그립니다.
Graphics
  
drawEllipse(x:Number, y:Number, width:Number, height:Number):void
타원을 그립니다.
Graphics
  
드로잉할 일련의 IGraphicsData 인스턴스를 전송합니다.
Graphics
  
drawPath(commands:Vector.<int>, data:Vector.<Number>, winding:String = "evenOdd"):void
드로잉을 위한 일련의 명령을 전송합니다.
Graphics
  
drawRect(x:Number, y:Number, width:Number, height:Number):void
사각형을 그립니다.
Graphics
  
drawRoundRect(x:Number, y:Number, width:Number, height:Number, ellipseWidth:Number, ellipseHeight:Number = NaN):void
모서리가 둥근 직사각형을 그립니다.
Graphics
  
drawTriangles(vertices:Vector.<Number>, indices:Vector.<int> = null, uvtData:Vector.<Number> = null, culling:String = "none"):void
일반적으로 비트맵을 왜곡하여 3차원 느낌을 주는 삼각형 집합을 렌더링합니다.
Graphics
  
beginFill(), beginGradientFill() 또는 beginBitmapFill() 메서드에 대한 마지막 호출 이후로 추가된 선과 곡선에 채우기를 적용합니다.
Graphics
 Inherited
지정된 속성이 객체에 정의되어 있는지 여부를 나타냅니다.
Object
 Inherited
Object 클래스의 인스턴스가 매개 변수로 지정된 객체의 프로토타입 체인에 있는지 여부를 나타냅니다.
Object
  
lineBitmapStyle(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void
선을 그릴 때 선의 획에 사용할 비트맵을 지정합니다.
Graphics
  
lineGradientStyle(type:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix = null, spreadMethod:String = "pad", interpolationMethod:String = "rgb", focalPointRatio:Number = 0):void
선을 그릴 때 획에 사용할 그래디언트를 지정합니다.
Graphics
  
lineShaderStyle(shader:Shader, matrix:Matrix = null):void
선을 그릴 때 선의 획에 사용할 셰이더를 지정합니다.
Graphics
  
lineStyle(thickness:Number = NaN, color:uint = 0, alpha:Number = 1.0, pixelHinting:Boolean = false, scaleMode:String = "normal", caps:String = null, joints:String = null, miterLimit:Number = 3):void
이후에 lineTo() 메서드 또는 drawCircle() 메서드 등의 Graphics 메서드를 호출할 때 사용되는 선 스타일을 지정합니다.
Graphics
  
현재 선 스타일을 사용하여 현재 드로잉 위치에서 (x, y)로 선을 그립니다. 그러면 현재 드로잉 위치가 (x, y)로 설정됩니다.
Graphics
  
현재 드로잉 위치를 (x, y)로 이동합니다.
Graphics
 Inherited
지정된 속성이 존재하고 열거 가능한지 여부를 나타냅니다.
Object
  
Sprite 또는 Shape 객체(및 필요할 경우 그 자식)에 벡터 그래픽 내용에 대한 쿼리를 보냅니다.
Graphics
 Inherited
루프 작업에서 동적 속성을 사용할 수 있는지 여부를 설정합니다.
Object
 Inherited
로캘별 규칙에 따라 서식이 지정된 이 객체의 문자열 표현을 반환합니다.
Object
 Inherited
지정된 객체의 문자열 표현을 반환합니다.
Object
 Inherited
지정된 객체의 프리미티브 값을 반환합니다.
Object
메서드 세부 정보

beginBitmapFill

()메서드
public function beginBitmapFill(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

비트맵 이미지로 드로잉 영역을 채웁니다. 비트맵을 반복하거나 바둑판식으로 배열하여 영역을 채울 수 있습니다. 채우기의 효과는 beginFill(), beginBitmapFill(), beginGradientFill() 또는 beginShaderFill() 메서드를 호출할 때까지 유지됩니다. clear() 메서드를 호출하면 채우기가 지워집니다.

이 응용 프로그램은 세 개 이상의 점이 그려질 때마다 또는 endFill() 메서드가 호출될 때 채우기를 렌더링합니다.

매개 변수

bitmap:BitmapData — 표시할 비트를 포함하는 투명 또는 불투명 비트맵 이미지입니다.
 
matrix:Matrix (default = null) — 비트맵의 변형을 정의하는 데 사용할 수 있는 행렬 객체(flash.geom.Matrix 클래스)입니다. 예를 들어 다음 행렬을 사용하여 비트맵을 45도(pi/4 라디안) 회전할 수 있습니다.
     matrix = new flash.geom.Matrix(); 
     matrix.rotate(Math.PI / 4);
     
 
repeat:Boolean (default = true)true이면 비트맵 이미지가 반복되어 바둑판식 패턴을 이루고, 값이 false이면 비트맵 이미지가 반복되지 않고 해당 비트맵을 넘는 채우기 영역에 비트맵의 가장자리가 사용됩니다.

예를 들어 다음과 같은 20 x 20픽셀의 바둑판 모양 비트맵을 생각해 볼 수 있습니다.

20x20픽셀 바둑판

다음 예제와 같이 repeattrue로 설정된 경우에는 비트맵 채우기가 비트맵을 반복합니다.

60x60픽셀 바둑판

repeatfalse로 설정된 경우에는 비트맵 채우기가 비트맵 바깥쪽의 채우기 영역에 대해 가장자리 픽셀을 사용합니다.

60x60픽셀 이미지(반복 없음)

 
smooth:Boolean (default = false)false이면 확대된 비트맵 이미지가 최단입점 알고리즘을 사용하여 렌더링되며 픽셀화되어 나타납니다. true이면 확대된 비트맵 이미지가 쌍선형 알고리즘을 사용하여 렌더링됩니다. 최단입점 알고리즘을 사용한 렌더링이 더 빠릅니다.

관련 API 요소


예제  ( 예제 사용 방법 )

다음 예제에서는 사각형을 회전시키면서 채우기를 반복하는 이미지(image1.jpg)를 사용합니다.
  1. 이미지 파일(image1.jpg)은 LoaderURLRequest 객체를 사용하여 로드됩니다. 여기에서는 이미지 파일이 SWF 파일과 동일한 디렉토리에 있습니다. SWF 파일은 [로컬 재생 보안]이 [로컬 파일에만 액세스]로 설정된 상태에서 컴파일해야 합니다.
  2. 이미지가 로드되면(Event가 완료됨) drawImage() 메서드가 호출됩니다. ioErrorHandler() 메서드는 이미지가 제대로 로드되지 않은 경우 추적 주석을 기록합니다.
  3. drawImage() 메서드에서 BitmapData 객체가 인스턴스화되고 폭과 높이가 이미지(image1.jpg)로 설정됩니다. 그런 다음 BitmapData 객체에 소스 이미지가 그려집니다. 이어서 mySprite Sprite 객체에서 사각형이 그려지고 BitmapData 객체를 사용해서 사각형을 채웁니다. Matrix 객체를 사용해서 beginBitmapFill() 메서드가 이미지를 45도 회전시킨 다음 완료될 때까지 사각형을 이미지로 채웁니다.
package {
    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.geom.Matrix;

    public class Graphics_beginBitmapFillExample extends Sprite {
 
        private var url:String = "image1.jpg";
        private var loader:Loader = new Loader();

        public function Graphics_beginBitmapFillExample() {

            var request:URLRequest = new URLRequest(url);
            
            loader.load(request);
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, drawImage);
            loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
        }

        private function drawImage(event:Event):void {

            var mySprite:Sprite = new Sprite();
            var myBitmap:BitmapData = new BitmapData(loader.width, loader.height, false);
  
            myBitmap.draw(loader, new Matrix());
            
            var matrix:Matrix = new Matrix();
            matrix.rotate(Math.PI/4);
            
            mySprite.graphics.beginBitmapFill(myBitmap, matrix, true);
            mySprite.graphics.drawRect(100, 50, 200, 90);
            mySprite.graphics.endFill();
            
            addChild(mySprite);
        }
 
         private function ioErrorHandler(event:IOErrorEvent):void {
            trace("Unable to load image: " + url);
        }
    }   
}

beginFill

()메서드 
public function beginFill(color:uint, alpha:Number = 1.0):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

드로잉에 다른 Graphics 메서드(예: lineTo() 또는 drawCircle())에 대한 후속 호출을 사용하는 단순한 단색 채우기를 지정합니다. 채우기의 효과는 beginFill(), beginBitmapFill(), beginGradientFill() 또는 beginShaderFill() 메서드를 호출할 때까지 유지됩니다. clear() 메서드를 호출하면 채우기가 지워집니다.

이 응용 프로그램은 세 개 이상의 점이 그려질 때마다 또는 endFill() 메서드가 호출될 때 채우기를 렌더링합니다.

매개 변수

color:uint — 채우기 색상(0xRRGGBB)입니다.
 
alpha:Number (default = 1.0) — 채우기의 알파 값(0.0 ~ 1.0)입니다.

관련 API 요소


예제
예제 사용 방법
이 메서드를 사용하는 방법은 이 클래스 뒷부분의 예제를 참조하십시오.

beginGradientFill

()메서드 
public function beginGradientFill(type:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix = null, spreadMethod:String = "pad", interpolationMethod:String = "rgb", focalPointRatio:Number = 0):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

해당 객체에 대해 이후에 lineTo() 또는 drawCircle() 등의 다른 Graphics 메서드를 호출할 때 사용되는 그래디언트 채우기를 지정합니다. 채우기의 효과는 beginFill(), beginBitmapFill(), beginGradientFill() 또는 beginShaderFill() 메서드를 호출할 때까지 유지됩니다. clear() 메서드를 호출하면 채우기가 지워집니다.

이 응용 프로그램은 세 개 이상의 점이 그려질 때마다 또는 endFill() 메서드가 호출될 때 채우기를 렌더링합니다.

매개 변수

type:String — 사용할 그래디언트 유형, 즉 GradientType.LINEAR 또는 GradientType.RADIAL을 지정하는 GradientType 클래스 값입니다.
 
colors:Array — 그래디언트에 사용되는 RGB 16진수 색상 값(예: 빨강은 0xFF0000, 파랑은 0x0000FF 등)의 배열입니다. 최대 15가지 색상을 지정할 수 있습니다. 색상별로 알파 및 비율 매개 변수에 해당 값을 지정해야 합니다.
 
alphas:Array — 색상 배열에 속한 색상의 알파 값 배열이며 유효한 값은 0부터 1까지입니다. 값이 0보다 작으면 기본값은 0입니다. 값이 1보다 큰 경우 기본값은 1입니다.
 
ratios:Array — 색상 배분 비율의 배열이며 유효한 값은 0-255입니다. 이 값은 색상이 100%로 샘플링되는 위치의 폭에 대한 백분율을 정의합니다. 값 0은 그래디언트 상자의 왼쪽 위치를, 255는 그래디언트 상자의 오른쪽 위치를 나타냅니다.

참고: 이 값은 최종 그래디언트의 좌표 공간이 아니라 그래디언트 상자에서의 위치를 나타내며, 그래디언트 상자보다 넓거나 좁을 수 있습니다. colors 매개 변수의 각 값을 지정합니다.

예를 들어 파랑 및 녹색의 두 가지 색상이 포함된 선형 그래디언트의 경우, 다음 예제에서는 ratios 배열의 다른 값을 기준으로 그래디언트에 색상을 배치하는 것을 보여 줍니다.

ratios그래디언트
[0, 127]0:127 비율로 파랑에서 녹색으로 바뀌는 선형 그래디언트
[0, 255]0:255 비율로 파랑에서 녹색으로 바뀌는 선형 그래디언트
[127, 255]127:255 비율로 파랑에서 녹색으로 바뀌는 선형 그래디언트

배열의 값은 [0, 63, 127, 190, 255]와 같이 순차적으로 증가해야 합니다.

 
matrix:Matrix (default = null) — flash.geom.Matrix 클래스에 의해 정의된 변형 행렬입니다. flash.geom.Matrix 클래스에 포함된 createGradientBox() 메서드를 사용하면 beginGradientFill() 메서드와 함께 사용할 행렬을 편리하게 설정할 수 있습니다.
 
spreadMethod:String (default = "pad") — 사용할 스프레드 메서드, 즉 SpreadMethod.PAD, SpreadMethod.REFLECT 또는 SpreadMethod.REPEAT를 지정하는 SpreadMethod 클래스 값입니다.

예를 들어 다음과 같이 두 색상 간의 간단한 선형 그래디언트를 생각해 볼 수 있습니다.

     import flash.geom.*
     import flash.display.*
     var fillType:String = GradientType.LINEAR;
     var colors:Array = [0xFF0000, 0x0000FF];
     var alphas:Array = [1, 1];
     var ratios:Array = [0x00, 0xFF];
     var matr:Matrix = new Matrix();
     matr.createGradientBox(20, 20, 0, 0, 0);
     var spreadMethod:String = SpreadMethod.PAD;
     this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);        
     this.graphics.drawRect(0,0,100,100);
     

이 예제에서는 스프레드 방식으로 SpreadMethod.PAD를 사용하며, 그래디언트 채우기는 다음과 같이 표시됩니다.

SpreadMethod.PAD를 사용하는 선형 그래디언트

스프레드 방식으로 SpreadMethod.REFLECT를 사용할 경우, 그래디언트 채우기는 다음과 같이 표시됩니다.

SpreadMethod.REFLECT를 사용하는 선형 그래디언트

스프레드 방식으로 SpreadMethod.REPEAT를 사용할 경우, 그래디언트 채우기는 다음과 같이 표시됩니다.

SpreadMethod.REPEAT를 사용하는 선형 그래디언트

 
interpolationMethod:String (default = "rgb") — 사용할 값, 즉 InterpolationMethod.LINEAR_RGB 또는 InterpolationMethod.RGB를 지정하는 InterpolationMethod 클래스 값입니다.

예를 들어 두 색상 간의 간단한 선형 그래디언트를 생각해 볼 수 있습니다(spreadMethod 매개 변수를 SpreadMethod.REFLECT로 설정). 여러 가지 보간 방법은 다음과 같이 외양에 영향을 미칩니다.

InterpolationMethod.LINEAR_RGB를 사용하는 선형 그래디언트 InterpolationMethod.RGB를 사용하는 선형 그래디언트
InterpolationMethod.LINEAR_RGBInterpolationMethod.RGB
 
focalPointRatio:Number (default = 0) — 그래디언트의 초점 위치를 제어하는 숫자입니다. 0은 초점 위치가 가운데에 있음을 의미합니다. 1은 초점 위치가 그래디언트 원의 한 테두리에 있음을 의미합니다. -1은 초점 위치가 그래디언트 원의 다른 테두리에 있음을 의미합니다. -1보다 작거나 1보다 큰 값은 -1 또는 1로 반올림됩니다. 다음 이미지는 0.75로 설정된 focalPointRatio의 예를 보여 줍니다.

focalPointRatio가 0.75로 설정된 방사형 그래디언트


오류
ArgumentError type 매개 변수가 유효하지 않은 경우입니다.

관련 API 요소

beginShaderFill

()메서드 
public function beginShaderFill(shader:Shader, matrix:Matrix = null):void

언어 버전: ActionScript 3.0
런타임 버전: Flash Player 10, AIR 1.5

해당 객체에 대해 이후에 lineTo() 또는 drawCircle() 등의 다른 Graphics 메서드를 호출할 때 사용되는 셰이더 채우기를 지정합니다. 채우기의 효과는 beginFill(), beginBitmapFill(), beginGradientFill() 또는 beginShaderFill() 메서드를 호출할 때까지 유지됩니다. clear() 메서드를 호출하면 채우기가 지워집니다.

이 응용 프로그램은 세 개 이상의 점이 그려질 때마다 또는 endFill() 메서드가 호출될 때 채우기를 렌더링합니다.

셰이더 채우기는 GPU 렌더링에서 지원되지 않습니다. 채워진 영역은 청록색이 됩니다.

매개 변수

shader:Shader — 채우기에 사용할 셰이더입니다. 이 Shader 인스턴스는 이미지 입력을 지정하는 데 필요하지 않습니다. 그러나 셰이더에 이미지 입력이 지정된 경우에는 입력을 직접 제공해야 합니다. 입력을 지정하려면 Shader.data 속성에 들어 있는 해당 ShaderInput 속성의 input 속성을 설정해야 합니다.

Shader 인스턴스를 인수로 전달하면 해당 셰이더가 내부적으로 복사됩니다. 드로잉 채우기 작업은 원본 셰이더에 대한 참조가 아닌 이 내부 사본을 사용합니다. 매개 변수 값, 입력 또는 바이트 코드 변경과 같이 셰이더의 모든 변경 사항은 채우기에 사용되는 셰이더 사본에는 적용되지 않습니다.

 
matrix:Matrix (default = null) — 셰이더의 변형을 정의하는 데 사용할 수 있는 행렬 객체(flash.geom.Matrix 클래스)입니다. 예를 들어 다음 행렬을 사용하여 셰이더를 45도(pi/4 라디안) 회전할 수 있습니다.
     matrix = new flash.geom.Matrix(); 
     matrix.rotate(Math.PI / 4);
     

셰이더에 수신된 좌표는 matrix 매개 변수에 대해 지정된 행렬을 기반으로 합니다. 기본(null) 행렬의 경우, 셰이더의 좌표는 로컬 픽셀 좌표로서, 입력 샘플을 만드는 데 사용할 수 있습니다.


오류
ArgumentError — 셰이더 출력 유형이 이 작업과 호환되지 않을 때(셰이더가 pixel3 또는 pixel4 출력을 지정해야 함)
 
ArgumentError — 셰이더가 제공되지 않은 이미지 입력을 지정한 경우
 
ArgumentError — ByteArray 또는 Vector.<Number> 인스턴스가 입력으로 사용되고 widthheight 속성이 ShaderInput에 대해 지정되지 않았거나 지정된 값이 입력 객체의 데이터 양과 일치하지 않는 경우. 자세한 내용은 ShaderInput.input 속성을 참조하십시오.

관련 API 요소

clear

()메서드 
public function clear():void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

이 Graphics 객체에 그린 그래픽을 지우고 채우기 및 선 스타일을 다시 설정합니다.

copyFrom

()메서드 
public function copyFrom(sourceGraphics:Graphics):void

언어 버전: ActionScript 3.0
런타임 버전: Flash Player 10, AIR 1.5, Flash Lite 4

소스 Graphics 객체의 모든 드로잉 명령을 호출하는 Graphics 객체에 복사합니다.

매개 변수

sourceGraphics:Graphics — 복사할 드로잉 명령이 있는 Graphics 객체입니다.

cubicCurveTo

()메서드 
public function cubicCurveTo(controlX1:Number, controlY1:Number, controlX2:Number, controlY2:Number, anchorX:Number, anchorY:Number):void

언어 버전: ActionScript 3.0
런타임 버전: Flash Player 11, AIR 3

현재 드로잉 위치에서 지정된 앵커 포인트까지 3차 베지어 곡선을 그립니다. 3차 베지어 곡선은 앵커 포인트 두 개와 제어점 두 개로 구성됩니다. 이 곡선은 앵커 포인트를 두 개 삽입하고 두 제어점 방향으로 구부러집니다.

3차 베지어

cubicCurveTo() 메서드를 사용하여 3차 베지어 곡선을 그리는 데 사용되는 네 개의 포인트는 다음과 같습니다.

  • 현재 드로잉 위치는 첫 번째 앵커 포인트입니다.
  • anchorXanchorY 매개 변수는 두 번째 앵커 포인트를 지정합니다.
  • controlX1controlY1 매개 변수는 첫 번째 제어점을 지정합니다.
  • controlX2controlY2 매개 변수는 두 번째 제어점을 지정합니다.

moveTo() 메서드를 호출하기 전에 cubicCurveTo() 메서드를 호출할 경우 곡선은 (0, 0) 위치에서 시작됩니다.

cubicCurveTo() 메서드가 성공한 경우 Flash 런타임은 현재 드로잉 위치를 (anchorX, anchorY)로 설정합니다. cubicCurveTo() 메서드가 실패한 경우 현재 드로잉 위치는 그대로 유지됩니다.

Flash 드로잉 도구를 사용하여 만든 내용이 동영상 클립에 포함된 경우 cubicCurveTo() 메서드를 호출한 결과가 해당 내용 아래에 그려집니다.

매개 변수

controlX1:Number — 부모 표시 객체의 등록 포인트를 기준으로 첫 번째 제어점의 가로 위치를 지정합니다.
 
controlY1:Number — 부모 표시 객체의 등록 포인트를 기준으로 첫 번째 제어점의 세로 위치를 지정합니다.
 
controlX2:Number — 부모 표시 객체의 등록 포인트를 기준으로 두 번째 제어점의 가로 위치를 지정합니다.
 
controlY2:Number — 부모 표시 객체의 등록 포인트를 기준으로 두 번째 제어점의 세로 위치를 지정합니다.
 
anchorX:Number — 부모 표시 객체의 등록 포인트를 기준으로 앵커 포인트의 가로 위치를 지정합니다.
 
anchorY:Number — 부모 표시 객체의 등록 포인트를 기준으로 앵커 포인트의 세로 위치를 지정합니다.


예제  ( 예제 사용 방법 )

다음 예제는 Sprite 표시 객체의 등록 포인트 (0, 0)에서 오른쪽으로 폭과 높이가 각각 100픽셀과 250픽셀인 파란색 원 객체를 그립니다.

4개의 곡선을 그려 원을 만들고 파란색으로 채웁니다.

3차 베지어 수식의 특성 때문에 완벽한 원은 아닙니다. 원을 그리는 가장 좋은 방법은 Graphics 클래스의 drawCircle() 메서드를 사용하는 것입니다.

package {
    import flash.display.Sprite;
    import flash.display.Shape;
    
    public class Graphics_cubicCurveToExample extends Sprite
    {
        public function Graphics_cubicCurveToExample():void
        {
            var rounderObject:Shape = new Shape();

            rounderObject.graphics.beginFill(0x0000FF);
            rounderObject.graphics.moveTo(250, 0);
            rounderObject.graphics.cubicCurveTo(275, 0, 300, 25, 300, 50);
            rounderObject.graphics.cubicCurveTo(300, 75, 275, 100, 250, 100);
            rounderObject.graphics.cubicCurveTo(225, 100, 200, 75, 200, 50);
            rounderObject.graphics.cubicCurveTo(200, 25, 225, 0, 250, 0);
            rounderObject.graphics.endFill();
            
            this.addChild(rounderObject);
        }
    }
}

curveTo

()메서드 
public function curveTo(controlX:Number, controlY:Number, anchorX:Number, anchorY:Number):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

현재의 선 스타일을 사용하여 현재의 드로잉 위치에서 (anchorX, anchorY) 위치까지 2차 베지어 곡선을 그립니다. 제어점으로는 (controlX, controlY) 위치를 사용합니다. 그러면 현재 드로잉 위치가 (anchorX, anchorY)로 설정됩니다. 그리고 있는 동영상 클립에 Flash 드로잉 도구로 만든 내용이 포함된 경우, 이 내용 아래에 curveTo() 메서드에 대한 호출이 그려집니다. moveTo() 메서드를 호출하기 전에 curveTo() 메서드를 호출할 경우, 현재 드로잉 위치의 기본값이 (0, 0)입니다. 매개 변수가 하나라도 없으면 이 메서드는 실패하고 현재 드로잉 위치는 변경되지 않습니다.

그려진 곡선은 2차 베지어 곡선입니다. 2차 베지어 곡선은 앵커 포인트 두 개와 제어점 한 개로 구성됩니다. 이 곡선은 앵커 포인트를 두 개 삽입하고 제어점 방향으로 구부러집니다.

2차 베지어

매개 변수

controlX:Number — 부모 표시 객체의 등록 포인트를 기준으로 제어점의 가로 위치를 지정하는 숫자입니다.
 
controlY:Number — 부모 표시 객체의 등록 포인트를 기준으로 제어점의 세로 위치를 지정하는 숫자입니다.
 
anchorX:Number — 부모 표시 객체의 등록 포인트를 기준으로 다음 앵커 포인트의 가로 위치를 지정하는 숫자입니다.
 
anchorY:Number — 부모 표시 객체의 등록 포인트를 기준으로 다음 앵커 포인트의 세로 위치를 지정하는 숫자입니다.


예제  ( 예제 사용 방법 )

다음 예제는 Sprite 표시 객체의 등록 포인트 (0, 0)에서 오른쪽으로 폭과 높이가 각각 100픽셀과 250픽셀인 녹색 원 객체를 그립니다.

4개의 곡선을 그려 원을 만들고 녹색으로 채웁니다.

2차 베지어 수식의 특성 때문에 완벽한 원은 아닙니다. 원을 그리는 가장 좋은 방법은 Graphics 클래스의 drawCircle() 메서드를 사용하는 것입니다.

package {
    import flash.display.Sprite;
    import flash.display.Shape;
    
    public class Graphics_curveToExample1 extends Sprite
    {
        public function Graphics_curveToExample1():void
        {
            var roundObject:Shape = new Shape();

            roundObject.graphics.beginFill(0x00FF00);
            roundObject.graphics.moveTo(250, 0);
            roundObject.graphics.curveTo(300, 0, 300, 50);
            roundObject.graphics.curveTo(300, 100, 250, 100);
            roundObject.graphics.curveTo(200, 100, 200, 50);
            roundObject.graphics.curveTo(200, 0, 250, 0);
            roundObject.graphics.endFill();
            
            this.addChild(roundObject);
        }
    }
}

다음 예제는 curveTo() 메서드를 사용해서 새로운 달을 그립니다.

두께가 1픽셀인 2개의 곡선이 그려지고 사이의 공간이 흰색으로 채워집니다. moveTo() 메서드는 현재 드로잉 위치를 좌표 (100, 100)으로 이동하는 데 사용됩니다. 첫 번째 곡선은 드로잉 위치를 목표 지점인 (100, 200)으로 이동합니다. 두 번째 곡선은 이 위치를 목표 지점인 시작 위치 (100, 100)으로 되돌립니다. 가로 제어점은 서로 다른 곡선 크기를 판별합니다.

package {
    import flash.display.Sprite;
    import flash.display.Shape;

    public class Graphics_curveToExample2 extends Sprite
    {
        public function Graphics_curveToExample2() {
            var newMoon:Shape = new Shape();
            
            newMoon.graphics.lineStyle(1, 0);
            newMoon.graphics.beginFill(0xFFFFFF);
            newMoon.graphics.moveTo(100, 100); 
            newMoon.graphics.curveTo(30, 150, 100, 200);    
            newMoon.graphics.curveTo(50, 150, 100, 100);
            graphics.endFill();
            
            this.addChild(newMoon);
        }
    }
}

drawCircle

()메서드 
public function drawCircle(x:Number, y:Number, radius:Number):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

원을 그립니다. drawCircle() 메서드를 호출하기 전에 linestyle(), lineGradientStyle(), beginFill(), beginGradientFill() 또는 beginBitmapFill() 메서드를 호출하여 선 스타일, 채우기 또는 두 가지 모두를 설정합니다.

매개 변수

x:Number — 부모 표시 객체의 등록 포인트를 기준으로 한 원 중심의 x 위치(픽셀 단위)입니다.
 
y:Number — 부모 표시 객체의 등록 포인트를 기준으로 한 원 중심의 y 위치(픽셀 단위)입니다.
 
radius:Number — 원의 반경(픽셀 단위)입니다.

관련 API 요소


예제
예제 사용 방법
이 메서드를 사용하는 방법은 이 클래스 뒷부분의 예제를 참조하십시오.

drawEllipse

()메서드 
public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

타원을 그립니다. drawEllipse() 메서드를 호출하기 전에 linestyle(), lineGradientStyle(), beginFill(), beginGradientFill() 또는 beginBitmapFill() 메서드를 호출하여 선 스타일, 채우기 또는 두 가지 모두를 설정합니다.

매개 변수

x:Number — 부모 표시 객체의 등록 포인트를 기준으로 한 타원의 왼쪽 위 경계 상자의 x 위치입니다(픽셀 단위).
 
y:Number — 부모 표시 객체의 등록 포인트를 기준으로 한 타원의 왼쪽 위 경계 상자의 y 위치입니다(픽셀 단위).
 
width:Number — 타원의 폭(픽셀 단위)입니다.
 
height:Number — 타원의 높이(픽셀 단위)입니다.

관련 API 요소


예제  ( 예제 사용 방법 )

다음 예제에서는 drawEgg() 함수를 사용하여 eggSize 매개 변수에 따라 서로 다른 크기의 계란(3가지 크기의 타원) 3개를 그립니다.
  1. 생성자는 drawEgg() 함수를 호출하여 계란을 그릴 가로/세로 매개 변수와 함께 계란의 유형(eggSize)을 전달합니다. 계란(타원)의 높이와 폭은 계란을 표시할 위치를 결정하는 데 사용될 수 있습니다.
  2. drawEgg() 함수는 다른 크기의 타원을 그리고 beginFill() 메서드를 사용해서 흰색으로 채웁니다. 이 함수에 대해 기록된 고급 오류 처리는 없습니다.
package {
    import flash.display.Sprite;
    import flash.display.Shape;

    public class Graphics_drawEllipseExample extends Sprite
    {
        public static const SMALL:uint = 0;
        public static const MEDIUM:uint = 1;
        public static const LARGE:uint = 2;

        public function Graphics_drawEllipseExample()
        {
            drawEgg(SMALL, 0, 100);
            drawEgg(MEDIUM, 100, 60);
            drawEgg(LARGE, 250, 35);    
        }

        public function drawEgg(eggSize:uint, x:Number, y:Number):void  {
            
            var myEgg:Shape = new Shape();
            
            myEgg.graphics.beginFill(0xFFFFFF);
            myEgg.graphics.lineStyle(1);

            switch(eggSize) {
                case SMALL:
                    myEgg.graphics.drawEllipse(x, y, 60, 70);
                    break;
                case MEDIUM:
                    myEgg.graphics.drawEllipse(x, y, 120, 150);    
                    break;
                case LARGE:
                    myEgg.graphics.drawEllipse(x, y, 150, 200);
                    break;
                default:
                    trace ("Wrong size! There is no egg.");
                break;            
            }
            
            myEgg.graphics.endFill();
    
            this.addChild(myEgg);
        }
    }
}

drawGraphicsData

()메서드 
public function drawGraphicsData(graphicsData:Vector.<IGraphicsData>):void

언어 버전: ActionScript 3.0
런타임 버전: Flash Player 10, AIR 1.5

드로잉할 일련의 IGraphicsData 인스턴스를 전송합니다. 이 메서드는 IGraphicsData 인터페이스를 구현하는 객체(패스, 채우기, 획 포함)가 들어 있는 Vector를 사용합니다. IGraphicsData 인스턴스의 Vector는 모양의 일부를 참조할 수도 있고, 완전하게 정의된 복잡한 데이터 집합을 참조하여 전체 모양을 렌더링할 수도 있습니다.

그래픽 패스에는 다른 그래픽 패스가 포함될 수 있습니다. graphicsData Vector에 패스가 포함된 경우 이 패스와 모든 하위 패스가 이 작업 도중 렌더링됩니다.

매개 변수

graphicsData:Vector.<IGraphicsData> — 그래픽 객체가 들어 있는 Vector입니다. 각 그래픽 객체는 IGraphicsData 인터페이스를 구현합니다.

관련 API 요소


예제  ( 예제 사용 방법 )

다음 예제에서는 GraphicsGradientFill 객체를 만들어 정사각형의 채우기 속성을 설정합니다. 그런 다음 GraphicsStroke 객체(선 두께)와 GraphicsSolidFill 객체(선 색상)를 만들어 정사각형의 테두리 선 속성을 설정합니다. 그 후 GraphicsPath 객체를 만들어 해당 모양을 그리는 데 사용되는 값을 포함합니다. 이러한 객체는 모두 IGraphicsData 객체에 저장되고 drawGraphicsData() 명령에 전달되어 모양을 렌더링합니다.
package
{
    import flash.display.*;
    import flash.geom.*;

    public class DrawGraphicsDataExample extends Sprite
    {
        public function DrawGraphicsDataExample()
        {
            // establish the fill properties
            var myFill:GraphicsGradientFill = new GraphicsGradientFill();
            myFill.colors = [0xEEFFEE, 0x0000FF];
            myFill.matrix = new Matrix();
            myFill.matrix.createGradientBox(100, 100, 0);
            
            // establish the stroke properties
            var myStroke:GraphicsStroke = new GraphicsStroke(2);
            myStroke.fill = new GraphicsSolidFill(0x000000);
            
            // establish the path properties
            var pathCommands = new Vector.<int>(5, true);
            pathCommands[0] = GraphicsPathCommand.MOVE_TO;
            pathCommands[1] = GraphicsPathCommand.LINE_TO;
            pathCommands[2] = GraphicsPathCommand.LINE_TO;
            pathCommands[3] = GraphicsPathCommand.LINE_TO;
            pathCommands[4] = GraphicsPathCommand.LINE_TO;
            
            var pathCoordinates:Vector.<Number> = new Vector.<Number>(10, true);
            pathCoordinates.push(10,10, 10,100, 100,100, 100,10, 10,10);
            
            var myPath:GraphicsPath = new GraphicsPath(pathCommands, pathCoordinates);
            
            // populate the IGraphicsData Vector array
            var myDrawing:Vector.<IGraphicsData> = new Vector.<IGraphicsData>(3, true);
            myDrawing[0] = myFill;
            myDrawing[1] = myStroke;
            myDrawing[2] = myPath;
            
            // render the drawing
            graphics.drawGraphicsData(myDrawing);
        }
    }
}

drawPath

()메서드 
public function drawPath(commands:Vector.<int>, data:Vector.<Number>, winding:String = "evenOdd"):void

언어 버전: ActionScript 3.0
런타임 버전: Flash Player 10, AIR 1.5

드로잉을 위한 일련의 명령을 전송합니다. drawPath() 메서드는 개별 moveTo(), lineTo()curveTo() 드로잉 명령의 Vector를 받아 이를 단일 호출로 통합합니다. drawPath() 메서드 매개 변수는 드로잉 명령과 x 및 y 좌표 값 쌍 및 드로잉 방향을 결합합니다. 드로잉 명령은 정수이며 GraphicsPathCommand 클래스에 정의되는 상수로 표현됩니다. x 및 y 좌표 값 쌍은 배열의 숫자이며, 이 배열에서 각 쌍은 좌표 위치를 정의합니다. 드로잉 방향은 GraphicsPathWinding 클래스의 값입니다.

일반적으로 drawPath()를 사용하면 lineTo()curveTo() 메서드를 개별적으로 호출할 때보다 드로잉이 빠르게 렌더링됩니다.

drawPath() 메서드는 부동 소수점 계산을 사용하므로 모양의 회전 및 크기 조절이 보다 정확해져 결과의 품질이 향상됩니다. 그러나 drawPath() 메서드를 lineTo()curveTo() 메서드와 함께 사용하면 전송된 곡선에 작은 하위 픽셀 정렬 오류가 발생할 수 있습니다.

drawPath() 메서드는 선을 채우고 그릴 때 조금 다른 규칙을 사용합니다. 이러한 규칙은 다음과 같습니다.

  • 패스 렌더링에 채우기를 적용할 경우:
    • 3개 미만의 점으로 구성된 하위 패스는 렌더링되지 않습니다. 하지만 이 경우에도 획 렌더링은 아래 획 규칙에 따라 발생합니다.
    • 닫히지 않은 하위 패스(끝점이 시작점과 같지 않은 하위 패스)는 암시적으로 닫힙니다.
  • 패스 렌더링에 획을 적용할 경우:
    • 하위 패스는 개수가 제한되지 않은 점으로 구성될 수 있습니다.
    • 하위 패스는 암시적으로 닫히지 않습니다.

매개 변수

commands:Vector.<int> — 드로잉 명령을 나타내는 정수의 Vector입니다. 허용되는 값 집합은 GraphicsPathCommand 클래스의 상수로 정의됩니다.
 
data:Vector.<Number> — 각 숫자 쌍이 좌표 위치(x, y 쌍)로 취급되는 숫자 인스턴스의 Vector입니다. x 및 y 좌표 값 쌍은 Point 객체가 아닙니다. data 벡터는 각각의 두 숫자 그룹이 좌표 위치를 나타내는 수열입니다.
 
winding:String (default = "evenOdd") — GraphicsPathWinding 클래스에 정의된 값을 사용하여 굴곡 규칙을 지정합니다.

관련 API 요소


예제  ( 예제 사용 방법 )

다음 예제에서는 두 Vector 객체를 채운 다음 drawPath() 메서드에 전달하여 파란색 별을 렌더링합니다. 첫 번째 Vector star_commands에는 GraphicsPathCommand 클래스의 드로잉 명령을 나타내는 일련의 상수가 있습니다. 두 번째 Vector인 star_coord에는 x 및 y 좌표 쌍의 집합이 5개 들어 있습니다. drawPath() 메서드는 각 명령과 위치를 대응하여 별을 그립니다.
package
{
    import flash.display.*;
        
    public class DrawPathExample extends Sprite
    {
        public function DrawPathExample()
        {
            var star_commands:Vector.<int> = new Vector.<int>(5, true);
            
            star_commands[0] = GraphicsPathCommand.MOVE_TO;
            star_commands[1] = GraphicsPathCommand.LINE_TO;
            star_commands[2] = GraphicsPathCommand.LINE_TO;
            star_commands[3] = GraphicsPathCommand.LINE_TO;
            star_commands[4] = GraphicsPathCommand.LINE_TO;
            
            var star_coord:Vector.<Number> = new Vector.<Number>(10, true);
            star_coord[0] = 66; //x
            star_coord[1] = 10; //y 
            star_coord[2] = 23; 
            star_coord[3] = 127; 
            star_coord[4] = 122; 
            star_coord[5] = 50; 
            star_coord[6] = 10; 
            star_coord[7] = 49; 
            star_coord[8] = 109; 
            star_coord[9] = 127;
            
            graphics.beginFill(0x003366);
            graphics.drawPath(star_commands, star_coord);
        }
    }
}

참고: 기본적으로 drawPath() 메서드는 짝수-홀수 굴곡 유형을 사용합니다. 따라서 별의 중심은 채워지지 않습니다. 세 번째 매개 변수로 0이 아닌 굴곡 유형을 지정하면 별의 중심이 채워집니다.
 graphics.drawPath(star_commands, star_coord, GraphicsPathWinding.NON_ZERO);
 

drawRect

()메서드 
public function drawRect(x:Number, y:Number, width:Number, height:Number):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

사각형을 그립니다. drawRect() 메서드를 호출하기 전에 linestyle(), lineGradientStyle(), beginFill(), beginGradientFill() 또는 beginBitmapFill() 메서드를 호출하여 선 스타일, 채우기 또는 두 가지 모두를 설정합니다.

매개 변수

x:Number — 부모 표시 객체의 등록 포인트를 기준으로 가로 위치를 픽셀 단위로 나타내는 숫자입니다.
 
y:Number — 부모 표시 객체의 등록 포인트를 기준으로 세로 위치를 픽셀 단위로 나타내는 숫자입니다.
 
width:Number — 사각형의 폭(픽셀 단위)입니다.
 
height:Number — 사각형의 높이(픽셀 단위)입니다.


오류
ArgumentError width 또는 height 매개 변수가 숫자가 아닌 경우(Number.NaN)입니다.

관련 API 요소


예제  ( 예제 사용 방법 )

다음 예제에서는 ActionScript 3.0에서 모양을 그리는 방법을 보여 줍니다. ActionScriptExamples.com에서 제공하는 예제입니다.
var movieClip:MovieClip = new MovieClip();
movieClip.graphics.beginFill(0xFF0000);
movieClip.graphics.drawRect(0, 0, 100, 80);
movieClip.graphics.endFill();
movieClip.x = 10;
movieClip.y = 10;
addChild(movieClip);

drawRoundRect

()메서드 
public function drawRoundRect(x:Number, y:Number, width:Number, height:Number, ellipseWidth:Number, ellipseHeight:Number = NaN):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

모서리가 둥근 직사각형을 그립니다. drawRoundRect() 메서드를 호출하기 전에 linestyle(), lineGradientStyle(), beginFill(), beginGradientFill() 또는 beginBitmapFill() 메서드를 호출하여 선 스타일, 채우기 또는 두 가지 모두를 설정합니다.

매개 변수

x:Number — 부모 표시 객체의 등록 포인트를 기준으로 가로 위치를 픽셀 단위로 나타내는 숫자입니다.
 
y:Number — 부모 표시 객체의 등록 포인트를 기준으로 세로 위치를 픽셀 단위로 나타내는 숫자입니다.
 
width:Number — 둥근 사각형의 폭(픽셀 단위)입니다.
 
height:Number — 둥근 사각형의 높이(픽셀 단위)입니다.
 
ellipseWidth:Number — 둥근 모서리를 그릴 때 사용하는 타원의 폭(픽셀 단위)입니다.
 
ellipseHeight:Number (default = NaN) — 둥근 모서리를 그릴 때 사용하는 타원의 높이(픽셀 단위)입니다. 선택 사항입니다. 값이 지정되지 않은 경우, ellipseWidth 매개 변수 값이 기본값이 됩니다.


오류
ArgumentError width, height, ellipseWidth 또는 ellipseHeight 매개 변수가 숫자가 아닌 경우(Number.NaN)입니다.

관련 API 요소


예제
예제 사용 방법
이 메서드를 사용하는 방법은 이 클래스 뒷부분의 예제를 참조하십시오.

drawTriangles

()메서드 
public function drawTriangles(vertices:Vector.<Number>, indices:Vector.<int> = null, uvtData:Vector.<Number> = null, culling:String = "none"):void

언어 버전: ActionScript 3.0
런타임 버전: Flash Player 10, AIR 1.5

일반적으로 비트맵을 왜곡하여 3차원 느낌을 주는 삼각형 집합을 렌더링합니다. drawTriangles() 메서드는 (u,v) 좌표 집합을 사용하여 현재 채우기 또는 비트맵 채우기를 삼각형 면에 매핑합니다.

모든 유형의 채우기를 사용할 수 있지만 채우기에 포함된 변형 행렬은 무시됩니다.

비트맵 채우기가 사용된 경우 uvtData 매개 변수를 사용하면 텍스처 매핑이 향상됩니다.

매개 변수

vertices:Vector.<Number> — 각 숫자 쌍이 좌표 위치(x, y 쌍)으로 취급되는 숫자의 Vector입니다. vertices 매개 변수는 필수 항목입니다.
 
indices:Vector.<int> (default = null) — 각각의 세 인덱스가 삼각형을 정의하는 정수 또는 인덱스의 Vector입니다. indexes 매개 변수가 null이면 각각의 세 꼭지점(vertices Vector의 x,y 쌍 6개)이 삼각형을 정의합니다. 그렇지 않으면 각 인덱스가 꼭지점(vertices Vector의 숫자 쌍)을 참조합니다. 예를 들어 indexes[1]은 (vertices[2], vertices[3])을 참조합니다. indexes 매개 변수는 선택적이지만 일반적으로 인덱스를 사용하면 전송되는 데이터 양과 계산되는 데이터 양이 감소합니다.
 
uvtData:Vector.<Number> (default = null) — 텍스처 매핑을 적용하는 데 사용되는 정규화된 좌표의 Vector입니다. 각 좌표는 채우기에 사용되는 비트맵의 점을 참조합니다. 꼭지점마다 하나의 UV 또는 하나의 UVT 좌표가 있어야 합니다. UV 좌표에서 (0,0)은 비트맵의 왼쪽 위이고 (1,1)은 오른쪽 아래입니다.

이 벡터의 길이가 vertices 벡터 길이의 2배인 경우 원근 교정 없이 정규화된 좌표가 사용됩니다.

이 벡터의 길이가 vertices 벡터 길이의 3배인 경우에는 세 번째 좌표가 't'(시야 공간에서 눈과 텍스처 사이의 거리)로 해석됩니다. 이렇게 하면 렌더링 엔진이 텍스처를 3차원으로 매핑할 때 원근감을 올바르게 적용하는 데 도움이 됩니다.

uvtData 매개 변수가 null인 경우 일반 채우기 규칙과 임의의 채우기 유형이 적용됩니다.

 
culling:String (default = "none") — 지정된 방향을 향하는 삼각형을 렌더링할지 여부를 지정합니다. 이 매개 변수를 사용하면 현재 뷰에서 볼 수 없는 삼각형이 렌더링되지 않습니다. 이 매개 변수는 TriangleCulling 클래스에 의해 정의된 모든 값으로 설정할 수 있습니다.

관련 API 요소

endFill

()메서드 
public function endFill():void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

beginFill(), beginGradientFill() 또는 beginBitmapFill() 메서드에 대한 마지막 호출 이후로 추가된 선과 곡선에 채우기를 적용합니다. Flash는 beginFill(), beginGradientFill() 또는 beginBitmapFill() 메서드를 이전에 호출할 때 지정한 채우기를 사용합니다. 현재 드로잉 위치가 moveTo() 메서드에 지정된 이전 드로잉 위치와 다르고 채우기가 정의되어 있는 경우, 이 경로를 선으로 닫은 다음 채웁니다.

관련 API 요소

lineBitmapStyle

()메서드 
public function lineBitmapStyle(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void

언어 버전: ActionScript 3.0
런타임 버전: Flash Player 10, AIR 1.5

선을 그릴 때 선의 획에 사용할 비트맵을 지정합니다.

이후에 lineTo() 메서드 또는 drawCircle() 메서드 등의 Graphics 메서드를 호출할 때 비트맵 선 스타일이 사용됩니다. 선 스타일의 효과는 lineStyle() 또는 lineGradientStyle() 메서드를 호출하거나 다른 매개 변수를 사용하여 lineBitmapStyle() 메서드를 다시 호출할 때까지 유지됩니다.

패스를 그리는 동안 lineBitmapStyle() 메서드를 호출하여 패스 내의 여러 선분에 대해 다른 스타일을 지정할 수 있습니다.

획을 사용하도록 설정하려면 lineStyle() 메서드를 호출한 후 lineBitmapStyle() 메서드를 호출해야 합니다. 그렇지 않으면 선 스타일의 값이 undefined가 됩니다.

clear() 메서드를 호출하면 선 스타일이 다시 undefined로 설정됩니다.

매개 변수

bitmap:BitmapData — 선의 획에 사용할 비트맵입니다.
 
matrix:Matrix (default = null) — flash.geom.Matrix 클래스에 의해 정의된 변형 행렬로서 선택 사항입니다. 이 행렬은 비트맵을 선 스타일에 적용하기 전에 크기를 조절하거나 달리 조작하는 데 사용할 수 있습니다.
 
repeat:Boolean (default = true) — 비트맵을 바둑판식으로 반복할지 여부를 나타냅니다.
 
smooth:Boolean (default = false) — 비트맵을 매끄럽게 다듬을지 여부를 나타냅니다.

관련 API 요소

lineGradientStyle

()메서드 
public function lineGradientStyle(type:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix = null, spreadMethod:String = "pad", interpolationMethod:String = "rgb", focalPointRatio:Number = 0):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9

선을 그릴 때 획에 사용할 그래디언트를 지정합니다.

그래디언트 선 스타일은 이후에 lineTo() 메서드 또는 drawCircle() 메서드 등의 Graphics 메서드를 호출할 때 사용됩니다. 선 스타일의 효과는 lineStyle() 또는 lineBitmapStyle() 메서드를 호출하거나 다른 매개 변수를 사용하여 lineGradientStyle() 메서드를 다시 호출할 때까지 유지됩니다.

패스를 그리는 동안 lineGradientStyle() 메서드를 호출하여 패스 내의 여러 선분에 대해 다른 스타일을 지정할 수 있습니다.

획을 사용하도록 설정하려면 lineStyle() 메서드를 호출한 후 lineGradientStyle() 메서드를 호출해야 합니다. 그렇지 않으면 선 스타일의 값이 undefined가 됩니다.

clear() 메서드를 호출하면 선 스타일이 다시 undefined로 설정됩니다.

매개 변수

type:String — 사용할 그래디언트 유형, 즉 GradientType.LINEAR 또는 GradientType.RADIAL을 지정하는 GradientType 클래스 값입니다.
 
colors:Array — 그래디언트에서 사용할 RGB 16진수 색상 값의 배열입니다(예: 빨강은 0xFF0000, 파랑은 0x0000FF 등).
 
alphas:Array — 색상 배열에 속한 색상의 알파 값 배열이며 유효한 값은 0부터 1까지입니다. 값이 0보다 작으면 기본값은 0입니다. 값이 1보다 큰 경우 기본값은 1입니다.
 
ratios:Array — 색상 배분 비율의 배열로, 유효한 값은 0부터 255까지입니다. 이 값은 색상이 100%로 샘플링되는 위치의 폭에 대한 백분율을 정의합니다. 값 0은 그래디언트 상자의 왼쪽 위치를, 255는 그래디언트 상자의 오른쪽 위치를 나타냅니다. 이 값은 최종 그래디언트의 좌표 공간이 아니라 그래디언트 상자에서의 위치를 나타내며, 그래디언트 상자보다 넓거나 좁을 수 있습니다. colors 매개 변수의 각 값을 지정합니다.

예를 들어 파랑과 녹색의 두 색상을 포함하는 선형 그래디언트의 경우 다음 그림에서는 ratios 배열의 서로 다른 값을 기준으로 그래디언트의 색상 배치를 보여 줍니다.

ratios그래디언트
[0, 127]0:127 비율로 파랑에서 녹색으로 바뀌는 선형 그래디언트
[0, 255]0:255 비율로 파랑에서 녹색으로 바뀌는 선형 그래디언트
[127, 255]127:255 비율로 파랑에서 녹색으로 바뀌는 선형 그래디언트

배열의 값은 [0, 63, 127, 190, 255]와 같이 순차적으로 증가해야 합니다.

 
matrix:Matrix (default = null) — flash.geom.Matrix 클래스에 의해 정의된 변형 행렬입니다. flash.geom.Matrix 클래스에 포함된 createGradientBox() 메서드를 사용하면 lineGradientStyle() 메서드와 함께 사용할 행렬을 편리하게 설정할 수 있습니다.
 
spreadMethod:String (default = "pad") — 사용할 스프레드 메서드를 지정하는 SpreadMethod 클래스 값입니다.

SpreadMethod.PAD를 사용하는 선형 그래디언트SpreadMethod.REFLECT를 사용하는 선형 그래디언트SpreadMethod.REPEAT를 사용하는 선형 그래디언트
SpreadMethod.PADSpreadMethod.REFLECTSpreadMethod.REPEAT

 
interpolationMethod:String (default = "rgb") — 사용할 값을 지정하는 InterpolationMethod 클래스 값입니다. 예를 들어 두 색상 간의 간단한 선형 그래디언트를 생각해 볼 수 있습니다(spreadMethod 매개 변수를 SpreadMethod.REFLECT로 설정). 여러 가지 보간 방법은 다음과 같이 외양에 영향을 미칩니다.

InterpolationMethod.LINEAR_RGB를 사용하는 선형 그래디언트InterpolationMethod.RGB를 사용하는 선형 그래디언트
InterpolationMethod.LINEAR_RGBInterpolationMethod.RGB

 
focalPointRatio:Number (default = 0) — 그래디언트의 초점 위치를 제어하는 숫자입니다. 값 0은 초점을 중앙에 설정합니다. 값 1은 초점을 한 원형 그래디언트의 테두리에, 값 -1은 초점을 원형 그래디언트의 다른 테두리에 둡니다. -1보다 작거나 1보다 큰 값은 -1 또는 1로 반올림됩니다. 다음 이미지는 focalPointRatio가 -0.75인 그래디언트를 보여 줍니다.

focalPointRatio가 0.75로 설정된 방사형 그래디언트

관련 API 요소


예제  ( 예제 사용 방법 )

다음 예제에서는 빨강에서 녹색, 파랑 순서로 그래디언트 획을 사용하는 사각형과 원을 그립니다.

Matrix 클래스의 createGradientBox() 메서드는 그래디언트 상자를 폭 200, 높이 40으로 정의하는 데 사용됩니다. 선 두께는 5픽셀로 설정됩니다. lineGradientStyle() 메서드에 대한 획의 두께를 반드시 정의해야 합니다. 그래디언트는 선형으로 설정됩니다. 그래디언트의 색상은 빨강, 녹색, 파랑으로 설정됩니다. 색상의 투명도(알파 값)는 1(불투명)로 설정됩니다. 그래디언트는 고르게 배분되고 색상은 0(그래디언트 상자에서 왼쪽), 128(상자에서 가운데), 255(상자에서 오른쪽)에서 100%로 샘플링됩니다. 사각형의 폭은 그래디언트의 모든 스펙트럼을 포함하지만 원은 스펙트럼의 중앙에서부터 50%를 포함합니다.

package {
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.geom.Matrix; 
    import flash.display.GradientType;
    
    public class Graphics_lineGradientStyleExample extends Sprite
    {
        public function Graphics_lineGradientStyleExample()
        {
            var myShape:Shape = new Shape();
            var gradientBoxMatrix:Matrix = new Matrix();
  
            gradientBoxMatrix.createGradientBox(200, 40, 0, 0, 0);  
            
            myShape.graphics.lineStyle(5);
  
            myShape.graphics.lineGradientStyle(GradientType.LINEAR, [0xFF0000,
            0x00FF00, 0x0000FF], [1, 1, 1], [0, 128, 255], gradientBoxMatrix);
            
            myShape.graphics.drawRect(0, 0, 200, 40);
            myShape.graphics.drawCircle(100, 120, 50);  
             
            this.addChild(myShape);
    
        }
    }
}

lineShaderStyle

()메서드 
public function lineShaderStyle(shader:Shader, matrix:Matrix = null):void

언어 버전: ActionScript 3.0
런타임 버전: Flash Player 10, AIR 1.5

선을 그릴 때 선의 획에 사용할 셰이더를 지정합니다.

이후에 lineTo() 메서드 또는 drawCircle() 메서드 등의 Graphics 메서드를 호출할 때 셰이더 선 스타일이 사용됩니다. 선 스타일의 효과는 lineStyle() 또는 lineGradientStyle() 메서드를 호출하거나 다른 매개 변수를 사용하여 lineBitmapStyle() 메서드를 다시 호출할 때까지 유지됩니다.

패스를 그리는 동안 lineShaderStyle() 메서드를 호출하면 패스 내의 여러 선분에 서로 다른 스타일을 지정할 수 있습니다.

획을 사용하도록 설정하려면 lineStyle() 메서드를 호출한 후 lineShaderStyle() 메서드를 호출해야 합니다. 그렇지 않으면 선 스타일의 값이 undefined가 됩니다.

clear() 메서드를 호출하면 선 스타일이 다시 undefined로 설정됩니다.

매개 변수

shader:Shader — 선의 획에 사용할 셰이더입니다.
 
matrix:Matrix (default = null) — flash.geom.Matrix 클래스에 의해 정의된 변형 행렬로서 선택 사항입니다. 이 행렬은 비트맵을 선 스타일에 적용하기 전에 크기를 조절하거나 달리 조작하는 데 사용할 수 있습니다.

관련 API 요소

lineStyle

()메서드 
public function lineStyle(thickness:Number = NaN, color:uint = 0, alpha:Number = 1.0, pixelHinting:Boolean = false, scaleMode:String = "normal", caps:String = null, joints:String = null, miterLimit:Number = 3):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

이후에 lineTo() 메서드 또는 drawCircle() 메서드 등의 Graphics 메서드를 호출할 때 사용되는 선 스타일을 지정합니다. 선 스타일의 효과는 다른 매개 변수를 사용하여 lineGradientStyle() 메서드, lineBitmapStyle() 메서드, 또는 lineStyle() 메서드를 호출할 때까지 유지됩니다.

패스를 그리는 동안 lineStyle() 메서드를 호출하면 패스 내의 여러 선분에 대해 다른 스타일을 지정할 수 있습니다.

참고: clear() 메서드를 호출하면 선 스타일이 다시 undefined로 설정됩니다.

참고: Flash Lite 4에서는 처음 세 매개 변수(thickness, coloralpha)만 지원합니다.

매개 변수

thickness:Number (default = NaN) — 선의 두께를 포인트 단위로 나타내는 정수이며 유효한 값은 0-255입니다. 숫자를 지정하지 않았거나 매개 변수가 정의되지 않은 경우 선이 그려지지 않습니다. 0보다 작은 값이 전달될 경우 기본값은 0입니다. 값 0은 매우 가는 두께를 나타내며 최대 두께는 255입니다. 255보다 큰 값이 전달될 경우 기본값은 255입니다.
 
color:uint (default = 0) — 선의 16진수 색상 값입니다. 예를 들어 빨강은 0xFF0000, 파랑은 0x0000FF 등입니다. 값이 지정되지 않은 경우 기본값은 0x000000(검정)입니다. 선택 사항입니다.
 
alpha:Number (default = 1.0) — 선 색상의 알파 값을 나타내는 숫자로, 유효한 값은 0부터 1까지입니다. 값이 지정되지 않은 경우 기본값은 1(단색)입니다. 값이 0보다 작으면 기본값은 0입니다. 값이 1보다 큰 경우 기본값은 1입니다.
 
pixelHinting:Boolean (default = false) — (Flash Lite 4에서 지원되지 않음) 전체 픽셀로 획을 힌팅할 것인지 여부를 지정하는 부울 값입니다. 이 값은 곡선의 앵커 위치와 선 획 크기에 모두 영향을 줍니다. pixelHintingtrue로 설정되면 선의 폭이 전체 픽셀 폭으로 조절됩니다. pixelHintingfalse로 설정되면 곡선 및 직선에 분리가 발생할 수 있습니다. 예를 들어 다음 그림에서는 lineStyle() 메서드에 사용된 pixelHinting 매개 변수가 다르게 설정된 것을 제외하고는 동일한 두 개의 둥근 사각형을 Flash Player 또는 Adobe AIR 가 렌더링하는 방법을 보여 줍니다. 이미지는 차이점을 강조하기 위해 200%로 확대되었습니다.

pixelHinting false 및 pixelHinting true

값이 제공되지 않으면 선에서는 픽셀 힌팅을 사용하지 않습니다.

 
scaleMode:String (default = "normal") — (Flash Lite 4에서 지원되지 않음) 사용할 크기 조절 모드를 지정하는 LineScaleMode 클래스 값입니다.
  • LineScaleMode.NORMAL - 객체의 크기가 조절될 때 항상 선 두께를 조절합니다(기본값).
  • LineScaleMode.NONE - 선 두께를 조절하지 않습니다.
  • LineScaleMode.VERTICAL - 객체의 크기가 세로로만 조절되는 경우 선 두께를 조절하지 않습니다. 예를 들어 scaleMode 매개 변수를 LineScaleMode.VERTICAL로 설정하고 1픽셀 선으로 그린 다음과 같은 원을 생각해 볼 수 있습니다. 왼쪽 원의 크기는 세로로만 조절되며, 오른쪽 원의 크기는 세로 및 가로 방향 모두 조절됩니다.

    세로로 크기 조절되는 원형과 세로와 가로 양쪽으로 크기 조절되는 원형입니다.

  • LineScaleMode.HORIZONTAL - 객체의 크기가 가로로만 조절되는 경우 선 두께를 조절하지 않습니다. 예를 들어 scaleMode 매개 변수를 LineScaleMode.HORIZONTAL로 설정하고 1픽셀 선으로 그린 다음과 같은 원을 생각해 볼 수 있습니다. 왼쪽 원의 크기는 가로로만 조절되며, 오른쪽 원의 크기는 세로 및 가로 방향 모두 조절됩니다.

    가로로 크기 조절되는 원형과 세로와 가로 양쪽으로 크기 조절되는 원형입니다.

 
caps:String (default = null) — (Flash Lite 4에서 지원되지 않음) 선 끝의 유형을 지정하는 CapsStyle 클래스 값입니다. 유효 값은 CapsStyle.NONE, CapsStyle.ROUNDCapsStyle.SQUARE입니다. 값이 지정되지 않으면 Flash에서는 라운드 끝을 사용합니다.

예를 들어 다음 그림에서는 다양한 capsStyle 설정을 보여 줍니다. 이 그림에서는 각 설정에 대해 두께가 30인 파란색 선(capsStyle이 적용됨)과 이 선과 겹쳐져 있는 두께가 1인 검은색 선(capsStyle이 적용되지 않음)을 보여 줍니다.

없음, 원형 및 사각형

 
joints:String (default = null) — (Flash Lite 4에서 지원되지 않음) 각도에 사용된 연결점 모양의 유형을 지정하는 JointStyle 클래스 값입니다. 유효 값은 JointStyle.BEVEL, JointStyle.MITERJointStyle.ROUND입니다. 값이 지정되지 않으면 Flash에서는 라운드 연결점을 사용합니다.

예를 들어 다음 그림에서는 다양한 joints 설정을 보여 줍니다. 이 그림에서는 각 설정에 대해 두께가 30인 각진 파란색 선(jointStyle이 적용됨)과 이 선과 겹쳐져 있는 두께가 1인 각진 검은색 선(jointStyle이 적용되지 않음)을 보여 줍니다.

이음, 라운드 및 경사

참고: jointsJointStyle.MITER로 설정된 경우, miterLimit 매개 변수를 사용하여 이음 길이를 제한할 수 있습니다.

 
miterLimit:Number (default = 3) — (Flash Lite 4에서 지원되지 않음) 이음이 잘리는 한계를 나타내는 숫자입니다. 유효한 값의 범위는 1에서 255 사이이며, 이 범위를 벗어나는 값은 1 또는 255로 수정됩니다. 이 값은 jointStyle"miter"로 설정된 경우에만 사용됩니다. miterLimit 값은 선이 만나 연결점을 형성하는 점을 이음이 벗어날 수 있는 길이를 나타냅니다. 이 값은 선 thickness의 인수를 나타냅니다. 예를 들어 miterLimit 인수가 2.5이고 thickness가 10픽셀인 경우 25픽셀에서 이음이 잘립니다.

예를 들어 thickness가 20이고 miterLimit가 1, 2 및 4로 설정된 각진 선을 생각해 볼 수 있습니다. 겹쳐져 있는 검은색 선은 참조 선으로, 연결점이 만나는 지점을 보여 줍니다.

이음제한이 1, 2 및 4로 설정된 선

miterLimit 값에 이음을 자를 수 있는 최대 각도가 지정되어 있다는 점에 유의합니다. 다음 표는 몇 가지 샘플 목록입니다.

miterLimit 값:자를 수 있는 최대 각도:
1.41490도
260도
430도
815도

관련 API 요소


예제
예제 사용 방법
getStyle() 메서드를 사용하는 방법은 lineTo() 또는 moveTo() 메서드의 예제를 참조하십시오.

lineTo

()메서드 
public function lineTo(x:Number, y:Number):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

현재의 선 스타일을 사용하여 현재의 드로잉 위치에서 (x, y) 위치까지 선을 그립니다. 그런 다음 현재의 드로잉 위치를 (x, y)로 설정합니다. 그리고 있는 표시 객체에 Flash 드로잉 도구로 만든 내용이 있는 경우, lineTo() 메서드를 호출하면 그 내용 아래에 그려집니다. moveTo() 메서드를 호출하기 전에 lineTo()를 호출하면 현재 드로잉의 기본 위치는 (0, 0)입니다. 매개 변수가 하나라도 없으면 이 메서드는 실패하고 현재 드로잉 위치는 변경되지 않습니다.

매개 변수

x:Number — 부모 표시 객체의 등록 포인트를 기준으로 수평 위치를 나타내는 숫자입니다(픽셀 단위).
 
y:Number — 부모 표시 객체의 등록 포인트를 기준으로 수직 위치를 나타내는 숫자입니다(픽셀 단위).


예제  ( 예제 사용 방법 )

다음 예제는 lineTo() 메서드를 사용하여 픽셀 (100, 100)에서 시작하는 사다리꼴을 그립니다.

선 두께는 10픽셀, 색상은 황금색과 불투명, 선의 끝은 없음(모든 선이 연결되기 때문), 선 사이의 연결점은 MITER로 설정되고 날카롭고 뾰족한 모서리를 갖도록 이음 제한이 10으로 설정됩니다.

package {
    import flash.display.Sprite;
    import flash.display.LineScaleMode;
    import flash.display.CapsStyle;
    import flash.display.JointStyle;
    import flash.display.Shape;


    public class Graphics_lineToExample extends Sprite {

        public function Graphics_lineToExample() {

            var trapezoid:Shape = new Shape();    

            trapezoid.graphics.lineStyle(10, 0xFFD700, 1, false, LineScaleMode.VERTICAL,
                               CapsStyle.NONE, JointStyle.MITER, 10);

            trapezoid.graphics.moveTo(100, 100);
 
            trapezoid.graphics.lineTo(120, 50);
            trapezoid.graphics.lineTo(200, 50);
            trapezoid.graphics.lineTo(220, 100);
            trapezoid.graphics.lineTo(100, 100); 

            this.addChild(trapezoid);
        }
    }
}

moveTo

()메서드 
public function moveTo(x:Number, y:Number):void

언어 버전: ActionScript 3.0
런타임 버전: AIR 1.0, Flash Player 9, Flash Lite 4

현재의 드로잉 위치를 (x, y)로 옮깁니다. 매개 변수가 하나라도 없으면 이 메서드는 실패하고 현재 드로잉 위치는 변경되지 않습니다.

매개 변수

x:Number — 부모 표시 객체의 등록 포인트를 기준으로 수평 위치를 나타내는 숫자입니다(픽셀 단위).
 
y:Number — 부모 표시 객체의 등록 포인트를 기준으로 수직 위치를 나타내는 숫자입니다(픽셀 단위).


예제  ( 예제 사용 방법 )

다음 예제는 moveTo()lineTo() 메서드를 사용해서 두께가 3픽셀인 파선을 그립니다.

lineStyle() 메서드 사용 시 선 두께는 3픽셀로 설정됩니다. 또한 크기를 조절할 수 없도록 설정됩니다. 색상은 불투명도가 25%인 빨강으로 설정됩니다. CapsStyle 속성은 square로 설정됩니다(기본값은 round).

Graphics_moveToExampleSprite 클래스의 인스턴스이기 때문에 모든 Graphics 클래스 메서드에 액세스할 수 있습니다. Graphics 클래스 메서드를 사용해서 Graphic_moveToExample Sprite 객체에 직접 그릴 수 있습니다. 그러나 Shape에 벡터 드로잉 객체를 넣지 않으면 관리, 이동 또는 변경할 수 있는 방법이 제한됩니다.

package {
    import flash.display.Sprite;
    import flash.display.CapsStyle;
    import flash.display.LineScaleMode;

    public class Graphics_moveToExample extends Sprite
    {
        public function Graphics_moveToExample() {
            
            graphics.lineStyle(3, 0x990000, 0.25, false, 
                            LineScaleMode.NONE, CapsStyle.SQUARE);

            graphics.moveTo(10, 20);
            graphics.lineTo(20, 20);
            graphics.moveTo(30, 20);
            graphics.lineTo(50, 20);
            graphics.moveTo(60, 20);
            graphics.lineTo(80, 20);
            graphics.moveTo(90, 20);
            graphics.lineTo(110, 20);            
            graphics.moveTo(120, 20);
            graphics.lineTo(130, 20);           
        }
    }
}

readGraphicsData

()메서드 
public function readGraphicsData(recurse:Boolean = true):Vector.<IGraphicsData>

언어 버전: ActionScript 3.0
런타임 버전: Flash Player 11.6, AIR 3.6

Sprite 또는 Shape 객체(및 필요할 경우 그 자식)에 벡터 그래픽 내용에 대한 쿼리를 보냅니다. 결과는 IGraphicsData 객체의 Vector입니다. 변환이 쿼리 전에 표시 객체에 적용되므로 반환된 패스가 모든 동일한 좌표 공간에 있게 됩니다. 결과 데이터 집합의 좌표는 샘플링 중인 표시 객체가 아닌 스테이지를 기준으로 합니다.

지정된 제한 사항과 함께 결과에 포함되는 객체 유형은 다음과 같습니다.

  • GraphicsSolidFill
  • GraphicsGradientFill
    • 그래디언트 채우기의 모든 속성은 readGraphicsData()가 반환합니다.
    • 반환된 행렬은 입력 행렬과 유사하지만 정확하게 같지는 않습니다.
  • GraphicsEndFill
  • GraphicsBitmapFill
    • 반환된 행렬은 입력 행렬과 유사하지만 정확하게 같지는 않습니다.
    • repeat는 항상 true입니다.
    • smooth는 항상 false입니다.
  • GraphicsStroke
    • thickness가 지원됩니다.
    • 앞에서 설명한 대로 fill은 GraphicsSolidFill, GraphicsGradientFill 및 GraphicsBitmapFill을 지원합니다.
    • 그 외 모든 속성은 기본값이 있습니다.
  • GraphicsPath
    • 지원되는 명령은 MOVE_TO, CURVE_TO 및 LINE_TO뿐입니다.

다음 시각적 요소 및 변환은 표현할 수도 없고 결과에 포함시킬 수도 없습니다.

  • 마스크
  • 텍스트(예외: 앤티앨리어싱 유형 "애니메이션을 위한 앤티앨리어싱"으로 정의된 정적 텍스트는 벡터 모양으로 렌더링되므로 결과에 포함됨)
  • 셰이더 채우기
  • 혼합 모드
  • 9-분할 크기 조정
  • 삼각형(drawTriangles() 메서드로 생성됨)
  • 불투명한 배경
  • scrollrect 설정
  • 2.5D 변환
  • 숨겨진 객체(visible 속성이 false인 객체)

매개 변수

recurse:Boolean (default = true) — 런타임이 현재 표시 객체의 표시 객체 자식도 쿼리해야 하는지 여부입니다. 재귀 쿼리는 실행하는 데 시간과 메모리가 더 많이 소요됩니다. 결과는 표시 객체로 분리되지 않은, 병합된 단일 결과 집합으로 반환됩니다.

반환값
Vector.<IGraphicsData> — 관련 표시 객체의 벡터 그래픽 내용을 나타내는 IGraphicsData 객체의 Vector입니다.

관련 API 요소


예제  ( 예제 사용 방법 )

다음 예제는 readGraphicsData() 메서드를 사용하여 표시 객체의 벡터 그래픽 내용을 가져옵니다. 그런 다음 사용자가 마우스로 스테이지를 클릭하면 이 내용을 스테이지에 다른 객체로 다시 그립니다.

원본 벡터 내용이 drawGraphicsData() 메서드로 그려지지만 readGraphicsData() 메서드가 가져온 벡터 데이터 객체가 drawGraphicsData() 메서드에 전달된 객체와 정확하게 일치하지 않습니다. 예를 들어 결과 데이터에 GraphicsSolidFill 및 GraphicsEndFill 명령이 포함되어 있으며 두 가지 모두 나타나지만 실제로 원본 그래픽 데이터에는 존재하지 않습니다.

package
{
    import flash.display.GraphicsPathCommand;
    import flash.display.IGraphicsData;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    
    public class ReadGraphicsDataExample extends Sprite
    {
        private var original:Shape;
        private var copy:Shape;
        
        public function ReadGraphicsDataExample()
        {
            original = new Shape();
            original.x = 50;
            original.y = 100;
            addChild(original);
            
            drawSquare();
            
            copy = new Shape();
            copy.x = 250;
            copy.y = 100;
            addChild(copy);
            
            stage.addEventListener(MouseEvent.CLICK, drawCopyOnClick);
        }
        
        private function drawCopyOnClick(event:MouseEvent):void
        {
            // reset
            copy.graphics.clear();
            
            // Sample the vector data. Move the original to 0,0
            // before sampling so that the coordinates match the 
            // relative coordinates of the original.
            var xPos:Number = original.x;
            var yPos:Number = original.y;
            original.x = 0;
            original.y = 0;
            var result:Vector.<IGraphicsData> = original.graphics.readGraphicsData(false);
            original.x = xPos;
            original.y = yPos;
            
            // re-draw
            copy.graphics.drawGraphicsData(result);
        }
        
        private function drawSquare():void
        {
            var squareCommands:Vector.<int> = new Vector.<int>(5, true);
            
            squareCommands[0] = GraphicsPathCommand.MOVE_TO;
            squareCommands[1] = GraphicsPathCommand.LINE_TO;
            squareCommands[2] = GraphicsPathCommand.LINE_TO;
            squareCommands[3] = GraphicsPathCommand.LINE_TO;
            
            var squareCoordinates:Vector.<Number> = new Vector.<Number>(8, true);
            squareCoordinates[0] = 0;
            squareCoordinates[1] = 0; 
            squareCoordinates[2] = 50; 
            squareCoordinates[3] = 0; 
            squareCoordinates[4] = 50; 
            squareCoordinates[5] = 50; 
            squareCoordinates[6] = 0; 
            squareCoordinates[7] = 50; 
            
            original.graphics.beginFill(0x003366);
            original.graphics.drawPath(squareCommands, squareCoordinates);
        }
    }
}
GraphicsExample.as

다음 예제에서는 GraphicsExample 클래스를 사용하여 원, 모서리가 둥근 직사각형 및 정사각형을 그립니다. 이는 다음 단계로 이루어집니다.
  1. 나중에 각 모양의 크기를 결정할 때 사용하기 위해 size 속성을 선언합니다.
  2. 배경색을 주황색으로, 테두리 색상을 어두운 회색으로, 테두리 크기를 0픽셀로, 모서리 반경을 9픽셀로, 스테이지 가장자리와 다른 객체 사이의 간격을 5픽셀로 설정하는 속성을 선언합니다.
  3. 이전 단계에서 선언된 속성을 Graphics 클래스의 기본 제공 메서드와 함께 사용하여 x = 0, y = 0 좌표에서 원, 모서리가 둥근 직사각형, 정사각형을 그립니다.
  4. x = 5, y = 5에서 시작하여 스테이지 상단을 따라 각각의 모양을 다시 그립니다. 모양 간의 간격은 5픽셀입니다.
package {
    import flash.display.DisplayObject;
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.display.Sprite;

    public class GraphicsExample extends Sprite {
        private var size:uint         = 80;
        private var bgColor:uint      = 0xFFCC00;
        private var borderColor:uint  = 0x666666;
        private var borderSize:uint   = 0;
        private var cornerRadius:uint = 9;
        private var gutter:uint       = 5;

        public function GraphicsExample() {
            doDrawCircle();
            doDrawRoundRect();
            doDrawRect();
            refreshLayout();
        }

        private function refreshLayout():void {
            var ln:uint = numChildren;
            var child:DisplayObject;
            var lastChild:DisplayObject = getChildAt(0);
            lastChild.x = gutter;
            lastChild.y = gutter;
            for (var i:uint = 1; i < ln; i++) {
                child = getChildAt(i);
                child.x = gutter + lastChild.x + lastChild.width;
                child.y = gutter;
                lastChild = child;
            }
        }

        private function doDrawCircle():void {
            var child:Shape = new Shape();
            var halfSize:uint = Math.round(size / 2);
            child.graphics.beginFill(bgColor);
            child.graphics.lineStyle(borderSize, borderColor);
            child.graphics.drawCircle(halfSize, halfSize, halfSize);
            child.graphics.endFill();
            addChild(child);
        }

        private function doDrawRoundRect():void {
            var child:Shape = new Shape();
            child.graphics.beginFill(bgColor);
            child.graphics.lineStyle(borderSize, borderColor);
            child.graphics.drawRoundRect(0, 0, size, size, cornerRadius);
            child.graphics.endFill();
            addChild(child);
        }

        private function doDrawRect():void {
            var child:Shape = new Shape();
            child.graphics.beginFill(bgColor);
            child.graphics.lineStyle(borderSize, borderColor);
            child.graphics.drawRect(0, 0, size, size);
            child.graphics.endFill();
            addChild(child);
        }
    }
}




[ X ]영어로 표시되는 이유
ActionScript 3.0 참조 설명서의 내용이 영어로 나타납니다.

ActionScript 3.0 참조 설명서 중 일부는 전체 언어로 번역되지 않았습니다. 언어 요소가 번역되지 않은 경우 영어로 나타납니다. 예를 들어 ga.controls.HelpBox 클래스는 어떤 언어로도 번역되지 않았습니다. 그러므로 한국어 버전의 참조 설명서에서 ga.controls.HelpBox 클래스는 영어로 나타납니다.