flex4,Flex 初学

2008-12-11 15:53:15标签:Flex
Flex 初学问题集锦
1,关于creationComplete属性。
creationComplete是元素的属性,为该属性指定function,可以实现当元素加载完成时执行某些操作。
例如,
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="myInit()">
这样的话,当整个Application都加载完毕,就可以执行myInit()操作了。
因为元素的加载是从子元素到父元素这样的顺序,所以在<mx:Application>的属性中指定myInit(),可以保证所有的元素已加载。
2,关于Flex的debug。
(1)欲使用Flex builder的Debug功能,必须首先保证安装了正确的版本。如果未安装正确的版本,那么Flex Builder会提示版本错误,并给出下载链接。将RavSetup的最新版本下载并安装。该安装文件只有2M大小,下载和安装都很快。
(2)在将要进行调试的代码处添加trace语句,例如:

flex4,Flex 初学
650) this.width=650;" align=top> private function playSound():void {

flex4,Flex 初学
650) this.width=650;" align=top> trace("I am working...");

flex4,Flex 初学
650) this.width=650;" align=top> trace(request.url);

flex4,Flex 初学
650) this.width=650;" align=top> myChannel = mySound.play();

flex4,Flex 初学
650) this.width=650;" align=top> myTimer.addEventListener(TimerEvent.TIMER, timerHandler);

flex4,Flex 初学
650) this.width=650;" align=top> myTimer.start();

flex4,Flex 初学
650) this.width=650;" align=top> }
(3)将视图切换到调试模式。
(4)Debug该程序。
3,注意某些对象,必须经过换位才能进行重新赋值。例如,
private function changeVolume():void {
var soundTransform:SoundTransform = myChannel.soundTransform;
soundTransform.volume = volume_hs.value;
myChannel.soundTransform = soundTransform;
// myChannel.soundTransform.volume = volume_hs.value;
}
不能用备注的那句代码来替换上面的三句。
Tags: 

延伸阅读

最新评论

发表评论