flex 利用hslider控件以容器中心放缩图片
请问大家 有一图片在一容器中(canvas或 vbox)我想以容器为中心利用hslider控件来放缩图片,,该如何实现呢?在线等答案!!!
XML code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
import flash.events.Event;
import mx.controls.sliderClasses.Slider;
private var actualWidth:Number = 0;
private var actualHeight:Number = 0;
private function center(flag:Boolean = false):void
{
if (flag)
{
actualWidth = image.contentWidth;
actualHeight = image.contentHeight;
}
image.move(Math.round((canvas.width - image.contentWidth) / 2),
Math.round((canvas.height - image.contentHeight) / 2));
}
private function sliderChangeHandler(event:Event):void
{
var value:Number = (event.target as Slider).value;
image.content.width = Math.round(actualWidth * value);
image.content.height = Math.round(actualHeight * value);
center();
}
]]>
相关问答:
在flash中很容易能实现百叶窗效果,不知道flex中能否同样实现该效果?
flex中貌似不行,
air可以
mark
百叶窗是多个网页在同一个页面切换吗?
引用
effects\Blinds.as
JScript code
package effec ......
asp.net 如何与flex进行socket通讯
做了个简单的连接 可一直连接不上 后来查询相关文章 说是需要先配置socket安全策略文件 可是网上大部分都是java的 没有.net的 请懂的这方面的人 亲手写一段代码 教教在 ......
后台java类是
public class EFInputProperty
{
private String name;
private String value;
public String getName() {
return name;
}
public void setName(String properyName) { ......
有没有什么办法让image在载入后缩放到适合大小,然后还能自动在容器内居中。
谢谢
//计算图片框的大小
public function caculate_size():void ......
<mx:RemoteObject id="say" destination="Hello" >
</mx:RemoteObject>
用remoteObject 的 getOperation 方法得到调用的java方法。然后得到一个Abstr ......