[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1757
  • Last Modified:

Load external SWF into Flash and resize it

Hi

I have external file , that I need to load into my FLASH project.

Problem is that when I'm loading it , it changes the size to all the screen , but I want it to be smaller.

Please advice.

Attached current code.
on (press) {
	_root.createEmptyMovieClip("container", 1);
	loadMovie("http://localhost/skyhighband/flashgallery.swf?content_path=images&color_path=default.xml&allowFullScreen=false&script_path=flashgallery.php", "container");
	container._x = 0 ;
	container._y = 0 ;
	container.height = 300 ;
	container.width = 400 ;
	
}

Open in new window

0
jekaman
Asked:
jekaman
  • 5
  • 4
1 Solution
 
Aneesh ChopraCommented:
replace your code with following updated code:


on (press) {
	var mc = _root.createEmptyMovieClip("container", 1);
	mc.holder = mc.createEmptyMovieClip("holder", 1);
	mc.holder.loadMovie("http://localhost/skyhighband/flashgallery.swf?content_path=images&color_path=default.xml&allowFullScreen=false&script_path=flashgallery.php");
	mc._x = 0;
	mc._y = 0;
	mc.onEnterFrame = function() {
		if (this.holder.getBytesLoaded() == this.holder.getBytesTotal() && this.holder._width>0) {
			this.holder.height = 300;
			this.holder.width = 400;
			delete this.onEnterFrame;
 
		}
	};
}

Open in new window

0
 
jekamanAuthor Commented:
Nop, did not help.

Attached screen shoots.
before.jpg
after.jpg
0
 
Aneesh ChopraCommented:
Code should work,
I suggest to attach your source file for review
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jekamanAuthor Commented:
experts-exchange blocks the .fla.

I can mail it to you.
0
 
Aneesh ChopraCommented:
rename extension to .txt and attach it
0
 
jekamanAuthor Commented:
0
 
Aneesh ChopraCommented:
make sure that loading SWF should have graphics on first frame
I also found issue in previous code:

"height" should have been "_height"
"width" should have been "_width

try following updated code  :
on (press) {
	var mc = _root.createEmptyMovieClip("container", 1);
	mc.holder = mc.createEmptyMovieClip("holder", 1);
	mc.holder.loadMovie("http://localhost/skyhighband/flashgallery.swf?content_path=images&color_path=default.xml&allowFullScreen=false&script_path=flashgallery.php");
	mc._x = 0;
	mc._y = 0;
	mc.onEnterFrame = function() {
		if (this.holder.getBytesLoaded() == this.holder.getBytesTotal() && this.holder._width>0) {
			this.holder._height = 300;
			this.holder._width = 400;
			delete this.onEnterFrame; 
		}
	};
}

Open in new window

0
 
jekamanAuthor Commented:
What do you mean "make sure that loading SWF should have graphics on first frame" , I have a button there , and clip object.

When you click on the button it is loaded into the clip....
0
 
Aneesh ChopraCommented:
thats mean, every FLA has a stage size,
lets assume 550x400.
So you need to make sure that first frame should have a rectangle box of exact stage size, it is required to get the SWF size
because when an SWF gets loaded in another SWF it actually does not have any stage so content on the stage is must to get the stage size..
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now