我有一个swfloader对象,我想放大它(相对于一个点)。。。。这是我在互联网上的帮助下实现的。
但现在我注意到,当我放大到一个点时,swf加载程序上的滚动条不再工作。。。。
我在下面使用的代码。。。有什么想法可以纠正这个问题吗???
<s:Scroller id="scrollme" width="100%" height="100%" >
<s:HGroup id="mapView" width="100%" height="100%" clipAndEnableScrolling="true" >
<s:SWFLoader id="img" autoLoad="true" addedToStage="img_addedToStageHandler(event)" click="img_clicked(event)" maintainAspectRatio="true" includeIn="normal" />
</s:HGroup>
</s:Scroller>
和动作脚本位
protected function onZoom(event:TransformGestureEvent):void
{
event.stopImmediatePropagation();
scaleAt(event.scaleX,event.localX,event.localY)
}
public function scaleAt( scale : Number, originX : Number, originY : Number ) : void
{
// get the transformation matrix of this object
affineTransform = img.content.transform.matrix;
//transform.matrix
trace("zooming to " + scale)
// move the object to (0/0) relative to the origin
affineTransform.translate( -originX, -originY )
// scale
affineTransform.scale( scale, scale )
// move the object back to its original position
affineTransform.translate( originX, originY )
// apply the new transformation to the object
img.content.transform.matrix = affineTransform;
//checkscroller();
}
protected function img_addedToStageHandler(event:Event):void
{
Multitouch.inputMode = MultitouchInputMode.GESTURE;
if (!Multitouch.supportsGestureEvents)
currentState = "normal";
else
{
currentState = "normal";
for each (var item:String in Multitouch.supportedGestures)
{
if (item == TransformGestureEvent.GESTURE_PAN)
img.addEventListener(TransformGestureEvent.GESTURE_PAN, onPan);
/* else if (item == TransformGestureEvent.GESTURE_ROTATE)
img.addEventListener(TransformGestureEvent.GESTURE_ROTATE, onRotate); */
else if (item == TransformGestureEvent.GESTURE_SWIPE)
img.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe);
else if (item == TransformGestureEvent.GESTURE_ZOOM)
img.addEventListener(TransformGestureEvent.GESTURE_ZOOM, onZoom);
}
}
}
我不知道你在做什么。您正在使用SWFBLoader加载图像?为什么不确定图片组件的url来源。
无论哪种方式,你都不能让你的HGroup包装你的组件,并将clipAndEnableScrolling设置为true。删除该属性,你应该是好的。
<s:Scroller id="scrollme" width="100%" height="100%" >
<s:HGroup id="mapView">
<s:SWFLoader id="img" autoLoad="true" addedToStage="img_addedToStageHandler(event)" click="img_clicked(event)" maintainAspectRatio="true" includeIn="normal" />
</s:HGroup>
</s:Scroller>