2011-03-08 4 views
1

나는 돋보기 앱을 만들고있어 도움이 필요하다. 저는 현재 다음과 같은 코드가 있습니다플렉스 "돋보기"/ 마스킹

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()"> 
<mx:Script> 
<![CDATA[ 
    // This code assumes it's being run within a display object container 

// such as a MovieClip or Sprite instance. 

import flash.display.GradientType; 
import flash.display.Loader; 
import flash.display.Sprite; 
import flash.geom.Matrix; 
import flash.net.URLRequest; 

private function init():void { 
// Load an image and add it to the display list. 
var loader:Loader = new Loader(); 
var url:URLRequest = new URLRequest("images/ZionsMap.png"); 
loader.load(url); 
this.stage.addChild(loader); 
    // Create a Sprite. 
var oval:Sprite = new Sprite(); 
// Draw a gradient oval. 
/* var colors:Array = [0x000000, 0x000000]; 
var alphas:Array = [1, 0]; 
var ratios:Array = [0, 255]; 
var matrix:Matrix = new Matrix(); 
matrix.createGradientBox(200, 100, 0, -100, -50); 
    oval.graphics.beginGradientFill(GradientType.RADIAL, 
            colors, 
            alphas, 
            ratios, 
            matrix); */ 
oval.graphics.beginFill(0xFFFFFF,1.0); 
oval.graphics.drawEllipse(-200, -50, 200, 200); 
oval.graphics.endFill(); 
// add the Sprite to the display list 
this.stage.addChild(oval); 
// Set cacheAsBitmap = true for both display objects. 
//loader.cacheAsBitmap = true; 
//oval.cacheAsBitmap = true; 
// Set the oval as the mask for the loader (and its child, the loaded image) 
loader.mask = oval; 
// Make the oval draggable. 
oval.startDrag(true); 
} 
]]> 
</mx:Script> </mx:Application> 

을하지만 이미지 "의"확대의 상단을 통해 확대 "밖으로"이미지를 가지고하는 방법을 확실입니다. 현재 드래그 가능한 마스크는 축소 된 이미지를 통해 확대 된 이미지를 표시합니다. 어떤 팁?

답변

1

그냥 포인터 :이 사람은 정말 멋진 확대 유리를 만들어 향후 참조를 위해 내 Gmail 계정에 저장이 있었다 :

http://devsachinonflex.blogspot.com/2010/04/magnifying-glass-in-flex.html

+0

응답 해 주셔서 감사합니다! 그게 내가 필요한 것에 효과가있을거야! 그 응용 프로그램을 작동 시키셨습니까? 나는 그 예제를 시도했고 그것은 나를 위해로드되지 않습니다. – Eponine

+0

이봐, 새로운 SDK 프로젝트 (sdk 3.2 사용, 3.5도 가능)를 만들었고 mxml 파일의 내용을 기본 응용 프로그램 파일에 복사/붙여 넣기 - probs가 적용되지 않았습니다. 전체 내용을 복사하지 말아주세요. – Ryan

+0

안녕하세요, Brian 님, 답변에 제공하는 링크를 열려고하는데 소스 코드를 열 수 없습니다. 잘못된 요청 (잘못된 호스트 이름)이라는 오류가 발생합니다. 그러니 도와주세요. 나는 FLEX에서 더 새롭고 그 응용 프로그램을 개발 중입니다. 도와주세요. 미리 감사드립니다. –