Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do you dynamically attach an external movie clip?

Posted on 2008-06-11
5
Medium Priority
?
189 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

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.

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

721 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