Solved

How do you dynamically attach an external movie clip?

Posted on 2008-06-11
5
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
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.

626 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