我有一个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>
和actionscript位
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);
}
}
}
答案 0 :(得分:0)
不确定我明白你在做什么。您正在使用SWFLoader加载图片?为什么不确定图像组件是否包含图像的URL源。
无论哪种方式,您都不能让HGroup包装您的组件并将clipAndEnableScrolling设置为true。删除该属性,你应该是好的。
答案 1 :(得分:0)
<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>