CFlexWidget

优质
小牛编辑
124浏览
2023-12-01
所有包 | 属性 | 方法
system.web.widgets
继承class CFlexWidget » CWidget » CBaseController » CComponent
源自1.0
版本$Id: CFlexWidget.php 3515 2011-12-28 12:29:24Z mdomba $
源码framework/web/widgets/CFlexWidget.php
CFlexWidget 嵌入一个 Flex 3.x 应用到一个页面中。

要使用CFlexWidget, 设置name为 Flex 应用的名字 (不包括 .swf 扩展名),设置baseUrl 为包含 Flex 应用的 Swf 文件的目录的URL(不包括结尾的斜杠)。

公共属性

隐藏继承属性

属性类型描述定义在
actionPrefixstringactions的ID的前缀。 当微件在CController::actions中声明了 动作提供者,可以为其动作的ID指定前缀以区别 于别的微件或控制器。当微件用于控制器 的视图中时,必须配置同样的前缀。CWidget
alignstringFlex应用所占区域的对齐方式。默认值是“middle”。CFlexWidget
allowFullScreenboolean是否允许Flash在全屏模式下运行。默认值是false。CFlexWidget
allowScriptAccessstring脚本的访问方式。默认值是“sameDomain”。CFlexWidget
altHtmlContentstring如果Flash播放器未安装时显示的HTML内容。CFlexWidget
baseUrlstringFlex应用的基本URL。 这个值指向包含SWF文件的目录的URL。CFlexWidget
bgColorstringFlex应用所占区域的背景色。默认值是“#FFFFFF”,表示白色。CFlexWidget
controllerCController返回此微件所属的控制器。CWidget
enableHistoryboolean历史记录是否可用。默认值是true。CFlexWidget
flashVarsarray需要传递给Flex应用的参数。CFlexWidget
flashVarsAsStringstring生成正确的被 flash 引用的参数的字符串。CFlexWidget
heightstringFlex应用所占区域的高度。默认值是300。CFlexWidget
idstring返回此微件的ID。如果需要的话,将生产一个新的ID并将其返回。CWidget
namestringFlex应用的名字。 这个值是一个SWF文件的名字(不包括.CFlexWidget
ownerCBaseController返回此微件的所有者或创建者。CWidget
qualitystring动画的品质。默认值是“high”。CFlexWidget
skinmixed微件使用的皮肤的名称。默认为“default”。 如果此属性设置为false,微件将不会有皮肤被使用。CWidget
viewPathstring返回包含此微件所需的视图文件的路径。CWidget
widthstringFlex应用所占区域的宽度。默认值是450。CFlexWidget

公共方法

隐藏继承方法

方法描述定义在
__call()如果类中没有调的方法名,则调用这个方法。CComponent
__construct()构造器。CWidget
__get()返回一个属性值、一个事件处理程序列表或一个行为名称。CComponent
__isset()检查一个属性是否为null。CComponent
__set()设置一个组件的属性值。CComponent
__unset()设置一个组件的属性为null。CComponent
actions()返回此widget使用的动作的列表。CWidget
asa()返回这个名字的行为对象。CComponent
attachBehavior()附加一个行为到组件。CComponent
attachBehaviors()附加一个行为列表到组件。CComponent
attachEventHandler()为事件附加一个事件处理程序。CComponent
beginCache()Begins fragment caching.CBaseController
beginClip()Begins recording a clip.CBaseController
beginContent()Begins the rendering of content that is to be decorated by the specified view.CBaseController
beginWidget()Creates a widget and executes it.CBaseController
canGetProperty()确定属性是否可读。CComponent
canSetProperty()确定属性是否可写。CComponent
createWidget()Creates a widget and initializes it.CBaseController
detachBehavior()从组件中分离一个行为。CComponent
detachBehaviors()从组件中分离所有行为。CComponent
detachEventHandler()分离一个存在的事件处理程序。CComponent
disableBehavior()禁用一个附加行为。CComponent
disableBehaviors()禁用组件附加的所有行为。CComponent
enableBehavior()启用一个附加行为。CComponent
enableBehaviors()启用组件附加的所有行为。CComponent
endCache()Ends fragment caching.CBaseController
endClip()Ends recording a clip.CBaseController
endContent()Ends the rendering of content.CBaseController
endWidget()Ends the execution of the named widget.CBaseController
evaluateExpression()计算一个PHP表达式,或根据组件上下文执行回调。CComponent
getController()返回此微件所属的控制器。CWidget
getEventHandlers()返回一个事件的附加处理程序列表。CComponent
getFlashVarsAsString()生成正确的被 flash 引用的参数的字符串。CFlexWidget
getId()返回此微件的ID。如果需要的话,将生产一个新的ID并将其返回。CWidget
getOwner()返回此微件的所有者或创建者。CWidget
getViewFile()根据视图名查找视图文件。CWidget
getViewPath()返回包含此微件所需的视图文件的路径。CWidget
hasEvent()确定一个事件是否定义。CComponent
hasEventHandler()检查事件是否有附加的处理程序。CComponent
hasProperty()确定属性是否被定义。CComponent
init()初始化此微件。CWidget
raiseEvent()发起一个事件。CComponent
registerClientScript()注册必须的CSS和JavaScript。CFlexWidget
render()渲染一个视图。CWidget
renderFile()Renders a view file.CBaseController
renderInternal()Renders a view file.CBaseController
run()渲染一个小物件。CFlexWidget
setId()设置此微件的ID。CWidget
widget()Creates a widget and executes it.CBaseController

属性详细

align 属性 public string $align;

Flex应用所占区域的对齐方式。默认值是“middle”。

allowFullScreen 属性 (可用自 v1.1.1) public boolean $allowFullScreen;

是否允许Flash在全屏模式下运行。默认值是false。

allowScriptAccess 属性 public string $allowScriptAccess;

脚本的访问方式。默认值是“sameDomain”。

altHtmlContent 属性 public string $altHtmlContent;

如果Flash播放器未安装时显示的HTML内容。

baseUrl 属性 public string $baseUrl;

Flex应用的基本URL。 这个值指向包含SWF文件的目录的URL。

bgColor 属性 public string $bgColor;

Flex应用所占区域的背景色。默认值是“#FFFFFF”,表示白色。

enableHistory 属性 public boolean $enableHistory;

历史记录是否可用。默认值是true。

flashVars 属性 public array $flashVars;

需要传递给Flex应用的参数。

flashVarsAsString 属性 只读 public string getFlashVarsAsString()

生成正确的被 flash 引用的参数的字符串。

height 属性 public string $height;

Flex应用所占区域的高度。默认值是300。

name 属性 public string $name;

Flex应用的名字。 这个值是一个SWF文件的名字(不包括.swf扩展名)。

quality 属性 public string $quality;

动画的品质。默认值是“high”。

width 属性 public string $width;

Flex应用所占区域的宽度。默认值是450。

方法详细

getFlashVarsAsString() 方法
public string getFlashVarsAsString()
{return}stringflash参数字符串。
源码: framework/web/widgets/CFlexWidget.php#115 (显示) publicfunctiongetFlashVarsAsString()
{
$params=array();
foreach($this->flashVarsas$k=>$v)
$params[]=urlencode($k).'='.urlencode($v);
returnCJavaScript::quote(implode('&',$params));
}

生成正确的被 flash 引用的参数的字符串。

registerClientScript() 方法
public void registerClientScript()
源码: framework/web/widgets/CFlexWidget.php#99 (显示) publicfunctionregisterClientScript()
{
$cs=Yii::app()->getClientScript();
$cs->registerScriptFile($this->baseUrl.'/AC_OETags.js');

if($this->enableHistory)
{
$cs->registerCssFile($this->baseUrl.'/history/history.css');
$cs->registerScriptFile($this->baseUrl.'/history/history.js');
}
}

注册必须的CSS和JavaScript。

run() 方法
public void run()
源码: framework/web/widgets/CFlexWidget.php#82 (显示) publicfunctionrun()
{
if(empty($this->name))
thrownewCException(Yii::t('yii','CFlexWidget.namecannotbeempty.'));
if(empty($this->baseUrl))
thrownewCException(Yii::t('yii','CFlexWidget.baseUrlcannotbeempty.'));
if($this->altHtmlContent===null)
$this->altHtmlContent=Yii::t('yii','Thiscontentrequiresthe<ahref="http://www.adobe.com/go/getflash/">AdobeFlashPlayer</a>.');

$this->registerClientScript();

$this->render('flexWidget');
}

渲染一个小物件。