Solved

How do you dynamically attach an external movie clip?

Posted on 2008-06-11
5
182 Views
Last Modified: 2010-04-03
Is this possible?

1. Create an empty movie clip called clip_1
2. Load an external movie into clip_1
3. Create another empty movie clip called clip_2
4. Use attachMovie to attach clip1 to clip_2

I don't get any errors, but it doesn't seem to work.

_root.createEmptyMovieClip("clip_1",_root.getNextHighestDepth());
_root.loadMovie("whatever.swf",_root.clip_1);
_root.createEmptyMovieClip("clip_2",_root.getNextHighestDepth());
_root.clip_2.attachMovie(clip_1,"new_clip",_root.getNextHighestDepth());

Since clip_1 was created at runtime, is there anyway to dynamically assign it the "Export for Actionscript" property and give it a linkage identifier?
0
Comment
Question by:section25
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 21761387
I'm in a hurry, so this is a quick responce, but try this:


_root.createEmptyMovieClip("clip_1",_root.getNextHighestDepth());

_root.clip_1.loadMovie("whatever.swf",_root.clip_1.getNextHighestDepth());

_root.clip_1.createEmptyMovieClip("clip_2",_root.clip_1.getNextHighestDepth());

Open in new window

0
 
LVL 8

Author Comment

by:section25
ID: 21761492
Thanks, but no. That doesn't really work. That just creates an empty clip named clip_2 inside of clip_1. I need to actually attach clip_1 to clip_2.
0
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 21766743
What do you mean by "attach"?

The following code should create 'clip_2', and then add 'clip_1' within it, and attach the "whatever.swf" clip to clip_1. Is this what you mean?
_root.createEmptyMovieClip("clip_2",_root.getNextHighestDepth());

_root.clip_2.createEmptyMovieClip("clip_1",_root.clip_2.getNextHighestDepth());

_root.clip_2.clip_1.loadMovie("whatever.swf",_root.clip_2.clip_1.getNextHighestDepth());

Open in new window

0
 
LVL 8

Accepted Solution

by:
section25 earned 0 total points
ID: 21768491
When you use attachMovie(), it gives the attached movie an identifier that is set in the linkage properties of the library. I need to use this identifier when referring to the movie. Therefore, just creating one clip inside another, does not give the same results as using the attachMovie() command.

From what I have read on the internet since I have posted this question, it does not look like it is going to be possible. Apparently, the attachMovie() command only works with assets that are stored in the library.

So unless someone has actually accomplished this, I'll probably just have to admit defeat.

Thanks.
0
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 21768557
The attachMovie command only works with library-content, that's true - but why are you trying to accomplish this? What is the effect you are trying to get out of this?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to record live broadcast.

863 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

Need Help in Real-Time?

Connect with top rated Experts

29 Experts available now in Live!

Get 1:1 Help Now