views:

29

answers:

1

Hi guys.. I am checking this 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...

+1  A: 

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() methdo 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.

www.Flextras.com
hm...He is using AS3 only to develop his application so vbox or hbox is not the option......I don't see any createCjildren method in his code either....still not sure how he did it.....thanks for the reply...+1
Jerry
If he isn't using the Flex Framework, why'd you tag this question w/ the Adobe Flex tag?
www.Flextras.com
He sets the x position using the adjustLayout method. Do MovieClips automatically size themselves to content? IF so, that'd be your answer.
www.Flextras.com
I am using Flex to write my AS3 project...better AS3 editor than Flash...sry for the confusion....and thanks for the answer....
Jerry
Flex naming is a confusing mess. You are probably use Flex Builder to write your AS3 project. Flex Builder (now renamed Flash Builder) is an IDE. Elex is an SDK, which includes the Flex Framework. They are all different, but are often used interchangeably.
www.Flextras.com