Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing _x, _y using createEmptyMovieClip

Status
Not open for further replies.

TimMontreal

Programmer
Nov 19, 2004
13
CA
I am using the createEmptyMovieClip to loop through a database and create a list of entries of a message board and then make the mc the content of a scrollpane.

Is is possible to change the starting point location from the default of 0,0 to say for example 200, 100 when using the createEmptyMovieClip. My problem is that the movieclip is created to match up to the 0,0 location of my maintimeline and I want to line up the upper left corner of the mc with the upper left corner of my scrollpane.

Here is my code, thanks for any help!

var depth = 0;
var nextY = 0;
var count;

board_mc = createEmptyMovieClip("categories_mc", 70);
board_mc.focusEnabled = false;

for (count = 0; count < this.catagoryCount; count++) {

category_mc = board_mc.attachMovie("categoryHeader", "category" + count + "_mc", depth++, {_y:nextY});
category_mc.id = this["catagory" + count + "ID"];
category_mc.title = this["catagory" + count + "Title"];

buildForumList(category_mc, this);


nextY += category_mc._height - 1;
}


spDisplay.setScrollContent(board_mc);
spDisplay.setScrollPosition(0, 0);
 
YOu can treat the empty clip as you would any other, although you can't use an initialisation object you have to create the clip first then change its position explicitly:
Code:
board_mc = createEmptyMovieClip("categories_mc", 70);
board_mc._x=200;
board_mc._y=100;
board_mc.focusEnabled = false;
 
I had tried to reposition it like this already, although it did not work... I have managed a rather un-elegant work around though... What I found was happening was the scroll pane was physically appearing on the stage where it should.. but when I attached the board_mc content to it, it seemed to think that the scrollpane was in the _root clip but positioned accordingly... the work around for this was that rather than having the sub.swf that was containing the scrollpane be smaller in dimension and centered on the main.swf I made it's dimensions the exact same as the large main.swf and now it works.. I'm sure there was a better way around it, but this works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top