• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

Loading a movie in a x and y position, simple but it does not work

Hi all,

I have a Flash movie with a movieclip inside called main (main has been dragged into the stage).
In main at certain frame I have:
loadMovie("teletipo.swf", 1);

Which loads teletipo.swf but in a x=0 and y=0 position. As I need it in a x=320 and y=165 position I've done:

this.createEmptyMovieClip("container", 1);
container._x =320;
container._y =165;
container.loadMovie("teletipo.swf");

But this does not load the teletipo.swf ... what am I doing wrong? How should I fix it?
Thanks a ton in advance!

0
Dada44
Asked:
Dada44
  • 5
  • 2
  • 2
1 Solution
 
biyikCommented:
Hi!
You can try
loadMovie("teletipo.swf", container);

0
 
Dada44Author Commented:
Hi biyik, thanks for answering.
I am doing oadMovie("teletipo.swf", container); and it is not working, is not loading the movie :(
I have put the line by itself and created a movie clip called container .. but it does not work
0
 
biyikCommented:
Creating a holder movieclip is a good solution. But can't understand why your codes don't work (by the way, container.loadMovie("teletipo.swf") is same with loadMovie("teletipo.swf", container); I just wanted to try...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Dada44Author Commented:
thanks biyik .. don't know why it isn't loading the movie and if I do just loadMovie("teletipo.swf", 1); it does .. can I postion teletipo.swf from this line?
0
 
Dada44Author Commented:
I don't get it .. why loadMovie("teletipo.swf", 1) works and not the other code ??

Just in case something is bothering the main movie here's teletipo.fla (26kb)
www.vivocom.es/test/teletipo.rar

Please help me with this, I'm going nuts!!
Thanks again!
0
 
Dada44Author Commented:
Any ideas? Please I'm going nuts!!
0
 
Dada44Author Commented:
Just in case somebody needs it:

In the teletipo.fla on the first frame, add the following:

this._x = 320;
this._y = 165;

Then in your main movie, just use:

loadMovieNum("teletipo.swf", 1);
0
 
CraybeCommented:
The problem is that you are trying to assign an x & y value to the container before it's content exists.

You need to create a listener so once the movie starts to load and the contents exists you assign the values to it.

Below is the code, let me know if you need more info.
//Create your Container Movieclip
this.createEmptyMovieClip("container", 1);
//Create the Listener Object, it will act as the object to trigger events off
var loadcheck:Object = new Object();
//Run the event once the movie starts to load
loadcheck.onLoadInit = function(target_mc:MovieClip) {
        //target_mc is the movie you are listening for.  This allows you to reuse the listener object.
	target_mc._x = 320
	target_mc._y = 165
}
//Create a Movie Clip Loader
var loadswf:MovieClipLoader = new MovieClipLoader();
//Add the listener to the Movie Clip Loader
loadswf.addListener(loadcheck);
//Load content into the loader
//Args are (Name of Movie Clip, Movie Clip to Load into)
loadswf.loadClip("teletipo.swf", container)

Open in new window

0
 
CraybeCommented:
Wow that looks a mess here is the code without the comments:
this.createEmptyMovieClip("container", 1);
var loadcheck:Object = new Object();
loadcheck.onLoadInit = function(target_mc:MovieClip) {
        target_mc._x = 320
        target_mc._y = 165
}
var loadswf:MovieClipLoader = new MovieClipLoader();
loadswf.addListener(loadcheck);
loadswf.loadClip("teletipo.swf", container)

Open in new window

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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