Actualy, you have the same problem that I had 2 weeks ago...

From Ryan in response to my centering problem of loaded SWF...

-------------------------------------

Ryan Potter wrote:

Eric-

I have run into the same problem before. the only way I found to force a clip to have a certain dimension is to put a graphic in at the size you want the clip to be. I realize that you don't have control over the swfs that are being created but I have never been able to solve this either. The width and height of the clip always equate to the width and height of the content in the clip.

The Only way I have been able to solve this is to use onLoadInit and set vars on the child that state the width and height explicitly. But this requires having access to the fla.

Child Swf in the first frame:
   this.w = 300;
   this.h = 300;

Parent centering function called from the loader.onLoadInit
function centerClip(clip){
   var w = clip.w;
   var h = clip.h;
   clip._x = Stage.width/2-(w/2);
   clip._y = Stage.height/2-(h/2);
}

--------------------------------------

Good luck!

lars wrote:

well, the instances can differ because the swfs to be loaded
can be any swf, so i have no chance to prepare each of them.
any other solution to get the real (stage size) dimensions?


Am 20.02.2006 19:47 Uhr schrieb "Éric Thibault" unter
<[EMAIL PROTECTED]>:

The dimension of the loaded SWF is the space occupied by instances on
it's first frame... try to place a rectangle at 0:0 with a dimension of
1024 * 768 on frame one in your loaded SWF... Does it do the trick?

A+

Eric Thibault


lars wrote:

hi all. i'm trying to load a swf and scale it down to a specific size
before displaying it. i'm using this to do so:

var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
  trace("target w:"+target_mc._width);
  trace("target h:"+target_mc._height);
  trace("target ver:" + target_mc.getSWFVersion());
  var newScaleRatio:Number = Math.min( 350/target_mc._width,
250/target_mc._height)*100;
  target_mc._xscale = newScaleRatio;
  target_mc._yscale = newScaleRatio;
};

var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("1024768dummy.swf", _root.holder);

the swf (1024768dummy.swf) has a size of 1024x768 pixel. when i test
my script it returns: 947.7 (width) and 126.95 (height)... what's wrong
with it? i exported the dummy as version 6 swf btw. thanks: lars


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



--
===============================================================

Éric Thibault
Programmeur analyste
Réseau de valorisation de l'enseignement
Université Laval, pavillon Félix-Antoine Savard
Québec, Canada
Tel.: 656-2131 poste 18015
Courriel : [EMAIL PROTECTED]

===============================================================

Avis relatif à la confidentialité / Notice of Confidentiality / Advertencia de 
confidencialidad <http://www.rec.ulaval.ca/lce/securite/confidentialite.htm>

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to