Location on Stage Property

Location on Stage Property

Flash CS4 ActionScript 3.0 Tutorial

 

How to Assign Stage Location Property to Button Symbols, Movie Symbols and Text with ActionScript

 

 

The x and y properties determine the object's location on the stage. The values are set in pixels and are measured from the upper left corner of the stage. The object's registration point determines the location. For more information about setting and moving the registration point, see topic, Setting and Moving Object Registration Point.

Tutorial Elements

Movie Symbol with instance name locMovie_mc

 

Step One

Add a Movie Symbol to the stage.

Step Two

Select the object and open the Properties panel (Cmd/F3 (PC-Ctrl/F3)). Type in the name locMovie_mc for the Instance Name.

Step Three

Add a new layer called Actions.

Step Four

Option double-click (PC - Alt double-click) the keyframe in the Actions layer to open the ActionScript panel.

Step Five

Copy/Paste the following code to the ActionScript panel.

locMovie_mc.x = 150;

locMovie_mc.y = 10;

Step Six

Test your movie by pressing Cmd/Return (PC - Ctrl/Enter). By setting the x and y values equal to 150 and 10 (respectively), the object displays 10 pixels down and 150 pixels over from the top left corner of the stage.

Think Beyond the Stage

When entering x and y values you can specify locations beyond the stage boundaries. This can be helpful when choreographing a stage left entrance.

You can also use negative values to specify areas beyond the left edge or above the top edge of the stage. The stage coordinates are measured from the top left corner of the stage. For positive y values you would move towards the stage bottom. Positive x values occur as you travel towards the right edge of the stage.

 

Lynda.com career skills