Solved

loadMovie removes attributes from empty MC

Posted on 2007-04-08
4
270 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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 …
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
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.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

776 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