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!

createEmptyMovieClip question 1

Status
Not open for further replies.

FSEdge

Technical User
May 26, 2001
63
US
Good day all,

I'm loading external jpg files and have lost control of their placement in the movie relative to _x and _y and I'm not sure why this is.

My two variables are set to:

var MyImagesHolderX = 22;
var MyImagesHolderY = 75;

And called like this:

MyImagesHolder._x = MyImagesHolderX;
MyImagesHolder._y = MyImagesHolderY;

No matter what I change the values to the jpg files always go to _x = 0, _y = 0.

Would this be enough information to obtain help on or do I need to explain it in a different way perhaps?

Thanks,

FSEdge
 
sounds like you are trying to position them before they have fully loaded
 
Thanks for the reply.

That one hadn't occurred to me. If this were the cause of the problem, how would I go about checking to verify this is happening, and then what to do in order to prevent it?

Right now, Action Scripts are a dark cold world to me. But everyday gets a little brighter with help.

Thanks,

FSEdge
 
I believe this is what you are asking for. This code is taken from a Webwasp tutorial I'm following.

Code:
//  Create a Movie Clip to load images into
_root.createEmptyMovieClip("MyImagesHolder", 0);

//  Declare an array 
var MyArray = new Array();

//  Declare 'i' as a variable and set it's value to 0
var i = 0;

//  While the variable 'i' is less than the number of images do the follow
while (i<=NumberOfImages) {

//  Add the following together: 'file location' , 'file number' and 'file type'.
//  Then add it to the array as one hole string. For example: 
//  MyArray[0] = images/0.jpg,
//  MyArray[1] = images/1.jpg,
//  MyArray[2] = images/2.jpg
//  etc...
MyArray[i] = LocationToImages+i+FileType;

//  Increase the value of 'i' by 1
i++;
}

//  Code for the Next button
//  Detect when the next button is clicked:
NextListener = new Object();
Next.addEventListener("click", NextListener);

//  Call the code below if the next button is clicked
NextListener.click = function() {

//  Clear any message alerts 
MessageDisplay = "";

//  Set the variable 'x' as one greater than last time
x = x+1;
 
This?

loadMovie(MyArray[x], _root.MyImagesHolder);
 
After going back and fourth today with oldnewbie away from this forum, the problem was finally uncovered and I would have never caught it at my present level of AS2.0 knowledge. Basically it boils down to proper naming conventions. One out of three components I'm using had an extra white space at the end of its name in the component's source. With only a visual check of the names you wouldn't know it was there.

I learned a great lesson today all to the help of oldnewbie!

Thanks my friend!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top