Flex 计算String的宽度
应为设计要求, 我需要计算String的宽度,
搜索了下网上的文章, 看到有用measureText(string)的,
可是用了下发现, 这个function得到的string大小, 不会根据字体的大小, 粗黑的变化,
始终返回同一个值, 也许是我的用法不对, 最后我没有这个方法,
改用了另外一个方法:
private function getTextWidth():int
{
var lb:Label = new Label();
lb.regenerateStyleCache( false );
var textMetrics:TextLineMetrics = lb.measureText( label );
var textWidth:int = textMetrics.width;
return textWidth;
}
如果不行, 确定 maxDisplayedLines="1"
相关文档:
Adobe Flash Builder 4 简体中文正式版 下载:
http://subject.csdn.net/adobedownload/index.html
使用相关的域,利用Adobe Livecycle Designer创建一个PDF模组,以XML节的名称(与PDF模组中的域的名称匹配)向PDF远程对象发送XML数据,然后您的Flex应用程序就会打开PDF, 或将PDF文件放入您的webserv ......
flex 页面跳转
方法一:使用navigateToURL
var url:String = "http://localhost/flex/test.jsp";
var request:URLRequest = new URLRequest(url);
navigateToURL(request,"_self");
方法二:引用flash中的 import flash.external.ExternalInterface 这个接口
他能提供像js中window.location.href方法一样方便
Extern ......
/*Copyright (c) 2006 Adobe Systems Incorporated
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, m ......
2.2 代码实现
下面给出了FlexBuilder工程的一个文件,设置了Flash的布局。
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
......