을 사용하면 확대/축소 할 수 있습니다. 플래시 파일에서 "마우스 오른쪽 버튼 클릭 -> 확대 또는 축소"가 가능합니다. 예를 들어, 버튼을 클릭하는 등의 작업이 필요합니다.AS3
AS3 코드 만 사용하면 가능합니까?
Thx!
을 사용하면 확대/축소 할 수 있습니다. 플래시 파일에서 "마우스 오른쪽 버튼 클릭 -> 확대 또는 축소"가 가능합니다. 예를 들어, 버튼을 클릭하는 등의 작업이 필요합니다.AS3
AS3 코드 만 사용하면 가능합니까?
Thx!
...
내가 아는 한 멀지 않습니다. 다른 답변을보고 궁금합니다. 마음에 오는
한 해키 것은 어쩌면 당신은 사업부가 큰 얻을 수 있도록 (확대) 을하여 SWF를 포함하는 사업부를 제어하기 위해 자바 스크립트 을 사용할 수 있습니다,하지만 같은 '는 scrollRect'사각형 내에서 표시됩니다. ExternalInterface를 사용하여 javascript 함수를 호출하면됩니다.
나는 플래시의 ScrollPane 구성 요소를 사용했던 quick'n'dirty 시험 :
//zoomIn,zoomOut = button
//sp = scrollPane, scrollDrag = true
zoomIn.addEventListener(MouseEvent.CLICK, zoom);
zoomOut.addEventListener(MouseEvent.CLICK, zoom);
function zoom(event:MouseEvent) {
var scale:Number = event.currentTarget == zoomIn ? 1 : -1;
sp.content.scaleX += scale;
sp.content.scaleY += scale;
sp.update();
}
그럼 난 당신이 플렉스 사용 나타났습니다, 그래서 확실히 당신에게 유사한 기능을 허용 할 용기가 있어야합니다.
HTH, 조지
Thx 조지, 나는 그것을 밖으로 시도 할게. – Artemix
나는 또한, 단순히으로 scaleX가 및 scaleY를 사용합니다 George와 함께 var 대신에 숫자를 써라. 그럼, 뭔가 같은
zoomInButton.addEventListener(MouseEvent.MOUSE_DOWN, zoomIn);
zoomOutButton.addEventListener(MouseEvent.MOUSE_DOWN, zoomOut);
function zoomIn(e:MouseEvent) {
//actions for zoom-in function
myPicture.scaleX += 10;
myPicture.scaleY += 10;
}
function zoomOut(e:MouseEvent) {
//actions for zoom-out function
myPicture.scaleX += 10;
myPicture.scaleY += 10;
}
당신이 다른 장애물을 우연히 발견 할 수도 있습니다, 즉, 좌상 구석으로 그리고 그 크기가 조절됩니다. 이 경우 크기 조정을 사용하여 그림을 이동하십시오. 마찬가지로 당신이/zoomin/zoomout 단계 또는 비디오 객체 또는 다른 작업을 확장하려는 경우
function zoomIn(e:MouseEvent) {
//actions for zoom-in function
myPicture.scaleX += 10;
myPicture.scaleY += 10;
myPicture.x -= 5;
myPicture.y -= 5;
}
사실, 곱셈과 나눗셈 대신 사용해야합니다. 이제
video_width = 640;
video_height = 480;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.stageWidth = video_width;
stage.stageHeight = video_height;
camera = Camera.getCamera();
// some other params
video = new Video(video_width, video_height);
video.attachCamera(camera);
addChild(video);
// to mirror webcam output:
video.scaleX = -1;
video.scaleY = 1;
video.x = video_width;
video.y = 0;
public function zoom(action:String = 'reset')
{
var step = 1.1, // adjust this multiplyer for faster zoom. Eg. 1.2, 1.5, etc.
x_offset = 0,
y_offset = 0;
if (action == 'in')
{
video.scaleX *= step;
video.scaleY *= step;
x_offset = (stage.stageWidth - video.width)/2;
y_offset = (stage.stageHeight - video.height)/2;
// to center video object on stage by X if mirror effect is used
video.x = stage.stageWidth - x_offset;
// to center video object on stage by X - no mirror
// video.x = x_offset;
video.y = y_offset; // to center video object on stage by Y
}
else if (action == 'out')
{
video.scaleX /= step;
video.scaleY /= step;
x_offset = (stage.stageWidth - video.width)/2;
y_offset = (stage.stageHeight - video.height)/2;
video.x = stage.stageWidth - x_offset;
video.y = y_offset;
}
else
{
// need to be mirrored
video.scaleX = -1;
// no mirror
// video.scaleX = 1;
video.scaleY = 1;
// if mirror video output
video.x = stage.stageWidth;
// no mirroring used
// video.x = 0;
video.y = 0;
}
}
당신이 부착하여이를 사용
그 가정 : - (물론 디지털 줌 배율 기능을 사용하여이 내가 웹 카메라 zoomin/zoomout 기능을 만드는 데 필요한 때 내가 사용하는 것입니다)이 같이 귀하의 버튼에이 기능 :
zoom('in');
zoom('out');
zoom('reset'); // reset zoom
그래 .. 그게 플렉스에서 작동하지만 ... 여전히 네이티브 플래시 줌을 사용하지 않습니다. 사용 방법이 있는지 궁금합니다. 잠시 후이 해결책을 사용하겠습니다. – Artemix