Ask a Question related to Macromedia Flash, Design and Development.
-
ICM #1
CreateEmptyMovieClip and Layers question
Hi -
I'm trying to improve my ActionScript skills and have run into
difficulty. I'm trying to create a flexible and dynamic system that
loads an XML file which defines what the content should be and where
to get it from.
I'm trying to be efficient and keep all my code in the first frame (or
as few frames as needed), and I'd like to create all the objects
dynamically at runtime.
I'm trying to use CreateEmptyMovieClip to create a dynamic menu screen
with various numbers of buttons. I load info from the XML file, which
works fine. When the XML is fully loaded I run a function which
displays a background and creates menu choices:
this.createEmptyMovieClip("mcMenuBackground", 0);
mcMenuBackground.loadMovie(MenuBackground);
Where the link to "MenuBackground" has been loaded from the XML.
Next I try to create menu choices. I have a FOR loop which tries to
create a movieClip for each menu choice defined in the XML like this:
for(var i = 0; i < ButtonImageList.length; i++)
this.mcMenuBackground.createEmptyMovieClip("Button Image"+i,i+10);
Eval("ButtonImage"+i).LoadMovie(ButtonImageList[i]);
Eval("ButtonImage"+i)._x = 100+(i*280)
Eval("ButtonImage"+i)._y = 100
Eval("ButtonImage"+i).visible = TRUE;
Eval("ButtonImage"+i).UseHandCursor;
Eval("ButtonImage"+i).onRollover = ButtonRollover();
Eval("ButtonImage"+i).onRollout = ButtonRollout();
}
}
When I test it the menu choices are not displayed. When I debug and
use Ctrl-L in the trace window I see that the ButtonImage objects are
created:
Movie Clip: Frame=0 Target="_level0.mcMenuBackground"
Movie Clip: Frame=0 Target="_level0.mcMenuBackground.ButtonImage0"
Movie Clip: Frame=0 Target="_level0.mcMenuBackground.ButtonImage1"
Movie Clip: Frame=0 Target="_level0.mcMenuBackground.ButtonImage2"
But when I continue in debug the ButtonImage objects disappear and of
course aren't displayed on screen. The only AS I have after the
function that tries to build the menu are the onRollover and onRollout
functions.
I'm not sure if I'm using CreateEmptyMovieClip incorrectly, or if I am
not thinking of layers properly or if my ActionScript is in the wrong
place or what.
Any thoughts are greatly appreciated. TIA!
George
ICM Guest
-
Big Layers question
My name is Marc and I am new to Dreamweaver, although I have made alot of sites with Frontpage. I am trying to put a virticle navigation bar into... -
Layers Question
Hi Layers - Say I have 2 master (top?) layers. Then inside each of those there may be 50 sub layers. I want to take one sub layer out to be a 3rd... -
createEmptyMovieClip always below other layers?
I'm using createEmptyMovieClip() to make, well, an empty MovieClip, in which I then draw a TextField using createTextField(). The trouble is, even... -
createEmptyMovieClip & functions
Hi! Could somebody explane to me why following code does work: --------------------------------------------------------------- click_mc =... -
createEmptyMovieClip <-> setMask
Hi, Does anyone know why I can't seem to set a mask right after i create the movieclip? Something like this ...



Reply With Quote

