Solved

loadMovie removes attributes from empty MC

Posted on 2007-04-08
4
268 Views
Last Modified: 2008-02-01
I'm loading images during runtime into empty movie clips(create with createEmptyMovieClips method). Each image has an associated id number which I push onto an array:

var idArray = new Array('1','2','3','4','5');

So now the timeline has an array and 5 movie clips with instance names: for example:  id18, id22, id31, id45, id52

What I want is to, using AS, fade these images in sequence, while id1 fades out I want id2 to fade in, and so on...then have it loop back to 1 when id5 fades out.

Right now I have a varible pos (for position) a movie clip looping infinitely checking to see if the current positions _alpha > 0. I'll stop here because I hit a problem:

My problem is, after the loadMovie('someimage.JPG',_root.id18) finishes, the MC id18._alpha is reporting undefined. Why did loading an image erase this value? The debugger confirms that no values exist in any attributes, yet the image appears fine.

Anyhow, if I could figure that out then my looping MC could increment the _alpha values and loop through the array..unless there is a more elegant solution.
0
Comment
Question by:jstretch
  • 3
4 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 18873965
point here is:

If movieClip is loading an image or SWF externally, you can set property of the movieClilp instance only after it gets loaded completely.
so you need to keep checking if it gets loaded completely then set the value.


- Aneesh Chopra
0
 
LVL 6

Author Comment

by:jstretch
ID: 18873991
So after it loads (completely) I have to set all its attributes? Meaning, flash does not detect and set the attributes for the MC such as _width, _height, _alpha...correct?
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 18874001
yes,
all attributes of a movieClip get losts (except _x and _y) as you load an external JPG or SWF in it..
although it can be set again after loading completion.

- Aneesh Chopra
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 18874003
also variables/functions Movieclip holds get lost.

- Aneesh Chopra
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

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 set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

760 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

22 Experts available now in Live!

Get 1:1 Help Now