Solved

a problem in loadMovie

Posted on 2008-10-11
10
492 Views
Last Modified: 2013-11-11
I have a main movie that has two scenes. scene1 has a movie clip which loads another movie clip inside it using loadMovie method, when I load the external movie using the following code in the last frame of the movie clip:

this.createEmptyMovieClip("container",1);
setProperty(this.container, _y, _root._y);
setProperty(this.container, _x, _root._x-200);
this.container.loadMovie("gallery1.swf");
stop();

I have two problems:
1- the external movie loads and the main movie plays the second scene and I don't want it to play.
2- The external movie has some dynamic text fields; the text does not show and the code on the buttons does not work.
0
Comment
Question by:pixarksa
  • 5
  • 4
10 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 22696702
as per my understanding, ur external SWF might be refering to _root which could the main reason.

I suggest to use _lockroot = true, this will lock the root property of external SWF to the root of it own base.. following updated code should fix the issues...




this.createEmptyMovieClip("container",1);
this.container._y = _root._y;
this.container._x = _root._x-200;
this.container._lockroot = true;
this.container.loadMovie("gallery1.swf");
stop();

Open in new window

0
 

Author Comment

by:pixarksa
ID: 22698588
I tried your code, but I the same problem is still there ...
FYI, this code runs on the second frame of the movie clip in the main movie.
Also, the dynamic texts do not appear in the loaded clip
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 22700246
ok,
with the provided information, it is nearly impossible to suggest any solution..

hence,
I request to attach your sample source files for review and quick solution..
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:pixarksa
ID: 22741865
You can download the files from here
http://www.healthgatemed.com/fla/fla_files.zip

There are two files; the main movie which has a movie clip inside it in the movie library named contents_mask_mc3. This movie clip plays the second and the third frames when you press the first button from the right  in this mc. When frame 3 palys it calls gallery1.swf movie and the dynamic text in gallry1.swf does not show!

To browse it and see  contents_mask_mc3 press the third button from the main menu.
0
 

Author Comment

by:pixarksa
ID: 22794532
Hello,

anybody can help me in the above problem please!
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 250 total points
ID: 22795088
problem was, gallery1.fla code is using hardcoded references to the "_level0" which actually creates problem when loaded inside another SWF

now you just need to replace complete code on frame 2 of "gallery1.fla with following and all should work fine, I tested it locally and all seems working fine



var pos:Array = [0, 350, 700, 1050, 1400, 1750, 2100, 2450, 2800, 3150];
var theInfo:Array = [",G'2 DBJ'3 F3() 'D/GHF H 'D96D'* H 'DE-*HI 'DE'&J DD,3E 'D(41J", ",G'2 *4.J5 HA-5 'D/GHF H*-/J/ 'D(J'F'* 'D:0'&J) 'DEF'3() DD,3E", "The Third Car", "The Fourth Car", "The Fifth Car", "The Sixth Car"];
var _this = this;
var numOfPix:Number = 10;
var w:Number = _this.the1_btn._width;
var h:Number = _this.the1_btn._height;
var speed:Number = 10;
var theTgt:Number = 0
//~~~ The text Format ~~~
var theFmt:TextFormat = new TextFormat();
theFmt.align = "center";
theFmt.color = 0xFF6600;
theFmt.font = "theFont";
theFmt.size = 20;
theFmt.bold = true;
//
 
_this.info_txt.selectable = false;
_this.info_txt.setNewTextFormat(theFmt);
//
for (i=1; i<=numOfPix; i++) {
	_this["the"+i+"_btn"].createTextField("theNum_txt", 0, 0, 7, w-13, h-5);
	_this["the"+i+"_btn"].theNum_txt.text = i;
	_this["the"+i+"_btn"].theNum_txt.setTextFormat(theFmt);
}
//
for (i=0; i<=pos.length; i++) {
	_this["the"+i+"_btn"].n = i;
	_this.info_txt.text = _this.theInfo[0];
	_this["the"+i+"_btn"].onRelease = function() {
		_this.theTgt = _this.pos[this.n-1]*-1;
		_this.info_txt.text = _this.theInfo[this.n-1];
	};
	_this["the"+i+"_btn"].onEnterFrame = function() {
		_this.thePix_mc.panorama_mc._x += (_this.theTgt -_this.thePix_mc.panorama_mc._x+1500)/_this.speed;
	};
}stop();

Open in new window

0
 
LVL 34

Assisted Solution

by:Aneesh Chopra
Aneesh Chopra earned 250 total points
ID: 22795104
arabic characters in the code gets scrumbled,
so I am sending the udpated/working gallery1.FLA, just complete and use the updated SWF
gallery1.fla.txt
0
 

Author Comment

by:pixarksa
ID: 22795928
thank you aneeshchopra,

The dynamic text problem is solved, but the problem of the main movie plays the next scene is still there.

To see the problem, press the third button in the main menu, then press the first button from the right in the page contents; you will see that the main movie plays to the second scene while the gallry1.swf is loaded
0
 

Author Comment

by:pixarksa
ID: 22807986
Hi,

I tried some changes in the loadMovie code, but it is still not working! any idea about the solution ...
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Pushing Adobe Flash Player Fails with Error %%2 1 490
Error 2032 in all the browser 6 2,851
Video sharing with user login 3 209
What process can I use to achieve this? 5 124
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question