Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 15th, 2003, 05:35 PM
georges georges is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 1 georges User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
centering MovieClip on loadMovie()

Hey guys,

Here's my function:

leftBnd = 100;
rightBnd = 730;
topBnd = 15;
lowBnd = 360;

insertMovie = function(swf){
with(_root){
emptyClip.unloadMovie();
emptyClip._visible = false;
emptyClip.loadMovie(swf);

trace("width: " + emptyClip._width);
trace("height: " + emptyClip._height);

xpos = (rightBnd-leftBnd)-emptyClip._width;
xpos = (xpos/2) + leftBnd;
trace("x: " + xpos);

ypos = (lowBnd-topBnd)-emptyClip._height;
ypos = (ypos/2) + topBnd;
trace("y: " + xpos);

emptyClip._x = xpos;
emptyClip._y = ypos;

emptyClip._visible = true;
}
}




Now, the first time this function is executed I get 0 and 0 for the emptyClip's width and height even though it has run loadMovie(). Why is this? I would think that it would return the width and height of the newly loaded movie... because of this erroneous width and height the movie doesn't center correctly unless the function is run twice to load the same movie.

The second time it is run it returns the w and h of the first loaded movie...

the third time it returns the w and h of the second movie, etc, etc.

Any help?

thanks

georges

Reply With Quote
  #2  
Old July 25th, 2003, 12:13 AM
Caimin Caimin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Rome, Italy.
Posts: 48 Caimin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 52 sec
Reputation Power: 5
You need to load the SWF before you start to run the function to get the width, etc. Easiest solution would probably be to split this function in two.
__________________
Caimin
Freelance Flash, web + games developer

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > centering MovieClip on loadMovie()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway