Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi everybody, Two questions: 1)

Status
Not open for further replies.

bobetko

Programmer
Joined
Jan 14, 2003
Messages
155
Location
US
Hi everybody,

Two questions:
1) I am trying to load external movie and then attach movie from library to the loaded movie. Is it possible to do it?

I have movie myMovieClip on the stage and I am loading external movie in it:

myMovieClip.loadMovie("extMovie.swf");

then, I am trying to attach movie:

myMovieClip.attachMovie("myMovie", "myMovie1",0);

and, nothing is happening.

But, if I delete first line (loadMovie), it is working and myMovie gets attached to myMovieClip. It seems that loadMovie is doing something to my myMovieClip. I tried also to make sure that extMovie.swf is fully loaded and then to do attachMovie, but flash didn't care.

2) If I use createEmptyMovieClip and load some movie to it, how can I create Linkage in the library so that I can attach that new movie to the other movies?

Thanks in advance.
 
The
Code:
loadMovie
action is not really a dot-syntax type thing. If you want to load the movie to myMovieClip, do it this way:

Code:
loadMovie("extMovie.swf", "myMovieClip")

As for the second question, go to Library, right-click the movieclip you want to add linkage to, select linkage, and click on the one that has to do with Actionscript, not runtime sharing, then in the linkage identifier box, type the name you want, like myLinkageMovie. To attach it, say someMC.attachMovie("myLinkageMovie").
Regards,
FLASHfreak:-)
 
Flashfreak....

Thanks for your response, but I still need an answer on how to attach movie to loaded movies. If I use or not "dot-sintax" type doesn't make any difference. Movie cannot be attached.

And also, since Flash 5 Macromedia wants us to use "dot-sintax" type. So, I think, MyMovie.loadMovie("movieToLoad.swf") is proper sintax.
(I am using MX)

This is from Flash Reference:

Usage:
myMovieClip.loadMovie("url" [,variables])

Parameters:
url An absolute or relative URL of the SWF or JPEG file to be loaded. A relative path must be relative to the SWF file at _level0. The URL must be in the same subdomain as the URL where the movie currently resides. For use in the stand-alone Flash Player or for testing in test mode in the Flash authoring application, all SWF files must be stored in the same folder, and the filenames cannot include folder or disk drive specifications.

variables An optional parameter specifying an HTTP method for sending or loading variables. The parameter must be the string GET or POST. If there are no variables to be sent, omit this parameter. The GET method appends the variables to the end of the URL, and is used for small numbers of variables. The POST method sends the variables in a separate HTTP header and is used for long strings of variables.

Returns:
Nothing.

Description:
Method; loads SWF or JPEG files into a movie clip in the Flash Player while the original movie is playing. Without the loadMovie method, the Flash Player displays a single movie (SWF file) and then closes. The loadMovie method lets you display several movies at once and switch between movies without loading another HTML document.

A movie or image loaded into a movie clip inherits the position, rotation, and scale properties of the movie clip. You can use the target path of the movie clip to target the loaded movie.

Use the unloadMovie method to remove movies or images loaded with the loadMovie method. Use the loadVariables method to keep the active movie, and update the variables with new values.
 
And your second advice:

You didn't read my question. Movie will be dinamically loaded during runtime, so I cannot go to library (F11) and turn on linkage. Movie is not in the library.

So, I will do createEmptyClips, I will load something to it, then I want to attach it to some other movie. To attach it I need to create linkage to that newly created object. How I do that dinamically, from ActionScript?
 
Whenever I am using
Code:
loadMovie()
, I just load the movie directly into the target, like
Code:
loadMovie("a.swf", "b")
. View the reference to
Code:
loadMovie()
in Macromedia Flash MX's reference panel, and they don't use dot-syntax in their loadMovie command. The 1st parameter is the location of the external movie, and the 2nd parameter is the MC you load the movie into. Believe me, thats how it works.
FLASHfreak:-)

P.S. Don't know how to apply linkage to an external object.
 
Wait, my reference is way different. It says:
Code:
Availability

Flash Player 3.

Usage

loadMovie("url",level/target[, variables])

Parameters

url The absolute or relative URL of the SWF file or JPEG file to be loaded. A relative path must be relative to the SWF file at level 0. The URL must be in the same subdomain as the URL where the movie currently resides. For use in the Flash Player or for testing in test mode in the Flash authoring application, all SWF files must be stored in the same folder, and the filenames cannot include folder or disk drive specifications.

target A path to a target movie clip. The target movie clip will be replaced by the loaded movie or image. You must specify either a target movie clip or a level of a target movie; you can't specify both.

level An integer specifying the level in the Flash Player into which the movie will be loaded. When you load a movie or image into a level, the loadMovie action in the Actions panel in normal mode switches to loadMovieNum; in expert mode, you must specify loadMovieNum or choose it from the Actions toolbox. 

variables An optional parameter specifying an HTTP method for sending variables. The parameter must be the string GET or POST. If there are no variables to be sent, omit this parameter. The GET method appends the variables to the end of the URL, and is used for small numbers of variables. The POST method sends the variables in a separate HTTP header and is used for long strings of variables.

Returns

Nothing.

Description

Action; load a SWF or JPEG file into the Flash Player while the original movie is playing. The loadMovie action lets you display several movies at once and switch between movies without loading another HTML document. Without the loadMovie action, the Flash Player displays a single movie (SWF file) and then closes.

When you use the loadMovie action, you must specify either a level in the Flash Player or a target movie clip, into which the movie will load. If you specify a level, the action changes to loadMovieNum. If a movie is loaded into a target movie clip, you can use the target path of that movie clip to target the loaded movie.

A movie or image loaded into a target inherits the position, rotation, and scale properties of the targeted movie clip. The upper left corner of the loaded image or movie aligns with the registration point of the targeted movie clip. Alternatively, if the target is the _root Timeline, the upper left corner of the image or movie aligns with the upper left corner of the Stage.

Use the unloadMovie action to remove movies loaded with the loadMovie action. 

Example

The following loadMovie statement is attached to a navigation button labeled Products. There is an invisible movie clip on the Stage with the instance name dropZone. The loadMovie action uses this movie clip as the target parameter to load the products in the SWF file, into the correct position on the Stage.

on(release) {
	loadMovie("products.swf",_root.dropZone);
}

The following example loads a JPEG image from the same directory as the SWF File that calls the loadMovie action:

loadMovie("image45.jpeg", "ourMovieClip");

What version of Flash are you using?
 
First thing is that both syntax can be used...

loadMovie("extMovie.swf", "myMovieClip")

Or...

myMovieClip.loadMovie("extMovie.swf");

As for your second question, don't think you can attach a Library movie clip to an external .swf loaded in a container clip or even on another level.
 
I have no idea how you can create Linkage with actionscript, but it seems like you should be able to work around that limitation.

i would try to ---> create a movie clip with nothing in it. give it a linkage name the traditional way. load whatever junk you want into that container... you should then be able to attach that to other movies.

for practical use that ought to work. if you're stuck on the idea of doing everything totally dynamically ... it doesnt look good.

 
that's exactly what I did. THX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top