开发者

Simple AddChild question

开发者 https://www.devze.com 2023-01-11 02:39 出处:网络
I am checking th开发者_运维百科is guy\'s code... http://www.codingcolor.com/as3/as3-youtube-chromless-api/

I am checking th开发者_运维百科is guy's code... http://www.codingcolor.com/as3/as3-youtube-chromless-api/

I have download the source code...but I couldn't figure out how he add the play, pause and stop button in the stage. I know in his VideoPlayerControl.as, he has

playbackControl = new PlayPauseButton();
playbackControl.addEventListener(Event.CHANGE,setPlaybackState);
addChild(playbackControl); 

in his PlayPauseButton.as. there is not code for the location of the button(x,y).. I am not sure how he place the control buttons....

Also...Are there anyways to give the button location with object oriented way instead of specify it with static number???

I appreciate any help...


Without reviewing his code...

it sounds like you need to read up on the Flex Component Lifecycle.

In normal cases, the PlayPauseButton will be created and added in createChildren().

the updateDisplayList() method will position and size the elements. Additionally, many components implement a measure() method that will determine the ideal size for it. And many containers have code to automatically lay out the children. If the PlayPauseButton has a measure method and it is added to a container (such as an HBox of VBox) he won't need code to position or size the button as that wrk is already done in the code that he inherits from the Flex framework.

0

精彩评论

暂无评论...
验证码 换一张
取 消