Solved

How do you dynamically attach an external movie clip?

Posted on 2008-06-11
5
181 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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…
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 how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

763 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

6 Experts available now in Live!

Get 1:1 Help Now